Skip to content

Commit e9f305f

Browse files
committed
Merged revisions 63208-63209,63211-63212,63214-63217,63219-63224,63226-63227,63229-63232,63234-63235,63237-63239,63241,63243-63246,63250-63254,63256-63259,63261,63263-63264,63266-63267,63269-63270,63272-63273,63275-63276,63278,63280-63281,63283-63284,63286-63287,63289-63290,63292-63293,63295-63296,63298-63299,63301-63302,63304-63305,63307,63309-63314,63316-63322,63324-63325,63327-63335,63337-63338,63340-63342,63344-63346,63348 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r63208 | georg.brandl | 2008-05-13 15:04:54 -0400 (Tue, 13 May 2008) | 2 lines python#2831: add start argument to enumerate(). Patch by Scott Dial and me. ........ r63209 | marc-andre.lemburg | 2008-05-13 15:10:45 -0400 (Tue, 13 May 2008) | 3 lines Remove leftovers from reverted setuptools checkin (they were added in r45525). ........ r63211 | georg.brandl | 2008-05-13 17:32:03 -0400 (Tue, 13 May 2008) | 2 lines Fix a refleak in the _warnings module. ........ r63212 | andrew.kuchling | 2008-05-13 20:46:41 -0400 (Tue, 13 May 2008) | 1 line List all the removes and renamed modules ........ r63214 | brett.cannon | 2008-05-13 21:09:40 -0400 (Tue, 13 May 2008) | 2 lines Rewrap some lines in test_py3kwarn. ........ r63219 | georg.brandl | 2008-05-14 02:34:15 -0400 (Wed, 14 May 2008) | 2 lines Add NEWS entry for python#2831. ........ r63220 | neal.norwitz | 2008-05-14 02:47:56 -0400 (Wed, 14 May 2008) | 3 lines Fix "refleak" by restoring the tearDown method removed by accident (AFAICT) in r62788. ........ r63221 | georg.brandl | 2008-05-14 03:18:22 -0400 (Wed, 14 May 2008) | 2 lines Fix another "refleak" by clearing the filters after test. ........ r63222 | neal.norwitz | 2008-05-14 03:21:42 -0400 (Wed, 14 May 2008) | 5 lines Install the json package and tests as well as the lib2to3 tests so the tests work when run from an install directory. They are currently skipped on the daily runs (not from the buildbots) for checking refleaks, etc. ........ r63256 | andrew.kuchling | 2008-05-14 21:10:24 -0400 (Wed, 14 May 2008) | 1 line Note some removals and a rename ........ r63311 | brett.cannon | 2008-05-15 00:36:53 -0400 (Thu, 15 May 2008) | 2 lines Add a snippet for the deprecation directive for docs. ........ r63313 | gregory.p.smith | 2008-05-15 00:56:18 -0400 (Thu, 15 May 2008) | 5 lines disable the crashing test. I will also file a bug. This crash does not appear to be a new bug, its just that the test coverage went up recently exposing it. (I verified that by testing this test code on an older Modules/_bsddb.c) ........ r63320 | georg.brandl | 2008-05-15 11:08:32 -0400 (Thu, 15 May 2008) | 2 lines python#2863: add gen.__name__ and add this name to generator repr(). ........ r63324 | andrew.kuchling | 2008-05-15 16:07:39 -0400 (Thu, 15 May 2008) | 1 line Import class from distutils.cmd, not .core, to avoid circular import ........ r63327 | alexandre.vassalotti | 2008-05-15 16:31:42 -0400 (Thu, 15 May 2008) | 2 lines Fixed typo in a doctest of test_genexps. ........ r63332 | benjamin.peterson | 2008-05-15 18:34:33 -0400 (Thu, 15 May 2008) | 2 lines add Mac modules to the list of deprecated ones ........ r63333 | benjamin.peterson | 2008-05-15 18:41:16 -0400 (Thu, 15 May 2008) | 2 lines fix typos in whatsnew ........ r63348 | benjamin.peterson | 2008-05-15 22:24:49 -0400 (Thu, 15 May 2008) | 2 lines make test_platform a bit more assertive (We'll see what the buildbots say.) ........
1 parent 7203d0f commit e9f305f

18 files changed

Lines changed: 257 additions & 47 deletions

File tree

‎Doc/library/functions.rst‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,15 @@ are always available. They are listed here in alphabetical order.
325325
< abs(b)``.
326326

327327

328-
.. function:: enumerate(sequence)
328+
.. function:: enumerate(sequence[, start=0])
329329

330330
Return an enumerate object. *sequence* must be a sequence, an
331331
:term:`iterator`, or some other object which supports iteration. The
332332
:meth:`__next__` method of the iterator returned by :func:`enumerate` returns a
333-
tuple containing a count (from zero) and the corresponding value obtained
334-
from iterating over *iterable*. :func:`enumerate` is useful for obtaining an
335-
indexed series: ``(0, seq[0])``, ``(1, seq[1])``, ``(2, seq[2])``, .... For
336-
example:
333+
tuple containing a count (from *start* which defaults to 0) and the
334+
corresponding value obtained from iterating over *iterable*.
335+
:func:`enumerate` is useful for obtaining an indexed series: ``(0, seq[0])``,
336+
``(1, seq[1])``, ``(2, seq[2])``, .... For example:
337337

338338
>>> for i, season in enumerate(['Spring', 'Summer', 'Fall', 'Winter')]:
339339
... print(i, season)

‎Doc/whatsnew/2.6.rst‎

Lines changed: 80 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,13 +1466,86 @@ New, Improved, and Deprecated Modules
14661466
As usual, Python's standard library received a number of enhancements and bug
14671467
fixes. Here's a partial list of the most notable changes, sorted alphabetically
14681468
by module name. Consult the :file:`Misc/NEWS` file in the source tree for a more
1469-
complete list of changes, or look through the CVS logs for all the details.
1470-
1471-
* (3.0-warning mode) The :mod:`audiodev` module is being deprecated,
1472-
and has been removed from Python 3.0, so importing it now triggers a
1473-
warning. The module hasn't been maintained for several versions,
1474-
and is written against an outdated sound interface for SunOS and
1475-
IRIX.
1469+
complete list of changes, or look through the Subversion logs for all the
1470+
details.
1471+
1472+
* (3.0-warning mode) Python 3.0 will feature a reorganized standard
1473+
library; many outdated modules are being dropped,
1474+
and some modules are being renamed or moved into packages.
1475+
Python 2.6 running in 3.0-warning mode will warn about these modules
1476+
when they are imported.
1477+
The list of deprecated modules is:
1478+
:mod:`_builtinSuites`,
1479+
:mod:`aepack`,
1480+
:mod:`aetools`,
1481+
:mod:`aetypes`,
1482+
:mod:`applesingle`,
1483+
:mod:`appletrawmain`,
1484+
:mod:`appletrunner`,
1485+
:mod:`argvemulator`,
1486+
:mod:`Audio_mac`,
1487+
:mod:`audiodev`,
1488+
:mod:`autoGIL`,
1489+
:mod:`bgenlocations`,
1490+
:mod:`buildtools`,
1491+
:mod:`bundlebuilder`,
1492+
:mod:`Canvas`,
1493+
:mod:`Carbon`,
1494+
:mod:`cfmfile`,
1495+
:mod:`CodeWarrior`,
1496+
:mod:`ColorPicker`,
1497+
:mod:`compiler`,
1498+
:mod:`cd`,
1499+
:mod:`cddb`,
1500+
:mod:`cdplayer`,
1501+
:mod:`CL` and :mod:`cl`,
1502+
:mod:`cd`,
1503+
:mod:`cd`,
1504+
:mod:`dircache`,
1505+
:mod:`dl`,
1506+
:mod:`EasyDialogs`,
1507+
:mod:`Explorer`,
1508+
:mod:`Finder`,
1509+
:mod:`FrameWork`,
1510+
:mod:`findertools`,
1511+
:mod:`fpformat`,
1512+
:mod:`gensuitemodule`,
1513+
:mod:`ic`,
1514+
:mod:`icglue`,
1515+
:mod:`icopen`,
1516+
:mod:`ihooks`,
1517+
:mod:`imageop`,
1518+
:mod:`linuxaudiodev`,
1519+
:mod:`macerrors`,
1520+
:mod:`MacOS`,
1521+
:mod:`macostools`,
1522+
:mod:`macresource`,
1523+
:mod:`mhlib`,
1524+
:mod:`MiniAEFrame`,
1525+
:mod:`multifile`,
1526+
:mod:`Nav`,
1527+
:mod:`Netscape`,
1528+
:mod:`new`,
1529+
:mod:`OSATerminology`,
1530+
:mod:`pimp`,
1531+
:mod:`PixMapWrapper`,
1532+
:mod:`popen2`,
1533+
:mod:`pure`,
1534+
:mod:`StdSuites`,
1535+
:mod:`sv`,
1536+
:mod:`SystemEvents`,
1537+
:mod:`Terminal`,
1538+
:mod:`terminalcommand`,
1539+
:mod:`test.testall`,
1540+
:mod:`toaiff`,
1541+
:mod:`videoreader`.
1542+
1543+
The modules that have been renamed are:
1544+
1545+
* :mod:`ConfigParser` has become :mod:`configparser`.
1546+
* :mod:`copy_reg` has become :mod:`copyreg`.
1547+
* :mod:`SocketServer` has become :mod:`socketserver`.
1548+
* :mod:`Queue` has become :mod:`queue`.
14761549

14771550
* The :mod:`bsddb.dbshelve` module now uses the highest pickling protocol
14781551
available, instead of restricting itself to protocol 1.
@@ -1755,9 +1828,6 @@ complete list of changes, or look through the CVS logs for all the details.
17551828
the forward search.
17561829
(Contributed by John Lenton.)
17571830

1758-
* (3.0-warning mode) The :mod:`new` module has been removed from
1759-
Python 3.0. Importing it therefore triggers a warning message.
1760-
17611831
* The :mod:`operator` module gained a
17621832
:func:`methodcaller` function that takes a name and an optional
17631833
set of arguments, returning a callable that will call

‎Lib/bsddb/test/test_lock.py‎

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,55 @@ def test02_threaded(self):
9494
for t in threads:
9595
t.join()
9696

97-
def test03_set_timeout(self):
98-
# test that the set_timeout call works
99-
if hasattr(self.env, 'set_timeout'):
100-
self.env.set_timeout(0, db.DB_SET_LOCK_TIMEOUT)
101-
self.env.set_timeout(0, db.DB_SET_TXN_TIMEOUT)
102-
self.env.set_timeout(123456, db.DB_SET_LOCK_TIMEOUT)
103-
self.env.set_timeout(7890123, db.DB_SET_TXN_TIMEOUT)
104-
105-
def theThread(self, sleepTime, lockType):
97+
def _DISABLED_test03_lock_timeout(self):
98+
# Disabled as this test crashes the python interpreter built in
99+
# debug mode with:
100+
# Fatal Python error: UNREF invalid object
101+
# the error occurs as marked below.
102+
self.env.set_timeout(0, db.DB_SET_LOCK_TIMEOUT)
103+
self.env.set_timeout(0, db.DB_SET_TXN_TIMEOUT)
104+
self.env.set_timeout(123456, db.DB_SET_LOCK_TIMEOUT)
105+
self.env.set_timeout(7890123, db.DB_SET_TXN_TIMEOUT)
106+
107+
def deadlock_detection() :
108+
while not deadlock_detection.end :
109+
deadlock_detection.count = \
110+
self.env.lock_detect(db.DB_LOCK_EXPIRE)
111+
if deadlock_detection.count :
112+
while not deadlock_detection.end :
113+
pass
114+
break
115+
time.sleep(0.01)
116+
117+
deadlock_detection.end=False
118+
deadlock_detection.count=0
119+
t=Thread(target=deadlock_detection)
120+
t.setDaemon(True)
121+
t.start()
122+
self.env.set_timeout(100000, db.DB_SET_LOCK_TIMEOUT)
123+
anID = self.env.lock_id()
124+
anID2 = self.env.lock_id()
125+
self.assertNotEqual(anID, anID2)
126+
lock = self.env.lock_get(anID, "shared lock", db.DB_LOCK_WRITE)
127+
start_time=time.time()
128+
# FIXME: I see the UNREF crash as the interpreter trys to exit
129+
# from this call to lock_get.
130+
self.assertRaises(db.DBLockNotGrantedError,
131+
self.env.lock_get,anID2, "shared lock", db.DB_LOCK_READ)
132+
end_time=time.time()
133+
deadlock_detection.end=True
134+
self.assertTrue((end_time-start_time) >= 0.1)
135+
self.env.lock_put(lock)
136+
t.join()
137+
138+
if db.version() >= (4,0):
139+
self.env.lock_id_free(anID)
140+
self.env.lock_id_free(anID2)
141+
142+
if db.version() >= (4,6):
143+
self.assertTrue(deadlock_detection.count>0)
144+
145+
def theThread(self, lockType):
106146
name = currentThread().getName()
107147
if lockType == db.DB_LOCK_WRITE:
108148
lt = "write"

‎Lib/distutils/config.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import sys
88
from configparser import ConfigParser
99

10-
from distutils.core import Command
10+
from distutils.cmd import Command
1111

1212
DEFAULT_PYPIRC = """\
1313
[pypirc]

‎Lib/test/test_enumerate.py‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ def test_exception_propagation(self):
100100
def test_argumentcheck(self):
101101
self.assertRaises(TypeError, self.enum) # no arguments
102102
self.assertRaises(TypeError, self.enum, 1) # wrong type (not iterable)
103-
self.assertRaises(TypeError, self.enum, 'abc', 2) # too many arguments
103+
self.assertRaises(TypeError, self.enum, 'abc', 'a') # wrong type
104+
self.assertRaises(TypeError, self.enum, 'abc', 2, 3) # too many arguments
104105

105106
def test_tuple_reuse(self):
106107
# Tests an implementation detail where tuple is reused
@@ -196,6 +197,19 @@ def f():
196197
self.assertEqual(rc, sys.getrefcount(r))
197198

198199

200+
class TestStart(EnumerateTestCase):
201+
202+
enum = lambda i: enumerate(i, start=11)
203+
seq, res = 'abc', [(1, 'a'), (2, 'b'), (3, 'c')]
204+
205+
206+
class TestLongStart(EnumerateTestCase):
207+
208+
enum = lambda i: enumerate(i, start=sys.maxsize+1)
209+
seq, res = 'abc', [(sys.maxsize+1,'a'), (sys.maxsize+2,'b'),
210+
(sys.maxsize+3,'c')]
211+
212+
199213
def test_main(verbose=None):
200214
testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig,
201215
TestReversed)

‎Lib/test/test_generators.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,17 @@
917917
>>> g.gi_code is f.__code__
918918
True
919919
920+
921+
Test the __name__ attribute and the repr()
922+
923+
>>> def f():
924+
... yield 5
925+
...
926+
>>> g = f()
927+
>>> g.__name__
928+
'f'
929+
>>> repr(g) # doctest: +ELLIPSIS
930+
'<f generator object at ...>'
920931
"""
921932

922933
# conjoin is a simple backtracking generator, named in honor of Icon's

‎Lib/test/test_genexps.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
Verify that parenthesis are required when used as a keyword argument value
9393
9494
>>> dict(a = (i for i in range(10))) #doctest: +ELLIPSIS
95-
{'a': <generator object at ...>}
95+
{'a': <<genexpr> generator object at ...>}
9696
9797
Verify early binding for the outermost for-expression
9898

‎Lib/test/test_platform.py‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import sys
12
import unittest
2-
from test import test_support
33
import platform
44

5+
from test import test_support
6+
57
class PlatformTest(unittest.TestCase):
68
def test_architecture(self):
79
res = platform.architecture()
@@ -49,26 +51,35 @@ def test_system_alias(self):
4951

5052
def test_uname(self):
5153
res = platform.uname()
54+
self.assert_(any(res))
5255

5356
def test_java_ver(self):
5457
res = platform.java_ver()
58+
if sys.platform == 'java':
59+
self.assert_(all(res))
5560

5661
def test_win32_ver(self):
5762
res = platform.win32_ver()
5863

5964
def test_mac_ver(self):
6065
res = platform.mac_ver()
66+
try:
67+
import gestalt
68+
except ImportError: pass
69+
else:
70+
if sys.platform == 'darwin':
71+
self.assert_(all(res))
6172

6273
def test_dist(self):
6374
res = platform.dist()
6475

6576
def test_libc_ver(self):
66-
from sys import executable
6777
import os
68-
if os.path.isdir(executable) and os.path.exists(executable+'.exe'):
78+
if os.path.isdir(sys.executable) and \
79+
os.path.exists(sys.executable+'.exe'):
6980
# Cygwin horror
7081
executable = executable + '.exe'
71-
res = platform.libc_ver(executable)
82+
res = platform.libc_ver(sys.executable)
7283

7384
def test_main():
7485
test_support.run_unittest(

‎Lib/test/test_site.py‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def setUp(self):
3636
"""Save a copy of sys.path"""
3737
self.sys_path = sys.path[:]
3838

39-
39+
def tearDown(self):
4040
"""Restore sys.path"""
4141
sys.path = self.sys_path
4242

@@ -256,13 +256,8 @@ def test_sitecustomize_executed(self):
256256
else:
257257
self.fail("sitecustomize not imported automatically")
258258

259-
260-
261-
262259
def test_main():
263260
run_unittest(HelperFunctionsTests, ImportSideEffectTests)
264261

265-
266-
267262
if __name__ == "__main__":
268263
test_main()

‎Lib/test/test_warnings.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ def test_showwarning_not_callable(self):
396396
self.assertRaises(TypeError, self.module.warn, "Warning!")
397397
finally:
398398
self.module.showwarning = old_showwarning
399+
self.module.resetwarnings()
399400

400401
def test_show_warning_output(self):
401402
# With showarning() missing, make sure that output is okay.

0 commit comments

Comments
 (0)