Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 35c8658

Browse files
committed
Merged revisions 64119,64147,64150,64165,64219-64221,64229-64230,64233,64235,64253,64278,64280,64301,64303,64320,64328,64338-64339 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r64119 | andrew.kuchling | 2008-06-11 14:53:14 +0200 (mer., 11 juin 2008) | 1 line Note PEP 371 section ........ r64147 | benjamin.peterson | 2008-06-11 22:04:30 +0200 (mer., 11 juin 2008) | 2 lines update ACKS and NEWs for multiprocessing ........ r64150 | georg.brandl | 2008-06-11 22:28:06 +0200 (mer., 11 juin 2008) | 2 lines Can we agree to put dots at entry ends? Thanks. ........ r64165 | armin.rigo | 2008-06-12 11:50:58 +0200 (jeu., 12 juin 2008) | 3 lines Sounds obvious, but I didn't even realize that you can put non-string keys in type dictionaries without using this locals() hack. ........ r64219 | neal.norwitz | 2008-06-13 08:00:46 +0200 (ven., 13 juin 2008) | 1 line Check for memory alloc failure ........ r64220 | neal.norwitz | 2008-06-13 08:02:26 +0200 (ven., 13 juin 2008) | 3 lines Fix some memory dealloc problems when exceptions occur. It caused: "Fatal Python error: UNREF invalid object" in the DoubleTest. ........ r64221 | neal.norwitz | 2008-06-13 08:03:25 +0200 (ven., 13 juin 2008) | 3 lines Fix typo in method name. The LT class implemented less than. The LE class should implement less than or equal to (as the code does). ........ r64229 | georg.brandl | 2008-06-13 15:26:54 +0200 (ven., 13 juin 2008) | 2 lines Clarification. ........ r64230 | robert.schuppenies | 2008-06-13 15:29:37 +0200 (ven., 13 juin 2008) | 2 lines Fixed: sys.getsizeof does not take the actual length of the tuples into account. ........ r64233 | benjamin.peterson | 2008-06-13 17:11:50 +0200 (ven., 13 juin 2008) | 2 lines platform.uname now tries to fill empty values even when os.uname is present ........ r64235 | benjamin.peterson | 2008-06-13 17:41:09 +0200 (ven., 13 juin 2008) | 1 line set svn:ignore on multiprocessing ........ r64253 | andrew.kuchling | 2008-06-13 21:38:18 +0200 (ven., 13 juin 2008) | 1 line Typo fixes ........ r64278 | martin.v.loewis | 2008-06-14 16:24:47 +0200 (sam., 14 juin 2008) | 2 lines Disable UAC by default. ........ r64280 | gregory.p.smith | 2008-06-14 19:34:09 +0200 (sam., 14 juin 2008) | 3 lines silence the test when it is skipped on some platforms. should fix a buildbot. ........ r64301 | georg.brandl | 2008-06-15 21:54:36 +0200 (dim., 15 juin 2008) | 2 lines Forward-port new test from r64300. ........ r64303 | raymond.hettinger | 2008-06-16 03:42:40 +0200 (lun., 16 juin 2008) | 1 line Issue 3116: fix quadratic behavior in marshal.dumps(). ........ r64320 | georg.brandl | 2008-06-16 23:00:47 +0200 (lun., 16 juin 2008) | 2 lines Add Jesse Noller to the developers list. ........ r64328 | georg.brandl | 2008-06-17 11:01:35 +0200 (mar., 17 juin 2008) | 2 lines Split the HTML index. ........ r64338 | vinay.sajip | 2008-06-17 13:02:14 +0200 (mar., 17 juin 2008) | 1 line Bug #3126: StreamHandler and FileHandler check before calling "flush" and "close" that the stream object has these, using hasattr (thanks to bobf for the patch). ........ r64339 | vinay.sajip | 2008-06-17 13:04:02 +0200 (mar., 17 juin 2008) | 1 line Updated with fix for #3126. ........
1 parent 6a00b64 commit 35c8658

18 files changed

Lines changed: 123 additions & 52 deletions

File tree

Doc/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@
9595
# Output file base name for HTML help builder.
9696
htmlhelp_basename = 'python' + release.replace('.', '')
9797

98+
# Split the index
99+
html_split_index = True
100+
98101

99102
# Options for LaTeX output
100103
# ------------------------

Doc/library/optparse.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,9 @@ Or, where the user fails to pass a value at all::
636636
option involved in the error; be sure to do the same when calling
637637
``parser.error()`` from your application code.
638638

639-
If :mod:`optparse`'s default error-handling behaviour does not suite your needs,
640-
you'll need to subclass OptionParser and override ``exit()`` and/or
641-
:meth:`error`.
639+
If :mod:`optparse`'s default error-handling behaviour does not suit your needs,
640+
you'll need to subclass OptionParser and override its :meth:`exit` and/or
641+
:meth:`error` methods.
642642

643643

644644
.. _optparse-putting-it-all-together:

Doc/whatsnew/2.6.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,21 @@ environment variable.
521521

522522
.. ======================================================================
523523
524+
.. _pep-0371:
525+
526+
PEP 371: The ``multiprocessing`` Package
527+
=====================================================
528+
529+
XXX write this.
530+
531+
.. seealso::
532+
533+
:pep:`371` - Per-user ``site-packages`` Directory
534+
PEP written by Jesse Noller and Richard Oudkerk;
535+
implemented by Jesse Noller.
536+
537+
.. ======================================================================
538+
524539
.. _pep-3101:
525540

526541
PEP 3101: Advanced String Formatting

Lib/logging/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ def flush(self):
731731
"""
732732
Flushes the stream.
733733
"""
734-
if self.stream:
734+
if self.stream and hasattr(self.stream, "flush"):
735735
self.stream.flush()
736736

737737
def emit(self, record):
@@ -787,7 +787,8 @@ def close(self):
787787
"""
788788
if self.stream:
789789
self.flush()
790-
self.stream.close()
790+
if hasattr(self.stream, "close"):
791+
self.stream.close()
791792
StreamHandler.close(self)
792793
self.stream = None
793794

Lib/platform.py

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,23 +1066,30 @@ def uname():
10661066
10671067
"""
10681068
global _uname_cache
1069+
no_os_uname = 0
10691070

10701071
if _uname_cache is not None:
10711072
return _uname_cache
10721073

1074+
processor = ''
1075+
10731076
# Get some infos from the builtin os.uname API...
10741077
try:
10751078
system,node,release,version,machine = os.uname()
1076-
10771079
except AttributeError:
1078-
# Hmm, no uname... we'll have to poke around the system then.
1079-
system = sys.platform
1080-
release = ''
1081-
version = ''
1082-
node = _node()
1083-
machine = ''
1084-
processor = ''
1085-
use_syscmd_ver = 1
1080+
no_os_uname = 1
1081+
1082+
if no_os_uname or not filter(None, (system, node, release, version, machine)):
1083+
# Hmm, no there is either no uname or uname has returned
1084+
#'unknowns'... we'll have to poke around the system then.
1085+
if no_os_uname:
1086+
system = sys.platform
1087+
release = ''
1088+
version = ''
1089+
node = _node()
1090+
machine = ''
1091+
1092+
use_syscmd_ver = 01
10861093

10871094
# Try win32_ver() on win32 platforms
10881095
if system == 'win32':
@@ -1093,8 +1100,10 @@ def uname():
10931100
# available on Win XP and later; see
10941101
# http://support.microsoft.com/kb/888731 and
10951102
# http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM
1096-
machine = os.environ.get('PROCESSOR_ARCHITECTURE', '')
1097-
processor = os.environ.get('PROCESSOR_IDENTIFIER', machine)
1103+
if not machine:
1104+
machine = os.environ.get('PROCESSOR_ARCHITECTURE', '')
1105+
if not processor:
1106+
processor = os.environ.get('PROCESSOR_IDENTIFIER', machine)
10981107

10991108
# Try the 'ver' system command available on some
11001109
# platforms
@@ -1136,30 +1145,28 @@ def uname():
11361145
release,(version,stage,nonrel),machine = mac_ver()
11371146
system = 'MacOS'
11381147

1139-
else:
1140-
# System specific extensions
1141-
if system == 'OpenVMS':
1142-
# OpenVMS seems to have release and version mixed up
1143-
if not release or release == '0':
1144-
release = version
1145-
version = ''
1146-
# Get processor information
1147-
try:
1148-
import vms_lib
1149-
except ImportError:
1150-
pass
1151-
else:
1152-
csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0)
1153-
if (cpu_number >= 128):
1154-
processor = 'Alpha'
1155-
else:
1156-
processor = 'VAX'
1148+
# System specific extensions
1149+
if system == 'OpenVMS':
1150+
# OpenVMS seems to have release and version mixed up
1151+
if not release or release == '0':
1152+
release = version
1153+
version = ''
1154+
# Get processor information
1155+
try:
1156+
import vms_lib
1157+
except ImportError:
1158+
pass
11571159
else:
1158-
# Get processor information from the uname system command
1159-
processor = _syscmd_uname('-p','')
1160+
csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0)
1161+
if (cpu_number >= 128):
1162+
processor = 'Alpha'
1163+
else:
1164+
processor = 'VAX'
1165+
if not processor:
1166+
# Get processor information from the uname system command
1167+
processor = _syscmd_uname('-p','')
11601168

1161-
# 'unknown' is not really any useful as information; we'll convert
1162-
# it to '' which is more portable
1169+
#If any unknowns still exist, replace them with ''s, which are more portable
11631170
if system == 'unknown':
11641171
system = ''
11651172
if node == 'unknown':

Lib/test/crashers/loosing_mro_ref.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ class Base(object):
2727
class Base2(object):
2828
mykey = 'from Base2'
2929

30-
class X(Base):
31-
# you can't add a non-string key to X.__dict__, but it can be
32-
# there from the beginning :-)
33-
locals()[MyKey()] = 5
30+
# you can't add a non-string key to X.__dict__, but it can be
31+
# there from the beginning :-)
32+
X = type('X', (Base,), {MyKey(): 5})
3433

3534
print(X.mykey)
3635
# I get a segfault, or a slightly wrong assertion error in a debug build.

Lib/test/test_grammar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ def testLambdef(self):
335335
self.assertEquals(l5(1, 2), 5)
336336
self.assertEquals(l5(1, 2, 3), 6)
337337
check_syntax_error(self, "lambda x: x = 2")
338+
check_syntax_error(self, "lambda (None,): None")
338339
l6 = lambda x, y, *, k=20: x+y+k
339340
self.assertEquals(l6(1,2), 1+2+20)
340341
self.assertEquals(l6(1,2,k=10), 1+2+10)

Lib/test/test_heapq.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,11 @@ def __lt__(self, other):
211211
class LE:
212212
def __init__(self, x):
213213
self.x = x
214-
def __lt__(self, other):
214+
def __le__(self, other):
215215
return self.x >= other.x
216216
data = [random.random() for i in range(100)]
217217
target = sorted(data, reverse=True)
218+
print("HASATTR", hasattr(LE(0), "__lt__"), LE(0).__lt__)
218219
self.assertEqual(hsort(data, LT), target)
219220
self.assertEqual(hsort(data, LE), target)
220221

Lib/test/test_struct.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import sys
1010
ISBIGENDIAN = sys.byteorder == "big"
11+
IS32BIT = sys.maxsize == 0x7fffffff
1112
del sys
1213

1314
try:
@@ -580,6 +581,11 @@ def test_bool(self):
580581
for c in [b'\x01', b'\x7f', b'\xff', b'\x0f', b'\xf0']:
581582
self.assertTrue(struct.unpack('>?', c)[0])
582583

584+
if IS32BIT:
585+
def test_crasher(self):
586+
self.assertRaises(MemoryError, struct.pack, "357913941b", "a")
587+
588+
583589
def test_main():
584590
run_unittest(StructTest)
585591

Lib/test/test_sys.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,9 @@ def test_specialtypes(self):
520520
self.check_sizeof(32768, h + self.align(2) + 2)
521521
self.check_sizeof(32768*32768-1, h + self.align(2) + 2)
522522
self.check_sizeof(32768*32768, h + self.align(2) + 4)
523+
# tuple
524+
self.check_sizeof((), h)
525+
self.check_sizeof((1,2,3), h + 3*p)
523526

524527

525528
def test_main():

0 commit comments

Comments
 (0)