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

Skip to content

Commit e52e378

Browse files
committed
Merged revisions 73995,74002,74005,74007-74008,74011,74019-74023 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r73995 | vinay.sajip | 2009-07-13 07:21:05 -0400 (Mon, 13 Jul 2009) | 1 line Issue #6314: logging: Extra checks on the "level" argument in more places. ........ r74002 | marc-andre.lemburg | 2009-07-13 16:23:49 -0400 (Mon, 13 Jul 2009) | 6 lines Use a new global DEV_NULL instead of hard-coding /dev/null into the system command helper functions. See #6479 for some motivation. ........ r74005 | marc-andre.lemburg | 2009-07-13 17:28:33 -0400 (Mon, 13 Jul 2009) | 6 lines Use a different VER command output parser to address the localization issues mentioned in #3410. Prepare for Windows 7 (still commented out). ........ r74007 | michael.foord | 2009-07-14 13:58:12 -0400 (Tue, 14 Jul 2009) | 1 line Move TestRunner initialisation into unittest.TestProgram.runTests. Fixes issue 6418. ........ r74008 | benjamin.peterson | 2009-07-14 20:46:42 -0400 (Tue, 14 Jul 2009) | 1 line update year ........ r74011 | ezio.melotti | 2009-07-15 13:07:04 -0400 (Wed, 15 Jul 2009) | 1 line methods' names pep8ification ........ r74019 | amaury.forgeotdarc | 2009-07-15 17:29:27 -0400 (Wed, 15 Jul 2009) | 2 lines #6076 Add a title to the IDLE Preferences window. ........ r74020 | georg.brandl | 2009-07-16 03:18:07 -0400 (Thu, 16 Jul 2009) | 1 line #5910: fix kqueue for calls with more than one event. ........ r74021 | georg.brandl | 2009-07-16 03:33:04 -0400 (Thu, 16 Jul 2009) | 1 line #6486: start with built in functions rather than "built in objects". ........ r74022 | georg.brandl | 2009-07-16 03:38:35 -0400 (Thu, 16 Jul 2009) | 1 line #6481: fix typo in os.system() replacement. ........ r74023 | jesse.noller | 2009-07-16 10:23:04 -0400 (Thu, 16 Jul 2009) | 1 line Issue 6433: multiprocessing.pool.map hangs on empty list ........
1 parent cf7128c commit e52e378

13 files changed

Lines changed: 84 additions & 23 deletions

File tree

Doc/copyright.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Copyright
44

55
Python and this documentation is:
66

7-
Copyright © 2001-2008 Python Software Foundation. All rights reserved.
7+
Copyright © 2001-2009 Python Software Foundation. All rights reserved.
88

99
Copyright © 2000 BeOpen.com. All rights reserved.
1010

Doc/library/intro.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ browse the table of contents (in front of the manual), or look for a specific
4343
function, module or term in the index (in the back). And finally, if you enjoy
4444
learning about random subjects, you choose a random page number (see module
4545
:mod:`random`) and read a section or two. Regardless of the order in which you
46-
read the sections of this manual, it helps to start with chapter :ref:`builtin`,
47-
as the remainder of the manual assumes familiarity with this material.
46+
read the sections of this manual, it helps to start with chapter
47+
:ref:`built-in-funcs`, as the remainder of the manual assumes familiarity with
48+
this material.
4849

4950
Let the show begin!
5051

Doc/library/subprocess.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ Replacing :func:`os.system`
420420
sts = os.system("mycmd" + " myarg")
421421
==>
422422
p = Popen("mycmd" + " myarg", shell=True)
423-
sts = os.waitpid(p.pid, 0)
423+
sts = os.waitpid(p.pid, 0)[1]
424424

425425
Notes:
426426

Lib/idlelib/configDialog.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def __init__(self,parent,title):
3030
self.wm_withdraw()
3131

3232
self.configure(borderwidth=5)
33+
self.title('IDLE Preferences')
3334
self.geometry("+%d+%d" % (parent.winfo_rootx()+20,
3435
parent.winfo_rooty()+30))
3536
#Theme Elements. Each theme element key is its display name.

Lib/multiprocessing/pool.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ def map_async(self, func, iterable, chunksize=None, callback=None):
208208
chunksize, extra = divmod(len(iterable), len(self._pool) * 4)
209209
if extra:
210210
chunksize += 1
211+
if len(iterable) == 0:
212+
chunksize = 0
211213

212214
task_batches = Pool._get_tasks(func, iterable, chunksize)
213215
result = MapResult(self._cache, chunksize, len(iterable), callback)

Lib/platform.py

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#
3333
# <see CVS and SVN checkin messages for history>
3434
#
35+
# 1.0.7 - added DEV_NULL
3536
# 1.0.6 - added linux_distribution()
3637
# 1.0.5 - fixed Java support to allow running the module on Jython
3738
# 1.0.4 - added IronPython support
@@ -89,7 +90,7 @@
8990

9091
__copyright__ = """
9192
Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:[email protected]
92-
Copyright (c) 2000-2008, eGenix.com Software GmbH; mailto:[email protected]
93+
Copyright (c) 2000-2009, eGenix.com Software GmbH; mailto:[email protected]
9394
9495
Permission to use, copy, modify, and distribute this software and its
9596
documentation for any purpose and without fee or royalty is hereby granted,
@@ -108,10 +109,25 @@
108109
109110
"""
110111

111-
__version__ = '1.0.6'
112+
__version__ = '1.0.7'
112113

113114
import sys, os, re
114115

116+
### Globals & Constants
117+
118+
# Determine the platform's /dev/null device
119+
try:
120+
DEV_NULL = os.devnull
121+
except AttributeError:
122+
# os.devnull was added in Python 2.4, so emulate it for earlier
123+
# Python versions
124+
if sys.platform in ('dos','win32','win16','os2'):
125+
# Use the old CP/M NUL as device name
126+
DEV_NULL = 'NUL'
127+
else:
128+
# Standard Unix uses /dev/null
129+
DEV_NULL = '/dev/null'
130+
115131
### Platform specific APIs
116132

117133
_libc_search = re.compile(r'(__libc_init)'
@@ -446,7 +462,16 @@ def _norm_version(version, build=''):
446462

447463
_ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) '
448464
'.*'
449-
'Version ([\d.]+))', re.ASCII)
465+
'\[.* ([\d.]+)\])')
466+
467+
# Examples of VER command output:
468+
#
469+
# Windows 2000: Microsoft Windows 2000 [Version 5.00.2195]
470+
# Windows XP: Microsoft Windows XP [Version 5.1.2600]
471+
# Windows Vista: Microsoft Windows [Version 6.0.6002]
472+
#
473+
# Note that the "Version" string gets localized on different
474+
# Windows versions.
450475

451476
def _syscmd_ver(system='', release='', version='',
452477

@@ -578,6 +603,7 @@ def win32_ver(release='',version='',csd='',ptype=''):
578603
version = '%i.%i.%i' % (maj,min,buildno & 0xFFFF)
579604
if csd[:13] == 'Service Pack ':
580605
csd = 'SP' + csd[13:]
606+
581607
if plat == VER_PLATFORM_WIN32_WINDOWS:
582608
regkey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion'
583609
# Try to guess the release name
@@ -592,6 +618,7 @@ def win32_ver(release='',version='',csd='',ptype=''):
592618
release = 'postMe'
593619
elif maj == 5:
594620
release = '2000'
621+
595622
elif plat == VER_PLATFORM_WIN32_NT:
596623
regkey = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion'
597624
if maj <= 4:
@@ -620,8 +647,12 @@ def win32_ver(release='',version='',csd='',ptype=''):
620647
release = 'Vista'
621648
else:
622649
release = '2008Server'
650+
#elif min == 1:
651+
# # Windows 7 release candidate uses version 6.1.7100
652+
# release = '7RC'
623653
else:
624654
release = 'post2008Server'
655+
625656
else:
626657
if not release:
627658
# E.g. Win3.1 with win32s
@@ -902,7 +933,7 @@ def _syscmd_uname(option,default=''):
902933
# XXX Others too ?
903934
return default
904935
try:
905-
f = os.popen('uname %s 2> /dev/null' % option)
936+
f = os.popen('uname %s 2> %s' % (option, DEV_NULL))
906937
except (AttributeError,os.error):
907938
return default
908939
output = f.read().strip()
@@ -927,7 +958,7 @@ def _syscmd_file(target,default=''):
927958
return default
928959
target = _follow_symlinks(target)
929960
try:
930-
f = os.popen('file "%s" 2> /dev/null' % target)
961+
f = os.popen('file "%s" 2> %s' % (target, DEV_NULL))
931962
except (AttributeError,os.error):
932963
return default
933964
output = f.read().strip()

Lib/test/test_kqueue.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,22 @@ def test_queue_event(self):
163163
server.close()
164164
serverSocket.close()
165165

166+
def testPair(self):
167+
kq = select.kqueue()
168+
a, b = socket.socketpair()
169+
170+
a.send(b'foo')
171+
event1 = select.kevent(a, select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE)
172+
event2 = select.kevent(b, select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE)
173+
r = kq.control([event1, event2], 1, 1)
174+
self.assertTrue(r)
175+
self.assertFalse(r[0].flags & select.KQ_EV_ERROR)
176+
self.assertEquals(b.recv(r[0].data), b'foo')
177+
178+
a.close()
179+
b.close()
180+
kq.close()
181+
166182
def test_main():
167183
support.run_unittest(TestKQueue)
168184

Lib/test/test_multiprocessing.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,12 @@ def test_map(self):
990990
self.assertEqual(pmap(sqr, list(range(100)), chunksize=20),
991991
list(map(sqr, list(range(100)))))
992992

993+
def test_map_chunksize(self):
994+
try:
995+
self.pool.map_async(sqr, [], chunksize=1).get(timeout=TIMEOUT1)
996+
except multiprocessing.TimeoutError:
997+
self.fail("pool.map_async with chunksize stalled on null list")
998+
993999
def test_async(self):
9941000
res = self.pool.apply_async(sqr, (7, TIMEOUT1,))
9951001
get = TimingWrapper(res.get)

Lib/test/test_unittest.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3303,15 +3303,6 @@ def removeTest():
33033303
self.assertEqual(runner.test, test)
33043304
self.assertEqual(program.verbosity, 2)
33053305

3306-
3307-
def testTestProgram_testRunnerArgument(self):
3308-
program = object.__new__(TestProgram)
3309-
program.parseArgs = lambda _: None
3310-
program.runTests = lambda: None
3311-
program.__init__(testRunner=None)
3312-
self.assertEqual(program.testRunner, unittest.TextTestRunner)
3313-
3314-
33153306
class FooBar(unittest.TestCase):
33163307
def testPass(self):
33173308
assert True

Lib/unittest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,8 +1684,6 @@ def __init__(self, module='__main__', defaultTest=None,
16841684
argv=None, testRunner=None,
16851685
testLoader=defaultTestLoader, exit=True,
16861686
verbosity=1):
1687-
if testRunner is None:
1688-
testRunner = TextTestRunner
16891687
if isinstance(module, str):
16901688
self.module = __import__(module)
16911689
for part in module.split('.')[1:]:
@@ -1775,6 +1773,8 @@ def _do_discovery(self, argv, Loader=TestLoader):
17751773
self.test = loader.discover(start_dir, pattern, top_level_dir)
17761774

17771775
def runTests(self):
1776+
if self.testRunner is None:
1777+
self.testRunner = TextTestRunner
17781778
if isinstance(self.testRunner, type):
17791779
try:
17801780
testRunner = self.testRunner(verbosity=self.verbosity)

0 commit comments

Comments
 (0)