From wyjdllcwmojm at yahoo.com.cn Wed Jul 2 21:31:03 2008 From: wyjdllcwmojm at yahoo.com.cn (=?big5?q?=AA=EC=ACK=B9=EA=AC=EF=AA=BA=AA=F8=AA=A9=C1=A1T?=) Date: Thu, 3 Jul 2008 03:31:03 +0800 Subject: [Python-checkins] =?big5?b?wHWs/KyjoUWko6vkxLOquru0rFis/LdQrHY=?= =?big5?b?uMsuODAwtNqkQKS4t2280A==?= Message-ID: <762824.17778.bm@omp222.mail.ukl.yahoo.com> An HTML attachment was scrubbed... URL: From wjlegimllwzm at yahoo.com.cn Thu Jul 3 23:28:00 2008 From: wjlegimllwzm at yahoo.com.cn (=?big5?q?_=AD=D3=A9=CA=AC=A3=A4=A6=B9=E7=B5u=B8=C8?=) Date: Fri, 4 Jul 2008 05:28:00 +0800 Subject: [Python-checkins] =?big5?b?qfqsULTarHa4yy6nS7ZPsGW1ualwfn690LZp?= =?big5?b?pEqkRrjRISE5MDC02qRruMul/sBdpECkuLrGqGe80CE=?= Message-ID: <428853.10426.bm@omp401.mail.mud.yahoo.com> An HTML attachment was scrubbed... URL: From python-checkins at python.org Tue Jul 1 00:42:40 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 1 Jul 2008 00:42:40 +0200 (CEST) Subject: [Python-checkins] r64601 - in python/trunk: Lib/test/test_threading_local.py Misc/NEWS Modules/threadmodule.c Message-ID: <20080630224240.D5B901E4009@bag.python.org> Author: amaury.forgeotdarc Date: Tue Jul 1 00:42:40 2008 New Revision: 64601 Log: #Issue3088 in-progress: Race condition with instances of classes derived from threading.local: When a thread touches such an object for the first time, a new thread-local __dict__ is created, and the __init__ method is run. But a thread switch can occur here; if the other thread touches the same object, it installs another __dict__; when the first thread resumes, it updates the dictionary of the second... This is the deep cause of the failures in test_multiprocessing involving "managers" objects. Also a 2.5 backport candidate. Modified: python/trunk/Lib/test/test_threading_local.py python/trunk/Misc/NEWS python/trunk/Modules/threadmodule.c Modified: python/trunk/Lib/test/test_threading_local.py ============================================================================== --- python/trunk/Lib/test/test_threading_local.py (original) +++ python/trunk/Lib/test/test_threading_local.py Tue Jul 1 00:42:40 2008 @@ -42,6 +42,32 @@ deadlist = [weak for weak in weaklist if weak() is None] self.assert_(len(deadlist) in (n-1, n), (n, len(deadlist))) + def test_derived(self): + # Issue 3088: if there is a threads switch inside the __init__ + # of a threading.local derived class, the per-thread dictionary + # is created but not correctly set on the object. + # The first member set may be bogus. + import time + class Local(threading.local): + def __init__(self): + time.sleep(0.01) + local = Local() + + def f(i): + local.x = i + # Simply check that the variable is correctly set + self.assertEqual(local.x, i) + + threads= [] + for i in range(10): + t = threading.Thread(target=f, args=(i,)) + t.start() + threads.append(t) + + for t in threads: + t.join() + + def test_main(): suite = unittest.TestSuite() suite.addTest(DocTestSuite('_threading_local')) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jul 1 00:42:40 2008 @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #3088: Corrected a race condition in classes derived from + threading.local: the first member set by a thread could be saved in + another thread's dictionary. + - Issue #3004: Minor change to slice.indices(): the start and stop arguments are now treated identically, making the behaviour easier to describe and understand. For example, slice(None, -10, Modified: python/trunk/Modules/threadmodule.c ============================================================================== --- python/trunk/Modules/threadmodule.c (original) +++ python/trunk/Modules/threadmodule.c Tue Jul 1 00:42:40 2008 @@ -293,7 +293,10 @@ } } - else if (self->dict != ldict) { + + /* The call to tp_init above may have caused another thread to run. + Install our ldict again. */ + if (self->dict != ldict) { Py_CLEAR(self->dict); Py_INCREF(ldict); self->dict = ldict; From buildbot at python.org Tue Jul 1 01:47:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 30 Jun 2008 23:47:07 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080630234708.05CD41E400A@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/113 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jul 1 02:05:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 00:05:53 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080701000554.D81101E401B@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1196 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Tue Jul 1 02:44:45 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 00:44:45 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080701004445.481F91E4002@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/561 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_xmlrpc_net make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jul 1 02:54:12 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 1 Jul 2008 02:54:12 +0200 (CEST) Subject: [Python-checkins] r64603 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080701005412.CA1791E4002@bag.python.org> Author: guilherme.polo Date: Tue Jul 1 02:54:12 2008 New Revision: 64603 Log: Updated/Fixed AutoScroll class (nothing that affects this sample app tho). Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Tue Jul 1 02:54:12 2008 @@ -149,20 +149,19 @@ self.configure(yscrollcommand=self._autoscroll(vsb), xscrollcommand=self._autoscroll(hsb)) - self.grid(column=0, row=0, sticky='nsew', in_=master) - vsb.grid(column=1, row=0, sticky='ns', in_=master) - hsb.grid(column=0, row=1, sticky='ew', in_=master) + self.grid(column=0, row=0, sticky='nsew') + vsb.grid(column=1, row=0, sticky='ns') + hsb.grid(column=0, row=1, sticky='ew') master.grid_columnconfigure(0, weight=1) master.grid_rowconfigure(0, weight=1) # Copy geometry methods of master -- hack! (took from ScrolledText.py) - methods = Tkinter.Pack.__dict__.keys() - methods = methods + Tkinter.Grid.__dict__.keys() + methods = Tkinter.Pack.__dict__.keys() + Tkinter.Grid.__dict__.keys() - for m in methods: - if m[0] != '_' and m != 'config' and m != 'configure': - setattr(self, m, getattr(master, m)) + for meth in methods: + if meth[0] != '_' and meth not in ('config', 'configure'): + setattr(self, meth, getattr(master, meth)) @staticmethod def _autoscroll(sbar): @@ -179,6 +178,9 @@ return wrapped + def __str__(self): + return str(self.master) + def _create_container(func): """Creates a ttk Frame with a given master, and use this new frame to place the scrollbars and the widget.""" @@ -644,7 +646,7 @@ file_menu.add_command(label="Exit", underline=1, accelerator="Ctrl-X", command=self.master.destroy) - menu.add('cascade', menu=file_menu, label="File", underline=0) + menu.add_cascade(menu=file_menu, label="File", underline=0) self.master.bind('', 'exit') def __setup_widgets(self): From buildbot at python.org Tue Jul 1 03:19:37 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 01:19:37 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080701011937.A01FE1E4002@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1167 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From wiejtuurmndp at yahoo.com.cn Sat Jul 5 04:27:29 2008 From: wiejtuurmndp at yahoo.com.cn (=?big5?q?=AA=EC=ACK=B9=EA=AC=EF=AA=BA=AA=F8=AA=A9=C1=A1T?=) Date: Sat, 5 Jul 2008 10:27:29 +0800 Subject: [Python-checkins] =?big5?b?qfqsULTarHa4yy6lda1uMTIwpLh+vdC2aaRK?= =?big5?b?pEa40SEh?= Message-ID: <28916.47014.bm@omp401.mail.mud.yahoo.com> An HTML attachment was scrubbed... URL: From python-checkins at python.org Tue Jul 1 13:39:38 2008 From: python-checkins at python.org (thomas.lee) Date: Tue, 1 Jul 2008 13:39:38 +0200 (CEST) Subject: [Python-checkins] r64611 - python/branches/tlee-ast-optimize/Python/optimize.c Message-ID: <20080701113938.9EA961E4002@bag.python.org> Author: thomas.lee Date: Tue Jul 1 13:39:38 2008 New Revision: 64611 Log: Update the build_tuple_of_constants docs. Change PyTuple_SetItem call to PyTuple_SET_ITEM. Modified: python/branches/tlee-ast-optimize/Python/optimize.c Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Tue Jul 1 13:39:38 2008 @@ -100,6 +100,11 @@ /** * Build a tuple of constants from an expression sequence. + * A precondition is that the given seq returns a true + * value for _is_sequence_of_constants. + * + * XXX: for some reason this is transforming tuples + * of longs to tuples of integers. Not sure why. */ static PyObject* _build_tuple_of_constants(asdl_seq* seq, PyArena* arena) @@ -118,11 +123,10 @@ } for (i = 0; i < length; i++) { - PyObject* value; - expr_ty expr = (expr_ty)asdl_seq_GET(seq, i); - value = _expr_constant_value(expr); + expr_ty expr = asdl_seq_GET(seq, i); + PyObject* value = _expr_constant_value(expr); Py_INCREF(value); - PyTuple_SetItem(result, i, value); + PyTuple_SET_ITEM(result, i, value); } return result; From python-checkins at python.org Tue Jul 1 14:28:02 2008 From: python-checkins at python.org (thomas.lee) Date: Tue, 1 Jul 2008 14:28:02 +0200 (CEST) Subject: [Python-checkins] r64612 - in python/branches/tlee-ast-optimize: Doc/Makefile Doc/library/collections.rst Doc/library/fractions.rst Doc/library/multiprocessing.rst Doc/library/socketserver.rst Doc/library/ssl.rst Doc/reference/compound_stmts.rst Doc/whatsnew/2.6.rst Lib/bsddb/test/test_replication.py Lib/fractions.py Lib/logging/config.py Lib/multiprocessing/dummy Lib/multiprocessing/managers.py Lib/ssl.py Lib/test/test_audioop.py Lib/test/test_cpickle.py Lib/test/test_fractions.py Lib/test/test_ssl.py Lib/test/test_sys.py Lib/test/test_threading_local.py Lib/test/test_warnings.py Lib/test/wrongcert.pem Lib/warnings.py Misc/ACKS Misc/NEWS Modules/_ssl.c Modules/cPickle.c Modules/threadmodule.c Objects/dictobject.c PCbuild/_bsddb.vcproj PCbuild/_bsddb44.vcproj PCbuild/pcbuild.sln PCbuild/pyproject.vsprops PCbuild/sqlite3.vcproj Python/_warnings.c Tools/buildbot/external-common.bat Tools/msi/msi.py configure configure.in pyconfig.h.in setup.py Message-ID: <20080701122802.E79161E4066@bag.python.org> Author: thomas.lee Date: Tue Jul 1 14:28:00 2008 New Revision: 64612 Log: Merged revisions 64532-64611 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ................ r64533 | robert.schuppenies | 2008-06-27 01:20:35 +1000 (Fri, 27 Jun 2008) | 3 lines Corrected inconsistencies in sizeof tests and addressed issue pointed out by Jean Brouwers. ................ r64535 | georg.brandl | 2008-06-27 04:55:37 +1000 (Fri, 27 Jun 2008) | 2 lines Add a version tag for shutdown(). ................ r64544 | georg.brandl | 2008-06-27 07:12:55 +1000 (Fri, 27 Jun 2008) | 2 lines Use newer versions of externals. ................ r64545 | benjamin.peterson | 2008-06-27 07:23:30 +1000 (Fri, 27 Jun 2008) | 1 line add a htmlview directive ................ r64546 | benjamin.peterson | 2008-06-27 07:24:35 +1000 (Fri, 27 Jun 2008) | 1 line use the new API ................ r64547 | benjamin.peterson | 2008-06-27 07:29:19 +1000 (Fri, 27 Jun 2008) | 1 line fix isSet in _exposed ................ r64549 | brett.cannon | 2008-06-27 10:31:13 +1000 (Fri, 27 Jun 2008) | 7 lines warnings.warn_explicit() did not have the proper TypeErrors in place to prevent bus errors or SystemError being raised. As a side effect of fixing this, a bad DECREF that could be triggered when 'message' and 'category' were both None was fixed. Closes issue 3211. Thanks JP Calderone for the bug report. ................ r64550 | brett.cannon | 2008-06-27 10:32:16 +1000 (Fri, 27 Jun 2008) | 2 lines Ignore .pyc and .pyo files. ................ r64554 | trent.nelson | 2008-06-27 12:24:49 +1000 (Fri, 27 Jun 2008) | 3 lines Initialized merge tracking via "svnmerge" with revisions "1-64347" from svn+ssh://pythondev at svn.python.org/python/branches/tnelson-trunk-bsddb-47-upgrade ................ r64555 | trent.nelson | 2008-06-27 12:30:34 +1000 (Fri, 27 Jun 2008) | 13 lines Merged revisions 64368-64369 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/tnelson-trunk-bsddb-47-upgrade ........ r64368 | trent.nelson | 2008-06-17 23:13:44 -0500 (Tue, 17 Jun 2008) | 1 line Initial commit of work pertaining to switching the Windows build from Berkeley DB 4.4.20 to 4.7.25. Note that I've deprecated the standalone '_bsddb44.vcproj' in lieu of adding the sources in a separate folder to the _bsddb project. This was a conscious decision and actually makes everything far more easier to manage. With this approach, entire test suite passed straight off the bat. Well, almost -- the timeout in bsddb/test/test_replication.py needed bumping up a little -- 2 seconds was too short. 10 seconds seems to be fine for me, but I'll make sure Jesus verifies. More documentation to come once I've been able to test out this approach on the buildbots (hence keeping the changes in a separate branch for now). ........ r64369 | trent.nelson | 2008-06-17 23:19:12 -0500 (Tue, 17 Jun 2008) | 1 line Bump Berkeley DB version from 4.4.20 to 4.7.25. ........ ................ r64557 | mark.dickinson | 2008-06-27 20:11:52 +1000 (Fri, 27 Jun 2008) | 3 lines Remove trailing 'L's from numerator and denominator in the repr() of a Fraction instance. ................ r64558 | mark.dickinson | 2008-06-27 21:03:21 +1000 (Fri, 27 Jun 2008) | 2 lines Add Jean Brouwers for his work on math.sum ................ r64561 | mark.dickinson | 2008-06-28 02:49:27 +1000 (Sat, 28 Jun 2008) | 2 lines Issue #3197: rework documentation for fractions module. ................ r64565 | raymond.hettinger | 2008-06-28 07:34:24 +1000 (Sat, 28 Jun 2008) | 1 line Fix whitespace in example code. ................ r64567 | mark.dickinson | 2008-06-28 08:20:14 +1000 (Sat, 28 Jun 2008) | 3 lines Fix typo in configure.in, and propagate configure.in changes from r64002 to configure and pyconfig.h.in. ................ r64568 | benjamin.peterson | 2008-06-28 09:22:06 +1000 (Sat, 28 Jun 2008) | 1 line edit multiprocessing docs ................ r64570 | hyeshik.chang | 2008-06-28 11:04:31 +1000 (Sat, 28 Jun 2008) | 8 lines Give information for compililation of _multiprocessing.SemLock on FreeBSD: FreeBSD's P1003.1b semaphore support is highly experimental and it's disabled by default. Even if a user loads the experimental kernel module manually, _multiprocessing doesn't work correctly due to several known incompatibilities around sem_unlink and sem_getvalue, yet. ................ r64572 | benjamin.peterson | 2008-06-28 23:18:14 +1000 (Sat, 28 Jun 2008) | 1 line fix typo ................ r64577 | raymond.hettinger | 2008-06-29 08:16:53 +1000 (Sun, 29 Jun 2008) | 1 line Issue 3230: Do not the set specific size macro. ................ r64578 | bill.janssen | 2008-06-29 08:19:33 +1000 (Sun, 29 Jun 2008) | 1 line various SSL fixes; issues 1251, 3162, 3212 ................ r64580 | bill.janssen | 2008-06-29 09:00:39 +1000 (Sun, 29 Jun 2008) | 1 line make sure we close the active channels when eof is received on them ................ r64582 | benjamin.peterson | 2008-06-29 09:06:05 +1000 (Sun, 29 Jun 2008) | 2 lines convert test_audioop to unittest. Thanks to Giampaolo Rodola. ................ r64583 | benjamin.peterson | 2008-06-29 09:06:49 +1000 (Sun, 29 Jun 2008) | 1 line rewrap ................ r64585 | benjamin.peterson | 2008-06-29 09:35:31 +1000 (Sun, 29 Jun 2008) | 1 line fix typo ................ r64590 | benjamin.peterson | 2008-06-29 23:43:07 +1000 (Sun, 29 Jun 2008) | 1 line reinstate the ending backtick. thanks Nick :) ................ r64592 | vinay.sajip | 2008-06-30 07:25:28 +1000 (Mon, 30 Jun 2008) | 2 lines Removed out-of-date comment in _install_handlers and used issubclass in place of equality comparison of classes. ................ r64593 | vinay.sajip | 2008-06-30 07:27:15 +1000 (Mon, 30 Jun 2008) | 1 line Updated to reflect change in logging.config to remove out-of-date comment in _install_handlers and the use of issubclass in place of equality comparison of classes. ................ r64595 | facundo.batista | 2008-06-30 11:10:55 +1000 (Mon, 30 Jun 2008) | 3 lines Fix #2702, with a correct accounting of recursion. ................ r64597 | martin.v.loewis | 2008-06-30 16:57:39 +1000 (Mon, 30 Jun 2008) | 1 line Issue #3215: Build sqlite3 as sqlite3.dll, not sqlite3.pyd ................ r64598 | martin.v.loewis | 2008-06-30 17:01:09 +1000 (Mon, 30 Jun 2008) | 1 line Add _multiprocessing module. ................ r64601 | amaury.forgeotdarc | 2008-07-01 08:42:40 +1000 (Tue, 01 Jul 2008) | 11 lines #Issue3088 in-progress: Race condition with instances of classes derived from threading.local: When a thread touches such an object for the first time, a new thread-local __dict__ is created, and the __init__ method is run. But a thread switch can occur here; if the other thread touches the same object, it installs another __dict__; when the first thread resumes, it updates the dictionary of the second... This is the deep cause of the failures in test_multiprocessing involving "managers" objects. Also a 2.5 backport candidate. ................ Added: python/branches/tlee-ast-optimize/Lib/test/wrongcert.pem - copied unchanged from r64601, /python/trunk/Lib/test/wrongcert.pem Removed: python/branches/tlee-ast-optimize/PCbuild/_bsddb44.vcproj Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/Makefile python/branches/tlee-ast-optimize/Doc/library/collections.rst python/branches/tlee-ast-optimize/Doc/library/fractions.rst python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst python/branches/tlee-ast-optimize/Doc/library/socketserver.rst python/branches/tlee-ast-optimize/Doc/library/ssl.rst python/branches/tlee-ast-optimize/Doc/reference/compound_stmts.rst python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst python/branches/tlee-ast-optimize/Lib/bsddb/test/test_replication.py python/branches/tlee-ast-optimize/Lib/fractions.py python/branches/tlee-ast-optimize/Lib/logging/config.py python/branches/tlee-ast-optimize/Lib/multiprocessing/dummy/ (props changed) python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py python/branches/tlee-ast-optimize/Lib/ssl.py python/branches/tlee-ast-optimize/Lib/test/test_audioop.py python/branches/tlee-ast-optimize/Lib/test/test_cpickle.py python/branches/tlee-ast-optimize/Lib/test/test_fractions.py python/branches/tlee-ast-optimize/Lib/test/test_ssl.py python/branches/tlee-ast-optimize/Lib/test/test_sys.py python/branches/tlee-ast-optimize/Lib/test/test_threading_local.py python/branches/tlee-ast-optimize/Lib/test/test_warnings.py python/branches/tlee-ast-optimize/Lib/warnings.py python/branches/tlee-ast-optimize/Misc/ACKS python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/_ssl.c python/branches/tlee-ast-optimize/Modules/cPickle.c python/branches/tlee-ast-optimize/Modules/threadmodule.c python/branches/tlee-ast-optimize/Objects/dictobject.c python/branches/tlee-ast-optimize/PCbuild/_bsddb.vcproj python/branches/tlee-ast-optimize/PCbuild/pcbuild.sln python/branches/tlee-ast-optimize/PCbuild/pyproject.vsprops python/branches/tlee-ast-optimize/PCbuild/sqlite3.vcproj python/branches/tlee-ast-optimize/Python/_warnings.c python/branches/tlee-ast-optimize/Tools/buildbot/external-common.bat python/branches/tlee-ast-optimize/Tools/msi/msi.py python/branches/tlee-ast-optimize/configure python/branches/tlee-ast-optimize/configure.in python/branches/tlee-ast-optimize/pyconfig.h.in python/branches/tlee-ast-optimize/setup.py Modified: python/branches/tlee-ast-optimize/Doc/Makefile ============================================================================== --- python/branches/tlee-ast-optimize/Doc/Makefile (original) +++ python/branches/tlee-ast-optimize/Doc/Makefile Tue Jul 1 14:28:00 2008 @@ -33,15 +33,15 @@ fi @if [ ! -d tools/docutils ]; then \ echo "Checking out Docutils..."; \ - svn checkout $(SVNROOT)/external/docutils-0.4/docutils tools/docutils; \ + svn checkout $(SVNROOT)/external/docutils-0.5/docutils tools/docutils; \ fi @if [ ! -d tools/jinja ]; then \ echo "Checking out Jinja..."; \ - svn checkout $(SVNROOT)/external/Jinja-1.1/jinja tools/jinja; \ + svn checkout $(SVNROOT)/external/Jinja-1.2/jinja tools/jinja; \ fi @if [ ! -d tools/pygments ]; then \ echo "Checking out Pygments..."; \ - svn checkout $(SVNROOT)/external/Pygments-0.9/pygments tools/pygments; \ + svn checkout $(SVNROOT)/external/Pygments-0.10/pygments tools/pygments; \ fi update: checkout @@ -103,6 +103,8 @@ @echo "Building finished; now copy build/pydoc-topics/pydoc_topics.py " \ "into the Lib/ directory" +htmlview: html + $(PYTHON) -c "import webbrowser; webbrowser.open('build/html/index.html')" clean: -rm -rf build/* -rm -rf tools/sphinx Modified: python/branches/tlee-ast-optimize/Doc/library/collections.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/collections.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/collections.rst Tue Jul 1 14:28:00 2008 @@ -540,8 +540,8 @@ raise ValueError('Got unexpected field names: %r' % kwds.keys()) return result - def __getnewargs__(self): - return tuple(self) + def __getnewargs__(self): + return tuple(self) x = property(itemgetter(0)) y = property(itemgetter(1)) Modified: python/branches/tlee-ast-optimize/Doc/library/fractions.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/fractions.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/fractions.rst Tue Jul 1 14:28:00 2008 @@ -9,38 +9,74 @@ .. versionadded:: 2.6 -The :mod:`fractions` module defines an immutable, infinite-precision -Fraction number class. +The :mod:`fractions` module provides support for rational number arithmetic. +A Fraction instance can be constructed from a pair of integers, from +another rational number, or from a string. + .. class:: Fraction(numerator=0, denominator=1) Fraction(other_fraction) Fraction(string) The first version requires that *numerator* and *denominator* are instances of :class:`numbers.Integral` and returns a new - ``Fraction`` representing ``numerator/denominator``. If - *denominator* is :const:`0`, raises a :exc:`ZeroDivisionError`. The - second version requires that *other_fraction* is an instance of - :class:`numbers.Rational` and returns an instance of - :class:`Fraction` with the same value. The third version expects a - string of the form ``[-+]?[0-9]+(/[0-9]+)?``, optionally surrounded - by spaces. - - Implements all of the methods and operations from - :class:`numbers.Rational` and is immutable and hashable. + :class:`Fraction` instance with value ``numerator/denominator``. If + *denominator* is :const:`0`, it raises a + :exc:`ZeroDivisionError`. The second version requires that + *other_fraction* is an instance of :class:`numbers.Rational` and + returns an :class:`Fraction` instance with the same value. The + last version of the constructor expects a string or unicode + instance in one of two possible forms. The first form is:: + + [sign] numerator ['/' denominator] + + where the optional ``sign`` may be either '+' or '-' and + ``numerator`` and ``denominator`` (if present) are strings of + decimal digits. The second permitted form is that of a number + containing a decimal point:: + + [sign] integer '.' [fraction] | [sign] '.' fraction + + where ``integer`` and ``fraction`` are strings of digits. In + either form the input string may also have leading and/or trailing + whitespace. Here are some examples:: + + >>> from fractions import Fraction + >>> Fraction(16, -10) + Fraction(-8, 5) + >>> Fraction(123) + Fraction(123, 1) + >>> Fraction() + Fraction(0, 1) + >>> Fraction('3/7') + Fraction(3, 7) + [40794 refs] + >>> Fraction(' -3/7 ') + Fraction(-3, 7) + >>> Fraction('1.414213 \t\n') + Fraction(1414213, 1000000) + >>> Fraction('-.125') + Fraction(-1, 8) + + + The :class:`Fraction` class inherits from the abstract base class + :class:`numbers.Rational`, and implements all of the methods and + operations from that class. :class:`Fraction` instances are hashable, + and should be treated as immutable. In addition, + :class:`Fraction` has the following methods: .. method:: from_float(flt) - This classmethod constructs a :class:`Fraction` representing the exact + This class method constructs a :class:`Fraction` representing the exact value of *flt*, which must be a :class:`float`. Beware that ``Fraction.from_float(0.3)`` is not the same value as ``Fraction(3, 10)`` .. method:: from_decimal(dec) - This classmethod constructs a :class:`Fraction` representing the exact + This class method constructs a :class:`Fraction` representing the exact value of *dec*, which must be a :class:`decimal.Decimal`. @@ -52,34 +88,24 @@ >>> from fractions import Fraction >>> Fraction('3.1415926535897932').limit_denominator(1000) - Fraction(355L, 113L) + Fraction(355, 113) or for recovering a rational number that's represented as a float: >>> from math import pi, cos >>> Fraction.from_float(cos(pi/3)) - Fraction(4503599627370497L, 9007199254740992L) + Fraction(4503599627370497, 9007199254740992) >>> Fraction.from_float(cos(pi/3)).limit_denominator() - Fraction(1L, 2L) - - - .. method:: __floor__() - - Returns the greatest :class:`int` ``<= self``. - - - .. method:: __ceil__() - - Returns the least :class:`int` ``>= self``. + Fraction(1, 2) - .. method:: __round__() - __round__(ndigits) +.. function:: gcd(a, b) - The first version returns the nearest :class:`int` to ``self``, rounding - half to even. The second version rounds ``self`` to the nearest multiple - of ``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative), - again rounding half toward even. + Return the greatest common divisor of the integers `a` and `b`. If + either `a` or `b` is nonzero, then the absolute value of `gcd(a, + b)` is the largest integer that divides both `a` and `b`. `gcd(a,b)` + has the same sign as `b` if `b` is nonzero; otherwise it takes the sign + of `a`. `gcd(0, 0)` returns `0`. .. seealso:: Modified: python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst Tue Jul 1 14:28:00 2008 @@ -6,23 +6,24 @@ .. versionadded:: 2.6 + Introduction ---------------------- -:mod:`multiprocessing` is a package that supports spawning processes -using an API similar to the :mod:`threading` module. The -:mod:`multiprocessing` package offers both local and remote -concurrency, effectively side-stepping the :term:`Global Interpreter -Lock` by using subprocesses instead of threads. Due to this, the -:mod:`multiprocessing` module allows the programmer to fully leverage -multiple processors on a given machine. It runs on both Unix and +:mod:`multiprocessing` is a package that supports spawning processes using an +API similar to the :mod:`threading` module. The :mod:`multiprocessing` package +offers both local and remote concurrency, effectively side-stepping the +:term:`Global Interpreter Lock` by using subprocesses instead of threads. Due +to this, the :mod:`multiprocessing` module allows the programmer to fully +leverage multiple processors on a given machine. It runs on both Unix and Windows. + The :class:`Process` class ~~~~~~~~~~~~~~~~~~~~~~~~~~ In :mod:`multiprocessing`, processes are spawned by creating a :class:`Process` -object and then calling its :meth:`Process.start` method. :class:`Process` +object and then calling its :meth:`~Process.start` method. :class:`Process` follows the API of :class:`threading.Thread`. A trivial example of a multiprocess program is :: @@ -87,11 +88,12 @@ p.join() The two connection objects returned by :func:`Pipe` represent the two ends of - the pipe. Each connection object has :meth:`send` and :meth:`recv` methods - (among others). Note that data in a pipe may become corrupted if two - processes (or threads) try to read from or write to the *same* end of the - pipe at the same time. Of course there is no risk of corruption from - processes using different ends of the pipe at the same time. + the pipe. Each connection object has :meth:`~Connection.send` and + :meth:`~Connection.recv` methods (among others). Note that data in a pipe + may become corrupted if two processes (or threads) try to read from or write + to the *same* end of the pipe at the same time. Of course there is no risk + of corruption from processes using different ends of the pipe at the same + time. Synchronization between processes @@ -212,7 +214,7 @@ Using a pool of workers ~~~~~~~~~~~~~~~~~~~~~~~ -The :class:`multiprocessing.pool.Pool()` class represents a pool of worker +The :class:`~multiprocessing.pool.Pool` class represents a pool of worker processes. It has methods which allows tasks to be offloaded to the worker processes in a few different ways. @@ -248,8 +250,8 @@ The constructor should always be called with keyword arguments. *group* should always be ``None``; it exists solely for compatibility with - :class:`threading.Thread`. *target* is the callable object to be invoked by - the :meth:`run()` method. It defaults to None, meaning nothing is + :class:`~threading.Thread`. *target* is the callable object to be invoked by + the :meth:`run()` method. It defaults to ``None``, meaning nothing is called. *name* is the process name. By default, a unique name is constructed of the form 'Process-N\ :sub:`1`:N\ :sub:`2`:...:N\ :sub:`k`' where N\ :sub:`1`,N\ :sub:`2`,...,N\ :sub:`k` is a sequence of integers whose length @@ -360,7 +362,7 @@ .. method:: terminate() Terminate the process. On Unix this is done using the ``SIGTERM`` signal; - on Windows ``TerminateProcess()`` is used. Note that exit handlers and + on Windows :cfunc:`TerminateProcess` is used. Note that exit handlers and finally clauses, etc., will not be executed. Note that descendant processes of the process will *not* be terminated -- @@ -416,14 +418,17 @@ The :class:`Queue` and :class:`JoinableQueue` types are multi-producer, multi-consumer FIFO queues modelled on the :class:`Queue.Queue` class in the standard library. They differ in that :class:`Queue` lacks the -:meth:`task_done` and :meth:`join` methods introduced into Python 2.5's -:class:`Queue.Queue` class. +:meth:`~Queue.Queue.task_done` and :meth:`~Queue.Queue.join` methods introduced +into Python 2.5's :class:`Queue.Queue` class. If you use :class:`JoinableQueue` then you **must** call :meth:`JoinableQueue.task_done` for each task removed from the queue or else the semaphore used to count the number of unfinished tasks may eventually overflow raising an exception. +Note that one can also create a shared queue by using a manager object -- see +:ref:`multiprocessing-managers`. + .. note:: :mod:`multiprocessing` uses the usual :exc:`Queue.Empty` and @@ -453,9 +458,6 @@ Note that a queue created using a manager does not have this issue. See :ref:`multiprocessing-programming`. -Note that one can also create a shared queue by using a manager object -- see -:ref:`multiprocessing-managers`. - For an example of the usage of queues for interprocess communication see :ref:`multiprocessing-examples`. @@ -481,7 +483,7 @@ standard library's :mod:`Queue` module are raised to signal timeouts. :class:`Queue` implements all the methods of :class:`Queue.Queue` except for - :meth:`task_done` and :meth:`join`. + :meth:`~Queue.Queue.task_done` and :meth:`~Queue.Queue.join`. .. method:: qsize() @@ -549,13 +551,13 @@ By default if a process is not the creator of the queue then on exit it will attempt to join the queue's background thread. The process can call - :meth:`cancel_join_thread()` to make :meth:`join_thread()` do nothing. + :meth:`cancel_join_thread` to make :meth:`join_thread` do nothing. .. method:: cancel_join_thread() Prevent :meth:`join_thread` from blocking. In particular, this prevents the background thread from being joined automatically when the process - exits -- see :meth:`join_thread()`. + exits -- see :meth:`join_thread`. .. class:: JoinableQueue([maxsize]) @@ -566,13 +568,13 @@ .. method:: task_done() Indicate that a formerly enqueued task is complete. Used by queue consumer - threads. For each :meth:`get` used to fetch a task, a subsequent call to - :meth:`task_done` tells the queue that the processing on the task is - complete. - - If a :meth:`join` is currently blocking, it will resume when all items - have been processed (meaning that a :meth:`task_done` call was received - for every item that had been :meth:`put` into the queue). + threads. For each :meth:`~Queue.get` used to fetch a task, a subsequent + call to :meth:`task_done` tells the queue that the processing on the task + is complete. + + If a :meth:`~Queue.join` is currently blocking, it will resume when all + items have been processed (meaning that a :meth:`task_done` call was + received for every item that had been :meth:`~Queue.put` into the queue). Raises a :exc:`ValueError` if called more times than there were items placed in the queue. @@ -586,7 +588,7 @@ queue. The count goes down whenever a consumer thread calls :meth:`task_done` to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, - :meth:`join` unblocks. + :meth:`~Queue.join` unblocks. Miscellaneous @@ -628,17 +630,17 @@ freeze_support() Process(target=f).start() - If the :func:`freeze_support()` line is missed out then trying to run the - frozen executable will raise :exc:`RuntimeError`. + If the ``freeze_support()`` line is missed out then trying to run the frozen + executable will raise :exc:`RuntimeError`. If the module is being run normally by the Python interpreter then - :func:`freeze_support()` has no effect. + :func:`freeze_support` has no effect. .. function:: set_executable() Sets the path of the python interpreter to use when starting a child process. - (By default `sys.executable` is used). Embedders will probably need to do - some thing like :: + (By default :data:`sys.executable` is used). Embedders will probably need to + do some thing like :: setExecutable(os.path.join(sys.exec_prefix, 'pythonw.exe')) @@ -659,7 +661,7 @@ Connection objects allow the sending and receiving of picklable objects or strings. They can be thought of as message oriented connected sockets. -Connection objects usually created using :func:`Pipe()` -- see also +Connection objects usually created using :func:`Pipe` -- see also :ref:`multiprocessing-listeners-clients`. .. class:: Connection @@ -756,9 +758,10 @@ receives, which can be a security risk unless you can trust the process which sent the message. - Therefore, unless the connection object was produced using :func:`Pipe()` - you should only use the `recv()` and `send()` methods after performing some - sort of authentication. See :ref:`multiprocessing-auth-keys`. + Therefore, unless the connection object was produced using :func:`Pipe` you + should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` + methods after performing some sort of authentication. See + :ref:`multiprocessing-auth-keys`. .. warning:: @@ -771,8 +774,8 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~ Generally synchronization primitives are not as necessary in a multiprocess -program as they are in a mulithreaded program. See the documentation for the -standard library's :mod:`threading` module. +program as they are in a mulithreaded program. See the documentation for +:mod:`threading` module. Note that one can also create synchronization primitives by using a manager object -- see :ref:`multiprocessing-managers`. @@ -786,7 +789,7 @@ .. class:: Condition([lock]) - A condition variable: a clone of `threading.Condition`. + A condition variable: a clone of :class:`threading.Condition`. If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` object from :mod:`multiprocessing`. @@ -809,7 +812,7 @@ .. note:: - The :meth:`acquire()` method of :class:`BoundedSemaphore`, :class:`Lock`, + The :meth:`acquire` method of :class:`BoundedSemaphore`, :class:`Lock`, :class:`RLock` and :class:`Semaphore` has a timeout parameter not supported by the equivalents in :mod:`threading`. The signature is ``acquire(block=True, timeout=None)`` with keyword parameters being @@ -835,7 +838,7 @@ It is possible to create shared objects using shared memory which can be inherited by child processes. -.. function:: Value(typecode_or_type[, lock[, *args]]) +.. function:: Value(typecode_or_type[, *args, lock]]) Return a :mod:`ctypes` object allocated from shared memory. By default the return value is actually a synchronized wrapper for the object. @@ -927,7 +930,7 @@ attributes which allow one to use it to store and retrieve strings -- see documentation for :mod:`ctypes`. -.. function:: Array(typecode_or_type, size_or_initializer[, lock[, *args]]) +.. function:: Array(typecode_or_type, size_or_initializer[, *args[, lock]]) The same as :func:`RawArray` except that depending on the value of *lock* a process-safe synchronization wrapper may be returned instead of a raw ctypes @@ -969,11 +972,11 @@ :class:`multiprocessing.RLock` object is created automatically. A synchronized wrapper will have two methods in addition to those of the - object it wraps: :meth:`get_obj()` returns the wrapped object and - :meth:`get_lock()` returns the lock object used for synchronization. + object it wraps: :meth:`get_obj` returns the wrapped object and + :meth:`get_lock` returns the lock object used for synchronization. Note that accessing the ctypes object through the wrapper can be a lot slower - han accessing the raw ctypes object. + than accessing the raw ctypes object. The table below compares the syntax for creating shared ctypes objects from @@ -1049,10 +1052,10 @@ .. function:: multiprocessing.Manager() - Returns a started :class:`SyncManager` object which can be used for sharing - objects between processes. The returned manager object corresponds to a - spawned child process and has methods which will create shared objects and - return corresponding proxies. + Returns a started :class:`~multiprocessing.managers.SyncManager` object which + can be used for sharing objects between processes. The returned manager + object corresponds to a spawned child process and has methods which will + create shared objects and return corresponding proxies. .. module:: multiprocessing.managers :synopsis: Share data between process with shared objects. @@ -1092,7 +1095,7 @@ .. method:: shutdown() Stop the process used by the manager. This is only available if - meth:`start` has been used to start the server process. + :meth:`start` has been used to start the server process. This can be called multiple times. @@ -1106,12 +1109,12 @@ *callable* is a callable used for creating objects for this type identifier. If a manager instance will be created using the - :meth:`from_address()` classmethod or if the *create_method* argument is + :meth:`from_address` classmethod or if the *create_method* argument is ``False`` then this can be left as ``None``. - *proxytype* is a subclass of :class:`multiprocessing.managers.BaseProxy` - which is used to create proxies for shared objects with this *typeid*. If - ``None`` then a proxy class is created automatically. + *proxytype* is a subclass of :class:`BaseProxy` which is used to create + proxies for shared objects with this *typeid*. If ``None`` then a proxy + class is created automatically. *exposed* is used to specify a sequence of method names which proxies for this typeid should be allowed to access using @@ -1119,7 +1122,7 @@ :attr:`proxytype._exposed_` is used instead if it exists.) In the case where no exposed list is specified, all "public methods" of the shared object will be accessible. (Here a "public method" means any attribute - which has a ``__call__()`` method and whose name does not begin with + which has a :meth:`__call__` method and whose name does not begin with ``'_'``.) *method_to_typeid* is a mapping used to specify the return type of those @@ -1144,7 +1147,7 @@ A subclass of :class:`BaseManager` which can be used for the synchronization of processes. Objects of this type are returned by - :func:`multiprocessing.Manager()`. + :func:`multiprocessing.Manager`. It also supports creation of shared lists and dictionaries. @@ -1175,7 +1178,7 @@ .. method:: Queue([maxsize]) - Create a shared `Queue.Queue` object and return a proxy for it. + Create a shared :class:`Queue.Queue` object and return a proxy for it. .. method:: RLock() @@ -1188,7 +1191,7 @@ .. method:: Array(typecode, sequence) - Create an array and return a proxy for it. (*format* is ignored.) + Create an array and return a proxy for it. .. method:: Value(typecode, value) @@ -1229,8 +1232,8 @@ >>>>>>>>>>>>>>>>>>> To create one's own manager, one creates a subclass of :class:`BaseManager` and -use the :meth:`resgister()` classmethod to register new types or callables with -the manager class. For example:: +use the :meth:`~BaseManager.resgister` classmethod to register new types or +callables with the manager class. For example:: from multiprocessing.managers import BaseManager @@ -1329,7 +1332,7 @@ >>> a = manager.list() >>> b = manager.list() - >>> a.append(b) # referent of `a` now contains referent of `b` + >>> a.append(b) # referent of a now contains referent of b >>> print a, b [[]] [] >>> b.append('hello') @@ -1376,7 +1379,7 @@ Note in particular that an exception will be raised if *methodname* has not been *exposed* - An example of the usage of :meth:`_call_method()`:: + An example of the usage of :meth:`_call_method`:: >>> l = manager.list(range(10)) >>> l._call_method('__len__') @@ -1420,7 +1423,7 @@ :synopsis: Create pools of processes. One can create a pool of processes which will carry out tasks submitted to it -with the :class:`Pool` class in :mod:`multiprocess.pool`. +with the :class:`Pool` class. .. class:: multiprocessing.Pool([processes[, initializer[, initargs]]]) @@ -1458,7 +1461,7 @@ .. method:: map_async(func, iterable[, chunksize[, callback]]) - A variant of the :meth:`.map` method which returns a result object. + A variant of the :meth:`map` method which returns a result object. If *callback* is specified then it should be a callable which accepts a single argument. When the result becomes ready *callback* is applied to @@ -1566,7 +1569,7 @@ However, the :mod:`multiprocessing.connection` module allows some extra flexibility. It basically gives a high level message oriented API for dealing with sockets or Windows named pipes, and also has support for *digest -authentication* using the :mod:`hmac` module from the standard library. +authentication* using the :mod:`hmac` module. .. function:: deliver_challenge(connection, authkey) @@ -1589,7 +1592,7 @@ .. function:: Client(address[, family[, authenticate[, authkey]]]) Attempt to set up a connection to the listener which is using address - *address*, returning a :class:`Connection`. + *address*, returning a :class:`~multiprocessing.Connection`. The type of the connection is determined by *family* argument, but this can generally be omitted since it can usually be inferred from the format of @@ -1665,15 +1668,6 @@ Exception raised when there is an authentication error. -.. exception:: BufferTooShort - - Exception raise by the :meth:`Connection.recv_bytes_into` method of a - connection object when the supplied buffer object is too small for the - message read. - - If *e* is an instance of :exc:`BufferTooShort` then ``e.args[0]`` will give - the message as a byte string. - **Examples** @@ -1756,11 +1750,11 @@ If authentication is requested but do authentication key is specified then the return value of ``current_process().get_auth_key`` is used (see -:class:`Process`). This value will automatically inherited by any -:class:`Process` object that the current process creates. This means that (by -default) all processes of a multi-process program will share a single -authentication key which can be used when setting up connections between the -themselves. +:class:`~multiprocessing.Process`). This value will automatically inherited by +any :class:`~multiprocessing.Process` object that the current process creates. +This means that (by default) all processes of a multi-process program will share +a single authentication key which can be used when setting up connections +between the themselves. Suitable authentication keys can also be generated by using :func:`os.urandom`. @@ -1810,7 +1804,7 @@ :synopsis: Dumb wrapper around threading. :mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` but is -no more than a wrapper around the `threading` module. +no more than a wrapper around the :mod:`threading` module. .. _multiprocessing-programming: @@ -1870,8 +1864,7 @@ processes. Therefore it is probably best to only consider using - :meth:`Process.terminate()` on processes which never use any shared - resources. + :meth:`Process.terminate` on processes which never use any shared resources. Joining processes that use queues @@ -1994,7 +1987,7 @@ p = Process(target=foo) p.start() - (The :func:`freeze_support()` line can be omitted if the program will be run + (The ``freeze_support()`` line can be omitted if the program will be run normally instead of frozen.) This allows the newly spawned Python interpreter to safely import the module @@ -2047,4 +2040,4 @@ You will need to have private key authentication for all hosts configured for this to work. -.. literalinclude:: ../includes/mp_distributing.py \ No newline at end of file +.. literalinclude:: ../includes/mp_distributing.py Modified: python/branches/tlee-ast-optimize/Doc/library/socketserver.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/socketserver.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/socketserver.rst Tue Jul 1 14:28:00 2008 @@ -158,6 +158,8 @@ Tells the :meth:`serve_forever` loop to stop and waits until it does. + .. versionadded:: 2.6 + .. data:: address_family Modified: python/branches/tlee-ast-optimize/Doc/library/ssl.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/ssl.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/ssl.rst Tue Jul 1 14:28:00 2008 @@ -54,7 +54,7 @@ network connection. This error is a subtype of :exc:`socket.error`, which in turn is a subtype of :exc:`IOError`. -.. function:: wrap_socket (sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version={see docs}, ca_certs=None) +.. function:: wrap_socket (sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version={see docs}, ca_certs=None, do_handshake_on_connect=True, suppress_ragged_eofs=True) Takes an instance ``sock`` of :class:`socket.socket`, and returns an instance of :class:`ssl.SSLSocket`, a subtype of :class:`socket.socket`, which wraps the underlying socket in an SSL context. @@ -122,6 +122,18 @@ In some older versions of OpenSSL (for instance, 0.9.7l on OS X 10.4), an SSLv2 client could not connect to an SSLv23 server. + The parameter ``do_handshake_on_connect`` specifies whether to do the SSL + handshake automatically after doing a :meth:`socket.connect`, or whether the + application program will call it explicitly, by invoking the :meth:`SSLSocket.do_handshake` + method. Calling :meth:`SSLSocket.do_handshake` explicitly gives the program control over + the blocking behavior of the socket I/O involved in the handshake. + + The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket.read` + method should signal unexpected EOF from the other end of the connection. If specified + as :const:`True` (the default), it returns a normal EOF in response to unexpected + EOF errors raised from the underlying socket; if :const:`False`, it will raise + the exceptions back to the caller. + .. function:: RAND_status() Returns True if the SSL pseudo-random number generator has been @@ -290,6 +302,25 @@ number of secret bits being used. If no connection has been established, returns ``None``. +.. method:: SSLSocket.do_handshake() + + Perform a TLS/SSL handshake. If this is used with a non-blocking socket, + it may raise :exc:`SSLError` with an ``arg[0]`` of :const:`SSL_ERROR_WANT_READ` + or :const:`SSL_ERROR_WANT_WRITE`, in which case it must be called again until it + completes successfully. For example, to simulate the behavior of a blocking socket, + one might write:: + + while True: + try: + s.do_handshake() + break + except ssl.SSLError, err: + if err.args[0] == ssl.SSL_ERROR_WANT_READ: + select.select([s], [], []) + elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: + select.select([], [s], []) + else: + raise .. index:: single: certificates @@ -367,6 +398,7 @@ chains for each issuer you are willing to trust. Again, this file just contains these chains concatenated together. For validation, Python will use the first chain it finds in the file which matches. + Some "standard" root certificates are available from various certification authorities: `CACert.org `_, Modified: python/branches/tlee-ast-optimize/Doc/reference/compound_stmts.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/reference/compound_stmts.rst (original) +++ python/branches/tlee-ast-optimize/Doc/reference/compound_stmts.rst Tue Jul 1 14:28:00 2008 @@ -538,10 +538,10 @@ class`\es, descriptors can be used to create instance variables with different implementation details. -Class definitions, like function definitions, may be wrapped by one or -more :term:`decorator` expressions. The evaluation rules for the -decorator expressions are the same as for functions. The result must -be a class object, which is then bound to the class name. +Class definitions, like function definitions, may be wrapped by one or more +:term:`decorator` expressions. The evaluation rules for the decorator +expressions are the same as for functions. The result must be a class object, +which is then bound to the class name. .. rubric:: Footnotes Modified: python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst (original) +++ python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst Tue Jul 1 14:28:00 2008 @@ -1284,12 +1284,12 @@ Here are all of the changes that Python 2.6 makes to the core Python language. * The :func:`hasattr` function was catching and ignoring all errors, - under the assumption that they meant a :meth:`__getattr__` method has - failing somewhere and the return value of :func:`hasattr` would therefore - be ``False``. This logic shouldn't be applied to - :exc:`KeyboardInterrupt` and :exc:`SystemExit`, however; Python 2.6 will - no longer discard such exceptions when :func:`hasattr` encounters them. - (Fixed by Benjamin Peterson; :issue:`2196`.) + under the assumption that they meant a :meth:`__getattr__` method + was failing somewhere and the return value of :func:`hasattr` would + therefore be ``False``. This logic shouldn't be applied to + :exc:`KeyboardInterrupt` and :exc:`SystemExit`, however; Python 2.6 + will no longer discard such exceptions when :func:`hasattr` + encounters them. (Fixed by Benjamin Peterson; :issue:`2196`.) * When calling a function using the ``**`` syntax to provide keyword arguments, you are no longer required to use a Python dictionary; Modified: python/branches/tlee-ast-optimize/Lib/bsddb/test/test_replication.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/bsddb/test/test_replication.py (original) +++ python/branches/tlee-ast-optimize/Lib/bsddb/test/test_replication.py Tue Jul 1 14:28:00 2008 @@ -94,7 +94,7 @@ # The timeout is necessary in BDB 4.5, since DB_EVENT_REP_STARTUPDONE # is not generated if the master has no new transactions. # This is solved in BDB 4.6 (#15542). - timeout = time.time()+2 + timeout = time.time()+10 while (time.time()= (4,6) : Modified: python/branches/tlee-ast-optimize/Lib/fractions.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/fractions.py (original) +++ python/branches/tlee-ast-optimize/Lib/fractions.py Tue Jul 1 14:28:00 2008 @@ -203,7 +203,7 @@ def __repr__(self): """repr(self)""" - return ('Fraction(%r, %r)' % (self._numerator, self._denominator)) + return ('Fraction(%s, %s)' % (self._numerator, self._denominator)) def __str__(self): """str(self)""" Modified: python/branches/tlee-ast-optimize/Lib/logging/config.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/logging/config.py (original) +++ python/branches/tlee-ast-optimize/Lib/logging/config.py Tue Jul 1 14:28:00 2008 @@ -155,8 +155,7 @@ h.setLevel(logging._levelNames[level]) if len(fmt): h.setFormatter(formatters[fmt]) - #temporary hack for FileHandler and MemoryHandler. - if klass == logging.handlers.MemoryHandler: + if issubclass(klass, logging.handlers.MemoryHandler): if "target" in opts: target = cp.get(sectname,"target") else: Modified: python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py (original) +++ python/branches/tlee-ast-optimize/Lib/multiprocessing/managers.py Tue Jul 1 14:28:00 2008 @@ -964,10 +964,9 @@ return self._callmethod('notify_all') class EventProxy(BaseProxy): - # XXX will Event.isSet name be available in Py3.0? - _exposed_ = ('isSet', 'set', 'clear', 'wait') + _exposed_ = ('is_set', 'set', 'clear', 'wait') def is_set(self): - return self._callmethod('isSet') + return self._callmethod('is_set') def set(self): return self._callmethod('set') def clear(self): Modified: python/branches/tlee-ast-optimize/Lib/ssl.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/ssl.py (original) +++ python/branches/tlee-ast-optimize/Lib/ssl.py Tue Jul 1 14:28:00 2008 @@ -74,7 +74,7 @@ SSL_ERROR_EOF, \ SSL_ERROR_INVALID_ERROR_CODE -from socket import socket +from socket import socket, _fileobject from socket import getnameinfo as _getnameinfo import base64 # for DER-to-PEM translation @@ -86,8 +86,16 @@ def __init__(self, sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, - ssl_version=PROTOCOL_SSLv23, ca_certs=None): + ssl_version=PROTOCOL_SSLv23, ca_certs=None, + do_handshake_on_connect=True, + suppress_ragged_eofs=True): socket.__init__(self, _sock=sock._sock) + # the initializer for socket trashes the methods (tsk, tsk), so... + self.send = lambda x, flags=0: SSLSocket.send(self, x, flags) + self.recv = lambda x, flags=0: SSLSocket.recv(self, x, flags) + self.sendto = lambda data, addr, flags=0: SSLSocket.sendto(self, data, addr, flags) + self.recvfrom = lambda addr, buflen, flags: SSLSocket.recvfrom(self, addr, buflen, flags) + if certfile and not keyfile: keyfile = certfile # see if it's connected @@ -101,18 +109,34 @@ self._sslobj = _ssl.sslwrap(self._sock, server_side, keyfile, certfile, cert_reqs, ssl_version, ca_certs) + if do_handshake_on_connect: + timeout = self.gettimeout() + try: + self.settimeout(None) + self.do_handshake() + finally: + self.settimeout(timeout) self.keyfile = keyfile self.certfile = certfile self.cert_reqs = cert_reqs self.ssl_version = ssl_version self.ca_certs = ca_certs + self.do_handshake_on_connect = do_handshake_on_connect + self.suppress_ragged_eofs = suppress_ragged_eofs + self._makefile_refs = 0 def read(self, len=1024): """Read up to LEN bytes and return them. Return zero-length string on EOF.""" - return self._sslobj.read(len) + try: + return self._sslobj.read(len) + except SSLError, x: + if x.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs: + return '' + else: + raise def write(self, data): @@ -143,16 +167,27 @@ raise ValueError( "non-zero flags not allowed in calls to send() on %s" % self.__class__) - return self._sslobj.write(data) + while True: + try: + v = self._sslobj.write(data) + except SSLError, x: + if x.args[0] == SSL_ERROR_WANT_READ: + return 0 + elif x.args[0] == SSL_ERROR_WANT_WRITE: + return 0 + else: + raise + else: + return v else: return socket.send(self, data, flags) - def send_to (self, data, addr, flags=0): + def sendto (self, data, addr, flags=0): if self._sslobj: - raise ValueError("send_to not allowed on instances of %s" % + raise ValueError("sendto not allowed on instances of %s" % self.__class__) else: - return socket.send_to(self, data, addr, flags) + return socket.sendto(self, data, addr, flags) def sendall (self, data, flags=0): if self._sslobj: @@ -160,7 +195,12 @@ raise ValueError( "non-zero flags not allowed in calls to sendall() on %s" % self.__class__) - return self._sslobj.write(data) + amount = len(data) + count = 0 + while (count < amount): + v = self.send(data[count:]) + count += v + return amount else: return socket.sendall(self, data, flags) @@ -170,25 +210,51 @@ raise ValueError( "non-zero flags not allowed in calls to sendall() on %s" % self.__class__) - return self._sslobj.read(data, buflen) + while True: + try: + return self.read(buflen) + except SSLError, x: + if x.args[0] == SSL_ERROR_WANT_READ: + continue + else: + raise x else: return socket.recv(self, buflen, flags) - def recv_from (self, addr, buflen=1024, flags=0): + def recvfrom (self, addr, buflen=1024, flags=0): if self._sslobj: - raise ValueError("recv_from not allowed on instances of %s" % + raise ValueError("recvfrom not allowed on instances of %s" % self.__class__) else: - return socket.recv_from(self, addr, buflen, flags) + return socket.recvfrom(self, addr, buflen, flags) - def shutdown(self, how): + def pending (self): + if self._sslobj: + return self._sslobj.pending() + else: + return 0 + + def shutdown (self, how): self._sslobj = None socket.shutdown(self, how) - def close(self): + def close (self): self._sslobj = None socket.close(self) + def close (self): + if self._makefile_refs < 1: + self._sslobj = None + socket.close(self) + else: + self._makefile_refs -= 1 + + def do_handshake (self): + + """Perform a TLS/SSL handshake.""" + + self._sslobj.do_handshake() + def connect(self, addr): """Connects to remote ADDR, and then wraps the connection in @@ -202,6 +268,8 @@ self._sslobj = _ssl.sslwrap(self._sock, False, self.keyfile, self.certfile, self.cert_reqs, self.ssl_version, self.ca_certs) + if self.do_handshake_on_connect: + self.do_handshake() def accept(self): @@ -210,260 +278,39 @@ SSL channel, and the address of the remote client.""" newsock, addr = socket.accept(self) - return (SSLSocket(newsock, True, self.keyfile, self.certfile, - self.cert_reqs, self.ssl_version, - self.ca_certs), addr) - + return (SSLSocket(newsock, + keyfile=self.keyfile, + certfile=self.certfile, + server_side=True, + cert_reqs=self.cert_reqs, + ssl_version=self.ssl_version, + ca_certs=self.ca_certs, + do_handshake_on_connect=self.do_handshake_on_connect, + suppress_ragged_eofs=self.suppress_ragged_eofs), + addr) def makefile(self, mode='r', bufsize=-1): """Ouch. Need to make and return a file-like object that works with the SSL connection.""" - if self._sslobj: - return SSLFileStream(self._sslobj, mode, bufsize) - else: - return socket.makefile(self, mode, bufsize) - - -class SSLFileStream: - - """A class to simulate a file stream on top of a socket. - Most of this is just lifted from the socket module, and - adjusted to work with an SSL stream instead of a socket.""" - - - default_bufsize = 8192 - name = "" - - __slots__ = ["mode", "bufsize", "softspace", - # "closed" is a property, see below - "_sslobj", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf", - "_close", "_fileno"] - - def __init__(self, sslobj, mode='rb', bufsize=-1, close=False): - self._sslobj = sslobj - self.mode = mode # Not actually used in this version - if bufsize < 0: - bufsize = self.default_bufsize - self.bufsize = bufsize - self.softspace = False - if bufsize == 0: - self._rbufsize = 1 - elif bufsize == 1: - self._rbufsize = self.default_bufsize - else: - self._rbufsize = bufsize - self._wbufsize = bufsize - self._rbuf = "" # A string - self._wbuf = [] # A list of strings - self._close = close - self._fileno = -1 - - def _getclosed(self): - return self._sslobj is None - closed = property(_getclosed, doc="True if the file is closed") - - def fileno(self): - return self._fileno - - def close(self): - try: - if self._sslobj: - self.flush() - finally: - if self._close and self._sslobj: - self._sslobj.close() - self._sslobj = None - - def __del__(self): - try: - self.close() - except: - # close() may fail if __init__ didn't complete - pass - - def flush(self): - if self._wbuf: - buffer = "".join(self._wbuf) - self._wbuf = [] - count = 0 - while (count < len(buffer)): - written = self._sslobj.write(buffer) - count += written - buffer = buffer[written:] - - def write(self, data): - data = str(data) # XXX Should really reject non-string non-buffers - if not data: - return - self._wbuf.append(data) - if (self._wbufsize == 0 or - self._wbufsize == 1 and '\n' in data or - self._get_wbuf_len() >= self._wbufsize): - self.flush() - - def writelines(self, list): - # XXX We could do better here for very long lists - # XXX Should really reject non-string non-buffers - self._wbuf.extend(filter(None, map(str, list))) - if (self._wbufsize <= 1 or - self._get_wbuf_len() >= self._wbufsize): - self.flush() - - def _get_wbuf_len(self): - buf_len = 0 - for x in self._wbuf: - buf_len += len(x) - return buf_len - - def read(self, size=-1): - data = self._rbuf - if size < 0: - # Read until EOF - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" - if self._rbufsize <= 1: - recv_size = self.default_bufsize - else: - recv_size = self._rbufsize - while True: - data = self._sslobj.read(recv_size) - if not data: - break - buffers.append(data) - return "".join(buffers) - else: - # Read until size bytes or EOF seen, whichever comes first - buf_len = len(data) - if buf_len >= size: - self._rbuf = data[size:] - return data[:size] - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" - while True: - left = size - buf_len - recv_size = max(self._rbufsize, left) - data = self._sslobj.read(recv_size) - if not data: - break - buffers.append(data) - n = len(data) - if n >= left: - self._rbuf = data[left:] - buffers[-1] = data[:left] - break - buf_len += n - return "".join(buffers) - - def readline(self, size=-1): - data = self._rbuf - if size < 0: - # Read until \n or EOF, whichever comes first - if self._rbufsize <= 1: - # Speed up unbuffered case - assert data == "" - buffers = [] - while data != "\n": - data = self._sslobj.read(1) - if not data: - break - buffers.append(data) - return "".join(buffers) - nl = data.find('\n') - if nl >= 0: - nl += 1 - self._rbuf = data[nl:] - return data[:nl] - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" - while True: - data = self._sslobj.read(self._rbufsize) - if not data: - break - buffers.append(data) - nl = data.find('\n') - if nl >= 0: - nl += 1 - self._rbuf = data[nl:] - buffers[-1] = data[:nl] - break - return "".join(buffers) - else: - # Read until size bytes or \n or EOF seen, whichever comes first - nl = data.find('\n', 0, size) - if nl >= 0: - nl += 1 - self._rbuf = data[nl:] - return data[:nl] - buf_len = len(data) - if buf_len >= size: - self._rbuf = data[size:] - return data[:size] - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" - while True: - data = self._sslobj.read(self._rbufsize) - if not data: - break - buffers.append(data) - left = size - buf_len - nl = data.find('\n', 0, left) - if nl >= 0: - nl += 1 - self._rbuf = data[nl:] - buffers[-1] = data[:nl] - break - n = len(data) - if n >= left: - self._rbuf = data[left:] - buffers[-1] = data[:left] - break - buf_len += n - return "".join(buffers) - - def readlines(self, sizehint=0): - total = 0 - list = [] - while True: - line = self.readline() - if not line: - break - list.append(line) - total += len(line) - if sizehint and total >= sizehint: - break - return list - - # Iterator protocols - - def __iter__(self): - return self - - def next(self): - line = self.readline() - if not line: - raise StopIteration - return line - + self._makefile_refs += 1 + return _fileobject(self, mode, bufsize) def wrap_socket(sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, - ssl_version=PROTOCOL_SSLv23, ca_certs=None): + ssl_version=PROTOCOL_SSLv23, ca_certs=None, + do_handshake_on_connect=True, + suppress_ragged_eofs=True): return SSLSocket(sock, keyfile=keyfile, certfile=certfile, server_side=server_side, cert_reqs=cert_reqs, - ssl_version=ssl_version, ca_certs=ca_certs) + ssl_version=ssl_version, ca_certs=ca_certs, + do_handshake_on_connect=do_handshake_on_connect, + suppress_ragged_eofs=suppress_ragged_eofs) + # some utility functions @@ -549,5 +396,7 @@ for compability with Python 2.5 and earlier. Will disappear in Python 3.0.""" - return _ssl.sslwrap(sock._sock, 0, keyfile, certfile, CERT_NONE, - PROTOCOL_SSLv23, None) + ssl_sock = _ssl.sslwrap(sock._sock, 0, keyfile, certfile, CERT_NONE, + PROTOCOL_SSLv23, None) + ssl_sock.do_handshake() + return ssl_sock Modified: python/branches/tlee-ast-optimize/Lib/test/test_audioop.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_audioop.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_audioop.py Tue Jul 1 14:28:00 2008 @@ -1,286 +1,169 @@ -# Test audioop. import audioop -from test.test_support import verbose +import unittest +from test.test_support import run_unittest + def gendata1(): return '\0\1\2' def gendata2(): - if verbose: - print 'getsample' if audioop.getsample('\0\1', 2, 0) == 1: return '\0\0\0\1\0\2' else: return '\0\0\1\0\2\0' def gendata4(): - if verbose: - print 'getsample' if audioop.getsample('\0\0\0\1', 4, 0) == 1: return '\0\0\0\0\0\0\0\1\0\0\0\2' else: return '\0\0\0\0\1\0\0\0\2\0\0\0' -def testmax(data): - if verbose: - print 'max' - if audioop.max(data[0], 1) != 2 or \ - audioop.max(data[1], 2) != 2 or \ - audioop.max(data[2], 4) != 2: - return 0 - return 1 - -def testminmax(data): - if verbose: - print 'minmax' - if audioop.minmax(data[0], 1) != (0, 2) or \ - audioop.minmax(data[1], 2) != (0, 2) or \ - audioop.minmax(data[2], 4) != (0, 2): - return 0 - return 1 - -def testmaxpp(data): - if verbose: - print 'maxpp' - if audioop.maxpp(data[0], 1) != 0 or \ - audioop.maxpp(data[1], 2) != 0 or \ - audioop.maxpp(data[2], 4) != 0: - return 0 - return 1 - -def testavg(data): - if verbose: - print 'avg' - if audioop.avg(data[0], 1) != 1 or \ - audioop.avg(data[1], 2) != 1 or \ - audioop.avg(data[2], 4) != 1: - return 0 - return 1 - -def testavgpp(data): - if verbose: - print 'avgpp' - if audioop.avgpp(data[0], 1) != 0 or \ - audioop.avgpp(data[1], 2) != 0 or \ - audioop.avgpp(data[2], 4) != 0: - return 0 - return 1 - -def testrms(data): - if audioop.rms(data[0], 1) != 1 or \ - audioop.rms(data[1], 2) != 1 or \ - audioop.rms(data[2], 4) != 1: - return 0 - return 1 - -def testcross(data): - if verbose: - print 'cross' - if audioop.cross(data[0], 1) != 0 or \ - audioop.cross(data[1], 2) != 0 or \ - audioop.cross(data[2], 4) != 0: - return 0 - return 1 - -def testadd(data): - if verbose: - print 'add' - data2 = [] - for d in data: - str = '' - for s in d: - str = str + chr(ord(s)*2) - data2.append(str) - if audioop.add(data[0], data[0], 1) != data2[0] or \ - audioop.add(data[1], data[1], 2) != data2[1] or \ - audioop.add(data[2], data[2], 4) != data2[2]: - return 0 - return 1 - -def testbias(data): - if verbose: - print 'bias' - # Note: this test assumes that avg() works - d1 = audioop.bias(data[0], 1, 100) - d2 = audioop.bias(data[1], 2, 100) - d4 = audioop.bias(data[2], 4, 100) - if audioop.avg(d1, 1) != 101 or \ - audioop.avg(d2, 2) != 101 or \ - audioop.avg(d4, 4) != 101: - return 0 - return 1 - -def testlin2lin(data): - if verbose: - print 'lin2lin' - # too simple: we test only the size - for d1 in data: - for d2 in data: - got = len(d1)//3 - wtd = len(d2)//3 - if len(audioop.lin2lin(d1, got, wtd)) != len(d2): - return 0 - return 1 - -def testadpcm2lin(data): - # Very cursory test - if audioop.adpcm2lin('\0\0', 1, None) != ('\0\0\0\0', (0,0)): - return 0 - return 1 - -def testlin2adpcm(data): - if verbose: - print 'lin2adpcm' - # Very cursory test - if audioop.lin2adpcm('\0\0\0\0', 1, None) != ('\0\0', (0,0)): - return 0 - return 1 - -def testlin2alaw(data): - if verbose: - print 'lin2alaw' - if audioop.lin2alaw(data[0], 1) != '\xd5\xc5\xf5' or \ - audioop.lin2alaw(data[1], 2) != '\xd5\xd5\xd5' or \ - audioop.lin2alaw(data[2], 4) != '\xd5\xd5\xd5': - return 0 - return 1 - -def testalaw2lin(data): - if verbose: - print 'alaw2lin' - # Cursory - d = audioop.lin2alaw(data[0], 1) - if audioop.alaw2lin(d, 1) != data[0]: - return 0 - return 1 - -def testlin2ulaw(data): - if verbose: - print 'lin2ulaw' - if audioop.lin2ulaw(data[0], 1) != '\xff\xe7\xdb' or \ - audioop.lin2ulaw(data[1], 2) != '\xff\xff\xff' or \ - audioop.lin2ulaw(data[2], 4) != '\xff\xff\xff': - return 0 - return 1 - -def testulaw2lin(data): - if verbose: - print 'ulaw2lin' - # Cursory - d = audioop.lin2ulaw(data[0], 1) - if audioop.ulaw2lin(d, 1) != data[0]: - return 0 - return 1 - -def testmul(data): - if verbose: - print 'mul' - data2 = [] - for d in data: - str = '' - for s in d: - str = str + chr(ord(s)*2) - data2.append(str) - if audioop.mul(data[0], 1, 2) != data2[0] or \ - audioop.mul(data[1],2, 2) != data2[1] or \ - audioop.mul(data[2], 4, 2) != data2[2]: - return 0 - return 1 - -def testratecv(data): - if verbose: - print 'ratecv' - state = None - d1, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) - d2, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) - if d1 + d2 != '\000\000\001\001\002\001\000\000\001\001\002': - return 0 - return 1 - -def testreverse(data): - if verbose: - print 'reverse' - if audioop.reverse(data[0], 1) != '\2\1\0': - return 0 - return 1 - -def testtomono(data): - if verbose: - print 'tomono' - data2 = '' - for d in data[0]: - data2 = data2 + d + d - if audioop.tomono(data2, 1, 0.5, 0.5) != data[0]: - return 0 - return 1 - -def testtostereo(data): - if verbose: - print 'tostereo' - data2 = '' - for d in data[0]: - data2 = data2 + d + d - if audioop.tostereo(data[0], 1, 1, 1) != data2: - return 0 - return 1 - -def testfindfactor(data): - if verbose: - print 'findfactor' - if audioop.findfactor(data[1], data[1]) != 1.0: - return 0 - return 1 - -def testfindfit(data): - if verbose: - print 'findfit' - if audioop.findfit(data[1], data[1]) != (0, 1.0): - return 0 - return 1 - -def testfindmax(data): - if verbose: - print 'findmax' - if audioop.findmax(data[1], 1) != 2: - return 0 - return 1 - -def testgetsample(data): - if verbose: - print 'getsample' - for i in range(3): - if audioop.getsample(data[0], 1, i) != i or \ - audioop.getsample(data[1], 2, i) != i or \ - audioop.getsample(data[2], 4, i) != i: - return 0 - return 1 - -def testone(name, data): - try: - func = eval('test'+name) - except NameError: - print 'No test found for audioop.'+name+'()' - return - try: - rv = func(data) - except 'xx': - print 'Test FAILED for audioop.'+name+'() (with an exception)' - return - if not rv: - print 'Test FAILED for audioop.'+name+'()' +data = [gendata1(), gendata2(), gendata4()] -def test_main(): - data = [gendata1(), gendata2(), gendata4()] - names = dir(audioop) - # We know there is a routine 'add' - routines = [] - for n in names: - if type(eval('audioop.'+n)) == type(audioop.add): - routines.append(n) - for n in routines: - testone(n, data) +class TestAudioop(unittest.TestCase): + + def test_max(self): + self.assertEqual(audioop.max(data[0], 1), 2) + self.assertEqual(audioop.max(data[1], 2), 2) + self.assertEqual(audioop.max(data[2], 4), 2) + + def test_minmax(self): + self.assertEqual(audioop.minmax(data[0], 1), (0, 2)) + self.assertEqual(audioop.minmax(data[1], 2), (0, 2)) + self.assertEqual(audioop.minmax(data[2], 4), (0, 2)) + + def test_maxpp(self): + self.assertEqual(audioop.maxpp(data[0], 1), 0) + self.assertEqual(audioop.maxpp(data[1], 2), 0) + self.assertEqual(audioop.maxpp(data[2], 4), 0) + + def test_avg(self): + self.assertEqual(audioop.avg(data[0], 1), 1) + self.assertEqual(audioop.avg(data[1], 2), 1) + self.assertEqual(audioop.avg(data[2], 4), 1) + + def test_avgpp(self): + self.assertEqual(audioop.avgpp(data[0], 1), 0) + self.assertEqual(audioop.avgpp(data[1], 2), 0) + self.assertEqual(audioop.avgpp(data[2], 4), 0) + + def test_rms(self): + self.assertEqual(audioop.rms(data[0], 1), 1) + self.assertEqual(audioop.rms(data[1], 2), 1) + self.assertEqual(audioop.rms(data[2], 4), 1) + + def test_cross(self): + self.assertEqual(audioop.cross(data[0], 1), 0) + self.assertEqual(audioop.cross(data[1], 2), 0) + self.assertEqual(audioop.cross(data[2], 4), 0) + + def test_add(self): + data2 = [] + for d in data: + str = '' + for s in d: + str = str + chr(ord(s)*2) + data2.append(str) + self.assertEqual(audioop.add(data[0], data[0], 1), data2[0]) + self.assertEqual(audioop.add(data[1], data[1], 2), data2[1]) + self.assertEqual(audioop.add(data[2], data[2], 4), data2[2]) + + def test_bias(self): + # Note: this test assumes that avg() works + d1 = audioop.bias(data[0], 1, 100) + d2 = audioop.bias(data[1], 2, 100) + d4 = audioop.bias(data[2], 4, 100) + self.assertEqual(audioop.avg(d1, 1), 101) + self.assertEqual(audioop.avg(d2, 2), 101) + self.assertEqual(audioop.avg(d4, 4), 101) + + def test_lin2lin(self): + # too simple: we test only the size + for d1 in data: + for d2 in data: + got = len(d1)//3 + wtd = len(d2)//3 + self.assertEqual(len(audioop.lin2lin(d1, got, wtd)), len(d2)) + + def test_adpcm2lin(self): + # Very cursory test + self.assertEqual(audioop.adpcm2lin('\0\0', 1, None), ('\0\0\0\0', (0,0))) + + def test_lin2adpcm(self): + # Very cursory test + self.assertEqual(audioop.lin2adpcm('\0\0\0\0', 1, None), ('\0\0', (0,0))) + + def test_lin2alaw(self): + self.assertEqual(audioop.lin2alaw(data[0], 1), '\xd5\xc5\xf5') + self.assertEqual(audioop.lin2alaw(data[1], 2), '\xd5\xd5\xd5') + self.assertEqual(audioop.lin2alaw(data[2], 4), '\xd5\xd5\xd5') + + def test_alaw2lin(self): + # Cursory + d = audioop.lin2alaw(data[0], 1) + self.assertEqual(audioop.alaw2lin(d, 1), data[0]) + + def test_lin2ulaw(self): + self.assertEqual(audioop.lin2ulaw(data[0], 1), '\xff\xe7\xdb') + self.assertEqual(audioop.lin2ulaw(data[1], 2), '\xff\xff\xff') + self.assertEqual(audioop.lin2ulaw(data[2], 4), '\xff\xff\xff') + + def test_ulaw2lin(self): + # Cursory + d = audioop.lin2ulaw(data[0], 1) + self.assertEqual(audioop.ulaw2lin(d, 1), data[0]) + + def test_mul(self): + data2 = [] + for d in data: + str = '' + for s in d: + str = str + chr(ord(s)*2) + data2.append(str) + self.assertEqual(audioop.mul(data[0], 1, 2), data2[0]) + self.assertEqual(audioop.mul(data[1],2, 2), data2[1]) + self.assertEqual(audioop.mul(data[2], 4, 2), data2[2]) + + def test_ratecv(self): + state = None + d1, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) + d2, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) + self.assertEqual(d1 + d2, '\000\000\001\001\002\001\000\000\001\001\002') + + def test_reverse(self): + self.assertEqual(audioop.reverse(data[0], 1), '\2\1\0') + + def test_tomono(self): + data2 = '' + for d in data[0]: + data2 = data2 + d + d + self.assertEqual(audioop.tomono(data2, 1, 0.5, 0.5), data[0]) + + def test_tostereo(self): + data2 = '' + for d in data[0]: + data2 = data2 + d + d + self.assertEqual(audioop.tostereo(data[0], 1, 1, 1), data2) + + def test_findfactor(self): + self.assertEqual(audioop.findfactor(data[1], data[1]), 1.0) + + def test_findfit(self): + self.assertEqual(audioop.findfit(data[1], data[1]), (0, 1.0)) + + def test_findmax(self): + self.assertEqual(audioop.findmax(data[1], 1), 2) + + def test_getsample(self): + for i in range(3): + self.assertEqual(audioop.getsample(data[0], 1, i), i) + self.assertEqual(audioop.getsample(data[1], 2, i), i) + self.assertEqual(audioop.getsample(data[2], 4, i), i) +def test_main(): + run_unittest(TestAudioop) + if __name__ == '__main__': test_main() Modified: python/branches/tlee-ast-optimize/Lib/test/test_cpickle.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_cpickle.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_cpickle.py Tue Jul 1 14:28:00 2008 @@ -94,23 +94,19 @@ pass class cPickleDeepRecursive(unittest.TestCase): -# I commented out, because the patch that fixes this was reverted, as -# it broke the next test case. Check the issues for full history. -# def test_issue2702(self): -# '''This should raise a RecursionLimit but in some -# platforms (FreeBSD, win32) sometimes raises KeyError instead, -# or just silently terminates the interpreter (=crashes). -# ''' -# nodes = [Node() for i in range(500)] -# for n in nodes: -# n.connections = list(nodes) -# n.connections.remove(n) -# self.assertRaises(RuntimeError, cPickle.dumps, n) + def test_issue2702(self): + # This should raise a RecursionLimit but in some + # platforms (FreeBSD, win32) sometimes raises KeyError instead, + # or just silently terminates the interpreter (=crashes). + nodes = [Node() for i in range(500)] + for n in nodes: + n.connections = list(nodes) + n.connections.remove(n) + self.assertRaises(RuntimeError, cPickle.dumps, n) def test_issue3179(self): - '''Safe test, because of I broken this case when fixing the - behaviour for the previous test. - ''' + # Safe test, because I broke this case when fixing the + # behaviour for the previous test. res=[] for x in range(1,2000): res.append(dict(doc=x, similar=[])) Modified: python/branches/tlee-ast-optimize/Lib/test/test_fractions.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_fractions.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_fractions.py Tue Jul 1 14:28:00 2008 @@ -351,6 +351,10 @@ def testStringification(self): self.assertEquals("Fraction(7, 3)", repr(F(7, 3))) + self.assertEquals("Fraction(6283185307, 2000000000)", + repr(F('3.1415926535'))) + self.assertEquals("Fraction(-1, 100000000000000000000)", + repr(F(1, -10**20))) self.assertEquals("7/3", str(F(7, 3))) self.assertEquals("7", str(F(7, 1))) Modified: python/branches/tlee-ast-optimize/Lib/test/test_ssl.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_ssl.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_ssl.py Tue Jul 1 14:28:00 2008 @@ -3,7 +3,9 @@ import sys import unittest from test import test_support +import asyncore import socket +import select import errno import subprocess import time @@ -97,8 +99,7 @@ if (d1 != d2): raise test_support.TestFailed("PEM-to-DER or DER-to-PEM translation failed") - -class NetworkTests(unittest.TestCase): +class NetworkedTests(unittest.TestCase): def testConnect(self): s = ssl.wrap_socket(socket.socket(socket.AF_INET), @@ -130,6 +131,31 @@ finally: s.close() + + def testNonBlockingHandshake(self): + s = socket.socket(socket.AF_INET) + s.connect(("svn.python.org", 443)) + s.setblocking(False) + s = ssl.wrap_socket(s, + cert_reqs=ssl.CERT_NONE, + do_handshake_on_connect=False) + count = 0 + while True: + try: + count += 1 + s.do_handshake() + break + except ssl.SSLError, err: + if err.args[0] == ssl.SSL_ERROR_WANT_READ: + select.select([s], [], []) + elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE: + select.select([], [s], []) + else: + raise + s.close() + if test_support.verbose: + sys.stdout.write("\nNeeded %d calls to do_handshake() to establish session.\n" % count) + def testFetchServerCert(self): pem = ssl.get_server_certificate(("svn.python.org", 443)) @@ -176,6 +202,18 @@ threading.Thread.__init__(self) self.setDaemon(True) + def show_conn_details(self): + if self.server.certreqs == ssl.CERT_REQUIRED: + cert = self.sslconn.getpeercert() + if test_support.verbose and self.server.chatty: + sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n") + cert_binary = self.sslconn.getpeercert(True) + if test_support.verbose and self.server.chatty: + sys.stdout.write(" cert binary is " + str(len(cert_binary)) + " bytes\n") + cipher = self.sslconn.cipher() + if test_support.verbose and self.server.chatty: + sys.stdout.write(" server: connection cipher is now " + str(cipher) + "\n") + def wrap_conn (self): try: self.sslconn = ssl.wrap_socket(self.sock, server_side=True, @@ -187,6 +225,7 @@ if self.server.chatty: handle_error("\n server: bad connection attempt from " + str(self.sock.getpeername()) + ":\n") + self.close() if not self.server.expect_bad_connects: # here, we want to stop the server, because this shouldn't # happen in the context of our test case @@ -197,16 +236,6 @@ return False else: - if self.server.certreqs == ssl.CERT_REQUIRED: - cert = self.sslconn.getpeercert() - if test_support.verbose and self.server.chatty: - sys.stdout.write(" client cert is " + pprint.pformat(cert) + "\n") - cert_binary = self.sslconn.getpeercert(True) - if test_support.verbose and self.server.chatty: - sys.stdout.write(" cert binary is " + str(len(cert_binary)) + " bytes\n") - cipher = self.sslconn.cipher() - if test_support.verbose and self.server.chatty: - sys.stdout.write(" server: connection cipher is now " + str(cipher) + "\n") return True def read(self): @@ -225,13 +254,16 @@ if self.sslconn: self.sslconn.close() else: - self.sock.close() + self.sock._sock.close() def run (self): self.running = True if not self.server.starttls_server: - if not self.wrap_conn(): + if isinstance(self.sock, ssl.SSLSocket): + self.sslconn = self.sock + elif not self.wrap_conn(): return + self.show_conn_details() while self.running: try: msg = self.read() @@ -270,7 +302,9 @@ def __init__(self, certificate, ssl_version=None, certreqs=None, cacerts=None, expect_bad_connects=False, - chatty=True, connectionchatty=False, starttls_server=False): + chatty=True, connectionchatty=False, starttls_server=False, + wrap_accepting_socket=False): + if ssl_version is None: ssl_version = ssl.PROTOCOL_TLSv1 if certreqs is None: @@ -284,8 +318,16 @@ self.connectionchatty = connectionchatty self.starttls_server = starttls_server self.sock = socket.socket() - self.port = test_support.bind_port(self.sock) self.flag = None + if wrap_accepting_socket: + self.sock = ssl.wrap_socket(self.sock, server_side=True, + certfile=self.certificate, + cert_reqs = self.certreqs, + ca_certs = self.cacerts, + ssl_version = self.protocol) + if test_support.verbose and self.chatty: + sys.stdout.write(' server: wrapped server socket as %s\n' % str(self.sock)) + self.port = test_support.bind_port(self.sock) self.active = False threading.Thread.__init__(self) self.setDaemon(False) @@ -316,13 +358,87 @@ except: if self.chatty: handle_error("Test server failure:\n") + self.sock.close() def stop (self): self.active = False - self.sock.close() + class AsyncoreEchoServer(threading.Thread): + + class EchoServer (asyncore.dispatcher): + + class ConnectionHandler (asyncore.dispatcher_with_send): + + def __init__(self, conn, certfile): + asyncore.dispatcher_with_send.__init__(self, conn) + self.socket = ssl.wrap_socket(conn, server_side=True, + certfile=certfile, + do_handshake_on_connect=True) + + def readable(self): + if isinstance(self.socket, ssl.SSLSocket): + while self.socket.pending() > 0: + self.handle_read_event() + return True + + def handle_read(self): + data = self.recv(1024) + self.send(data.lower()) + + def handle_close(self): + self.close() + if test_support.verbose: + sys.stdout.write(" server: closed connection %s\n" % self.socket) + + def handle_error(self): + raise + + def __init__(self, certfile): + self.certfile = certfile + asyncore.dispatcher.__init__(self) + self.create_socket(socket.AF_INET, socket.SOCK_STREAM) + self.port = test_support.bind_port(self.socket) + self.listen(5) + + def handle_accept(self): + sock_obj, addr = self.accept() + if test_support.verbose: + sys.stdout.write(" server: new connection from %s:%s\n" %addr) + self.ConnectionHandler(sock_obj, self.certfile) - class AsyncoreHTTPSServer(threading.Thread): + def handle_error(self): + raise + + def __init__(self, certfile): + self.flag = None + self.active = False + self.server = self.EchoServer(certfile) + self.port = self.server.port + threading.Thread.__init__(self) + self.setDaemon(True) + + def __str__(self): + return "<%s %s>" % (self.__class__.__name__, self.server) + + def start (self, flag=None): + self.flag = flag + threading.Thread.start(self) + + def run (self): + self.active = True + if self.flag: + self.flag.set() + while self.active: + try: + asyncore.loop(1) + except: + pass + + def stop (self): + self.active = False + self.server.close() + + class SocketServerHTTPSServer(threading.Thread): class HTTPSServer(HTTPServer): @@ -335,6 +451,12 @@ self.active_lock = threading.Lock() self.allow_reuse_address = True + def __str__(self): + return ('<%s %s:%s>' % + (self.__class__.__name__, + self.server_name, + self.server_port)) + def get_request (self): # override this to wrap socket with SSL sock, addr = self.socket.accept() @@ -421,8 +543,8 @@ # we override this to suppress logging unless "verbose" if test_support.verbose: - sys.stdout.write(" server (%s, %d, %s):\n [%s] %s\n" % - (self.server.server_name, + sys.stdout.write(" server (%s:%d %s):\n [%s] %s\n" % + (self.server.server_address, self.server.server_port, self.request.cipher(), self.log_date_time_string(), @@ -440,9 +562,7 @@ self.setDaemon(True) def __str__(self): - return '<%s %s:%d>' % (self.__class__.__name__, - self.server.server_name, - self.server.server_port) + return "<%s %s>" % (self.__class__.__name__, self.server) def start (self, flag=None): self.flag = flag @@ -487,14 +607,16 @@ def serverParamsTest (certfile, protocol, certreqs, cacertsfile, client_certfile, client_protocol=None, indata="FOO\n", - chatty=True, connectionchatty=False): + chatty=True, connectionchatty=False, + wrap_accepting_socket=False): server = ThreadedEchoServer(certfile, certreqs=certreqs, ssl_version=protocol, cacerts=cacertsfile, chatty=chatty, - connectionchatty=connectionchatty) + connectionchatty=connectionchatty, + wrap_accepting_socket=wrap_accepting_socket) flag = threading.Event() server.start(flag) # wait for it to start @@ -572,7 +694,7 @@ ssl.get_protocol_name(server_protocol))) - class ConnectedTests(unittest.TestCase): + class ThreadedTests(unittest.TestCase): def testRudeShutdown(self): @@ -600,7 +722,7 @@ listener_gone.wait() try: ssl_sock = ssl.wrap_socket(s) - except socket.sslerror: + except IOError: pass else: raise test_support.TestFailed( @@ -680,6 +802,9 @@ def testMalformedCert(self): badCertTest(os.path.join(os.path.dirname(__file__) or os.curdir, "badcert.pem")) + def testWrongCert(self): + badCertTest(os.path.join(os.path.dirname(__file__) or os.curdir, + "wrongcert.pem")) def testMalformedKey(self): badCertTest(os.path.join(os.path.dirname(__file__) or os.curdir, "badkey.pem")) @@ -796,9 +921,9 @@ server.stop() server.join() - def testAsyncore(self): + def testSocketServer(self): - server = AsyncoreHTTPSServer(CERTFILE) + server = SocketServerHTTPSServer(CERTFILE) flag = threading.Event() server.start(flag) # wait for it to start @@ -810,8 +935,8 @@ d1 = open(CERTFILE, 'rb').read() d2 = '' # now fetch the same data from the HTTPS server - url = 'https://%s:%d/%s' % ( - HOST, server.port, os.path.split(CERTFILE)[1]) + url = 'https://127.0.0.1:%d/%s' % ( + server.port, os.path.split(CERTFILE)[1]) f = urllib.urlopen(url) dlen = f.info().getheader("content-length") if dlen and (int(dlen) > 0): @@ -834,6 +959,58 @@ server.stop() server.join() + def testWrappedAccept (self): + + if test_support.verbose: + sys.stdout.write("\n") + serverParamsTest(CERTFILE, ssl.PROTOCOL_SSLv23, ssl.CERT_REQUIRED, + CERTFILE, CERTFILE, ssl.PROTOCOL_SSLv23, + chatty=True, connectionchatty=True, + wrap_accepting_socket=True) + + + def testAsyncoreServer (self): + + indata = "TEST MESSAGE of mixed case\n" + + if test_support.verbose: + sys.stdout.write("\n") + server = AsyncoreEchoServer(CERTFILE) + flag = threading.Event() + server.start(flag) + # wait for it to start + flag.wait() + # try to connect + try: + try: + s = ssl.wrap_socket(socket.socket()) + s.connect(('127.0.0.1', server.port)) + except ssl.SSLError, x: + raise test_support.TestFailed("Unexpected SSL error: " + str(x)) + except Exception, x: + raise test_support.TestFailed("Unexpected exception: " + str(x)) + else: + if test_support.verbose: + sys.stdout.write( + " client: sending %s...\n" % (repr(indata))) + s.write(indata) + outdata = s.read() + if test_support.verbose: + sys.stdout.write(" client: read %s\n" % repr(outdata)) + if outdata != indata.lower(): + raise test_support.TestFailed( + "bad data <<%s>> (%d) received; expected <<%s>> (%d)\n" + % (outdata[:min(len(outdata),20)], len(outdata), + indata[:min(len(indata),20)].lower(), len(indata))) + s.write("over\n") + if test_support.verbose: + sys.stdout.write(" client: closing connection.\n") + s.close() + finally: + server.stop() + # wait for server thread to end + server.join() + def test_main(verbose=False): if skip_expected: @@ -850,15 +1027,19 @@ not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT)): raise test_support.TestFailed("Can't read certificate files!") + TESTPORT = test_support.find_unused_port() + if not TESTPORT: + raise test_support.TestFailed("Can't find open port to test servers on!") + tests = [BasicTests] if test_support.is_resource_enabled('network'): - tests.append(NetworkTests) + tests.append(NetworkedTests) if _have_threads: thread_info = test_support.threading_setup() if thread_info and test_support.is_resource_enabled('network'): - tests.append(ConnectedTests) + tests.append(ThreadedTests) test_support.run_unittest(*tests) Modified: python/branches/tlee-ast-optimize/Lib/test/test_sys.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_sys.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_sys.py Tue Jul 1 14:28:00 2008 @@ -416,7 +416,7 @@ self.P = len(struct.pack('P', 0)) # due to missing size_t information from struct, it is assumed that # sizeof(Py_ssize_t) = sizeof(void*) - self.header = 'lP' + self.header = 'PP' if hasattr(sys, "gettotalrefcount"): self.header += '2P' self.file = open(test.test_support.TESTFN, 'wb') @@ -480,7 +480,7 @@ self.check_sizeof(float(0), size(h + 'd')) # function def func(): pass - self.check_sizeof(func, size(h + '9l')) + self.check_sizeof(func, size(h + '9P')) class c(): @staticmethod def foo(): @@ -489,9 +489,9 @@ def bar(cls): pass # staticmethod - self.check_sizeof(foo, size(h + 'l')) + self.check_sizeof(foo, size(h + 'P')) # classmethod - self.check_sizeof(bar, size(h + 'l')) + self.check_sizeof(bar, size(h + 'P')) # generator def get_gen(): yield 1 self.check_sizeof(get_gen(), size(h + 'Pi2P')) @@ -502,11 +502,11 @@ # module self.check_sizeof(unittest, size(h + 'P')) # xrange - self.check_sizeof(xrange(1), size(h + '3P')) + self.check_sizeof(xrange(1), size(h + '3l')) # slice self.check_sizeof(slice(0), size(h + '3P')) - h += 'l' + h += 'P' # new-style class class class_newstyle(object): def method(): @@ -520,12 +520,9 @@ h = self.header size = self.calcsize # dict - self.check_sizeof({}, size(h + '3P3P') + 8*size('P2P')) + self.check_sizeof({}, size(h + '3P2P') + 8*size('P2P')) longdict = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8} - self.check_sizeof(longdict, size(h + '3P3P') + (8+16)*size('P2P')) - # list - self.check_sizeof([], size(h + 'lPP')) - self.check_sizeof([1, 2, 3], size(h + 'lPP') + 3*self.P) + self.check_sizeof(longdict, size(h + '3P2P') + (8+16)*size('P2P')) # unicode usize = len(u'\0'.encode('unicode-internal')) samples = [u'', u'1'*100] @@ -544,7 +541,10 @@ finally: self.check_sizeof(s, basicsize + sys.getsizeof(str(s))) - h += 'l' + h += 'P' + # list + self.check_sizeof([], size(h + 'PP')) + self.check_sizeof([1, 2, 3], size(h + 'PP') + 3*self.P) # long self.check_sizeof(0L, size(h + 'H')) self.check_sizeof(1L, size(h + 'H')) Modified: python/branches/tlee-ast-optimize/Lib/test/test_threading_local.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_threading_local.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_threading_local.py Tue Jul 1 14:28:00 2008 @@ -42,6 +42,32 @@ deadlist = [weak for weak in weaklist if weak() is None] self.assert_(len(deadlist) in (n-1, n), (n, len(deadlist))) + def test_derived(self): + # Issue 3088: if there is a threads switch inside the __init__ + # of a threading.local derived class, the per-thread dictionary + # is created but not correctly set on the object. + # The first member set may be bogus. + import time + class Local(threading.local): + def __init__(self): + time.sleep(0.01) + local = Local() + + def f(i): + local.x = i + # Simply check that the variable is correctly set + self.assertEqual(local.x, i) + + threads= [] + for i in range(10): + t = threading.Thread(target=f, args=(i,)) + t.start() + threads.append(t) + + for t in threads: + t.join() + + def test_main(): suite = unittest.TestSuite() suite.addTest(DocTestSuite('_threading_local')) Modified: python/branches/tlee-ast-optimize/Lib/test/test_warnings.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_warnings.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_warnings.py Tue Jul 1 14:28:00 2008 @@ -301,6 +301,21 @@ warning_tests.__name__ = module_name sys.argv = argv + def test_warn_explicit_type_errors(self): + # warn_explicit() shoud error out gracefully if it is given objects + # of the wrong types. + # lineno is expected to be an integer. + self.assertRaises(TypeError, self.module.warn_explicit, + None, UserWarning, None, None) + # Either 'message' needs to be an instance of Warning or 'category' + # needs to be a subclass. + self.assertRaises(TypeError, self.module.warn_explicit, + None, None, None, 1) + # 'registry' must be a dict or None. + self.assertRaises((TypeError, AttributeError), + self.module.warn_explicit, + None, Warning, None, 1, registry=42) + class CWarnTests(BaseTest, WarnTests): Modified: python/branches/tlee-ast-optimize/Lib/warnings.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/warnings.py (original) +++ python/branches/tlee-ast-optimize/Lib/warnings.py Tue Jul 1 14:28:00 2008 @@ -202,6 +202,7 @@ def warn_explicit(message, category, filename, lineno, module=None, registry=None, module_globals=None): + lineno = int(lineno) if module is None: module = filename or "" if module[-3:].lower() == ".py": Modified: python/branches/tlee-ast-optimize/Misc/ACKS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/ACKS (original) +++ python/branches/tlee-ast-optimize/Misc/ACKS Tue Jul 1 14:28:00 2008 @@ -88,6 +88,7 @@ Tom Bridgman Richard Brodie Daniel Brotsky +Jean Brouwers Gary S. Brown Oleg Broytmann Dave Brueck Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Tue Jul 1 14:28:00 2008 @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #3088: Corrected a race condition in classes derived from + threading.local: the first member set by a thread could be saved in + another thread's dictionary. + - Issue #3004: Minor change to slice.indices(): the start and stop arguments are now treated identically, making the behaviour easier to describe and understand. For example, slice(None, -10, @@ -17,6 +21,11 @@ slice(None, 10, -1).indices(10) returns (9, 9, -1) instead of (9, 10, -1). +Build +----- + +- Issue #3215: Build sqlite3 as sqlite3.dll, not sqlite3.pyd. + What's New in Python 2.6 beta 1? ================================ @@ -25,6 +34,11 @@ Core and Builtins ----------------- +- Issue #3211: warnings.warn_explicit() did not guard against its 'registry' + argument being anything other than a dict or None. Also fixed a bug in error + handling when 'message' and 'category' were both set to None, triggering a + bus error. + - Issue #3100: Corrected a crash on deallocation of a subclassed weakref which holds the last (strong) reference to its referent. @@ -102,6 +116,9 @@ Library ------- +- logging.config: Removed out-of-date comment in _install_handlers and + used issubclass in place of equality comparison of classes. + - Issue #2722: Now the os.getcwd() supports very long path names. - Issue #2888: Fixed the behaviour of pprint when working with nested Modified: python/branches/tlee-ast-optimize/Modules/_ssl.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_ssl.c (original) +++ python/branches/tlee-ast-optimize/Modules/_ssl.c Tue Jul 1 14:28:00 2008 @@ -2,14 +2,15 @@ SSL support based on patches by Brian E Gallew and Laszlo Kovacs. Re-worked a bit by Bill Janssen to add server-side support and - certificate decoding. + certificate decoding. Chris Stawarz contributed some non-blocking + patches. This module is imported by ssl.py. It should *not* be used directly. XXX should partial writes be enabled, SSL_MODE_ENABLE_PARTIAL_WRITE? - XXX what about SSL_MODE_AUTO_RETRY + XXX what about SSL_MODE_AUTO_RETRY? */ #include "Python.h" @@ -265,8 +266,6 @@ PySSLObject *self; char *errstr = NULL; int ret; - int err; - int sockstate; int verification_mode; self = PyObject_New(PySSLObject, &PySSL_Type); /* Create new object */ @@ -388,57 +387,6 @@ SSL_set_accept_state(self->ssl); PySSL_END_ALLOW_THREADS - /* Actually negotiate SSL connection */ - /* XXX If SSL_connect() returns 0, it's also a failure. */ - sockstate = 0; - do { - PySSL_BEGIN_ALLOW_THREADS - if (socket_type == PY_SSL_CLIENT) - ret = SSL_connect(self->ssl); - else - ret = SSL_accept(self->ssl); - err = SSL_get_error(self->ssl, ret); - PySSL_END_ALLOW_THREADS - if(PyErr_CheckSignals()) { - goto fail; - } - if (err == SSL_ERROR_WANT_READ) { - sockstate = check_socket_and_wait_for_timeout(Sock, 0); - } else if (err == SSL_ERROR_WANT_WRITE) { - sockstate = check_socket_and_wait_for_timeout(Sock, 1); - } else { - sockstate = SOCKET_OPERATION_OK; - } - if (sockstate == SOCKET_HAS_TIMED_OUT) { - PyErr_SetString(PySSLErrorObject, - ERRSTR("The connect operation timed out")); - goto fail; - } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { - PyErr_SetString(PySSLErrorObject, - ERRSTR("Underlying socket has been closed.")); - goto fail; - } else if (sockstate == SOCKET_TOO_LARGE_FOR_SELECT) { - PyErr_SetString(PySSLErrorObject, - ERRSTR("Underlying socket too large for select().")); - goto fail; - } else if (sockstate == SOCKET_IS_NONBLOCKING) { - break; - } - } while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE); - if (ret < 1) { - PySSL_SetError(self, ret, __FILE__, __LINE__); - goto fail; - } - self->ssl->debug = 1; - - PySSL_BEGIN_ALLOW_THREADS - if ((self->peer_cert = SSL_get_peer_certificate(self->ssl))) { - X509_NAME_oneline(X509_get_subject_name(self->peer_cert), - self->server, X509_NAME_MAXLEN); - X509_NAME_oneline(X509_get_issuer_name(self->peer_cert), - self->issuer, X509_NAME_MAXLEN); - } - PySSL_END_ALLOW_THREADS self->Socket = Sock; Py_INCREF(self->Socket); return self; @@ -488,6 +436,65 @@ /* SSL object methods */ +static PyObject *PySSL_SSLdo_handshake(PySSLObject *self) +{ + int ret; + int err; + int sockstate; + + /* Actually negotiate SSL connection */ + /* XXX If SSL_do_handshake() returns 0, it's also a failure. */ + sockstate = 0; + do { + PySSL_BEGIN_ALLOW_THREADS + ret = SSL_do_handshake(self->ssl); + err = SSL_get_error(self->ssl, ret); + PySSL_END_ALLOW_THREADS + if(PyErr_CheckSignals()) { + return NULL; + } + if (err == SSL_ERROR_WANT_READ) { + sockstate = check_socket_and_wait_for_timeout(self->Socket, 0); + } else if (err == SSL_ERROR_WANT_WRITE) { + sockstate = check_socket_and_wait_for_timeout(self->Socket, 1); + } else { + sockstate = SOCKET_OPERATION_OK; + } + if (sockstate == SOCKET_HAS_TIMED_OUT) { + PyErr_SetString(PySSLErrorObject, + ERRSTR("The handshake operation timed out")); + return NULL; + } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { + PyErr_SetString(PySSLErrorObject, + ERRSTR("Underlying socket has been closed.")); + return NULL; + } else if (sockstate == SOCKET_TOO_LARGE_FOR_SELECT) { + PyErr_SetString(PySSLErrorObject, + ERRSTR("Underlying socket too large for select().")); + return NULL; + } else if (sockstate == SOCKET_IS_NONBLOCKING) { + break; + } + } while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE); + if (ret < 1) + return PySSL_SetError(self, ret, __FILE__, __LINE__); + self->ssl->debug = 1; + + if (self->peer_cert) + X509_free (self->peer_cert); + PySSL_BEGIN_ALLOW_THREADS + if ((self->peer_cert = SSL_get_peer_certificate(self->ssl))) { + X509_NAME_oneline(X509_get_subject_name(self->peer_cert), + self->server, X509_NAME_MAXLEN); + X509_NAME_oneline(X509_get_issuer_name(self->peer_cert), + self->issuer, X509_NAME_MAXLEN); + } + PySSL_END_ALLOW_THREADS + + Py_INCREF(Py_None); + return Py_None; +} + static PyObject * PySSL_server(PySSLObject *self) { @@ -1127,7 +1134,9 @@ rc = select(s->sock_fd+1, &fds, NULL, NULL, &tv); PySSL_END_ALLOW_THREADS +#ifdef HAVE_POLL normal_return: +#endif /* Return SOCKET_TIMED_OUT on timeout, SOCKET_OPERATION_OK otherwise (when we are able to write or when there's something to read) */ return rc == 0 ? SOCKET_HAS_TIMED_OUT : SOCKET_OPERATION_OK; @@ -1140,10 +1149,16 @@ int count; int sockstate; int err; + int nonblocking; if (!PyArg_ParseTuple(args, "s#:write", &data, &count)) return NULL; + /* just in case the blocking state of the socket has been changed */ + nonblocking = (self->Socket->sock_timeout >= 0.0); + BIO_set_nbio(SSL_get_rbio(self->ssl), nonblocking); + BIO_set_nbio(SSL_get_wbio(self->ssl), nonblocking); + sockstate = check_socket_and_wait_for_timeout(self->Socket, 1); if (sockstate == SOCKET_HAS_TIMED_OUT) { PyErr_SetString(PySSLErrorObject, @@ -1200,6 +1215,25 @@ Writes the string s into the SSL object. Returns the number\n\ of bytes written."); +static PyObject *PySSL_SSLpending(PySSLObject *self) +{ + int count = 0; + + PySSL_BEGIN_ALLOW_THREADS + count = SSL_pending(self->ssl); + PySSL_END_ALLOW_THREADS + if (count < 0) + return PySSL_SetError(self, count, __FILE__, __LINE__); + else + return PyInt_FromLong(count); +} + +PyDoc_STRVAR(PySSL_SSLpending_doc, +"pending() -> count\n\ +\n\ +Returns the number of already decrypted bytes available for read,\n\ +pending on the connection.\n"); + static PyObject *PySSL_SSLread(PySSLObject *self, PyObject *args) { PyObject *buf; @@ -1207,6 +1241,7 @@ int len = 1024; int sockstate; int err; + int nonblocking; if (!PyArg_ParseTuple(args, "|i:read", &len)) return NULL; @@ -1214,6 +1249,11 @@ if (!(buf = PyString_FromStringAndSize((char *) 0, len))) return NULL; + /* just in case the blocking state of the socket has been changed */ + nonblocking = (self->Socket->sock_timeout >= 0.0); + BIO_set_nbio(SSL_get_rbio(self->ssl), nonblocking); + BIO_set_nbio(SSL_get_wbio(self->ssl), nonblocking); + /* first check if there are bytes ready to be read */ PySSL_BEGIN_ALLOW_THREADS count = SSL_pending(self->ssl); @@ -1232,9 +1272,18 @@ Py_DECREF(buf); return NULL; } else if (sockstate == SOCKET_HAS_BEEN_CLOSED) { - /* should contain a zero-length string */ - _PyString_Resize(&buf, 0); - return buf; + if (SSL_get_shutdown(self->ssl) != + SSL_RECEIVED_SHUTDOWN) + { + Py_DECREF(buf); + PyErr_SetString(PySSLErrorObject, + "Socket closed without SSL shutdown handshake"); + return NULL; + } else { + /* should contain a zero-length string */ + _PyString_Resize(&buf, 0); + return buf; + } } } do { @@ -1285,16 +1334,54 @@ \n\ Read up to len bytes from the SSL socket."); +static PyObject *PySSL_SSLshutdown(PySSLObject *self) +{ + int err; + + /* Guard against closed socket */ + if (self->Socket->sock_fd < 0) { + PyErr_SetString(PySSLErrorObject, + "Underlying socket has been closed."); + return NULL; + } + + PySSL_BEGIN_ALLOW_THREADS + err = SSL_shutdown(self->ssl); + if (err == 0) { + /* we need to call it again to finish the shutdown */ + err = SSL_shutdown(self->ssl); + } + PySSL_END_ALLOW_THREADS + + if (err < 0) + return PySSL_SetError(self, err, __FILE__, __LINE__); + else { + Py_INCREF(self->Socket); + return (PyObject *) (self->Socket); + } +} + +PyDoc_STRVAR(PySSL_SSLshutdown_doc, +"shutdown(s) -> socket\n\ +\n\ +Does the SSL shutdown handshake with the remote end, and returns\n\ +the underlying socket object."); + static PyMethodDef PySSLMethods[] = { + {"do_handshake", (PyCFunction)PySSL_SSLdo_handshake, METH_NOARGS}, {"write", (PyCFunction)PySSL_SSLwrite, METH_VARARGS, PySSL_SSLwrite_doc}, {"read", (PyCFunction)PySSL_SSLread, METH_VARARGS, PySSL_SSLread_doc}, + {"pending", (PyCFunction)PySSL_SSLpending, METH_NOARGS, + PySSL_SSLpending_doc}, {"server", (PyCFunction)PySSL_server, METH_NOARGS}, {"issuer", (PyCFunction)PySSL_issuer, METH_NOARGS}, {"peer_certificate", (PyCFunction)PySSL_peercert, METH_VARARGS, PySSL_peercert_doc}, {"cipher", (PyCFunction)PySSL_cipher, METH_NOARGS}, + {"shutdown", (PyCFunction)PySSL_SSLshutdown, METH_NOARGS, + PySSL_SSLshutdown_doc}, {NULL, NULL} }; Modified: python/branches/tlee-ast-optimize/Modules/cPickle.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cPickle.c (original) +++ python/branches/tlee-ast-optimize/Modules/cPickle.c Tue Jul 1 14:28:00 2008 @@ -339,7 +339,6 @@ int bin; int fast; /* Fast mode doesn't save in memo, don't use if circ ref */ - int nesting; int (*write_func)(struct Picklerobject *, const char *, Py_ssize_t); char *write_buf; int buf_size; @@ -1630,7 +1629,12 @@ iter = PyObject_GetIter(args); if (iter == NULL) goto finally; - res = batch_list(self, iter); + + if (Py_EnterRecursiveCall(" while pickling an object") == 0) + { + res = batch_list(self, iter); + Py_LeaveRecursiveCall(); + } Py_DECREF(iter); finally: @@ -1786,7 +1790,11 @@ iter = PyObject_CallMethod(args, "iteritems", "()"); if (iter == NULL) goto finally; - res = batch_dict(self, iter); + if (Py_EnterRecursiveCall(" while pickling an object") == 0) + { + res = batch_dict(self, iter); + Py_LeaveRecursiveCall(); + } Py_DECREF(iter); finally: @@ -2306,11 +2314,8 @@ int res = -1; int tmp, size; - if (self->nesting++ > Py_GetRecursionLimit()){ - PyErr_SetString(PyExc_RuntimeError, - "maximum recursion depth exceeded"); - goto finally; - } + if (Py_EnterRecursiveCall(" while pickling an object")) + return -1; if (!pers_save && self->pers_func) { if ((tmp = save_pers(self, args, self->pers_func)) != 0) { @@ -2559,7 +2564,7 @@ res = save_reduce(self, t, args); finally: - self->nesting--; + Py_LeaveRecursiveCall(); Py_XDECREF(py_ob_id); Py_XDECREF(__reduce__); Py_XDECREF(t); @@ -2801,7 +2806,6 @@ self->inst_pers_func = NULL; self->write_buf = NULL; self->fast = 0; - self->nesting = 0; self->fast_container = 0; self->fast_memo = NULL; self->buf_size = 0; Modified: python/branches/tlee-ast-optimize/Modules/threadmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/threadmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/threadmodule.c Tue Jul 1 14:28:00 2008 @@ -293,7 +293,10 @@ } } - else if (self->dict != ldict) { + + /* The call to tp_init above may have caused another thread to run. + Install our ldict again. */ + if (self->dict != ldict) { Py_CLEAR(self->dict); Py_INCREF(ldict); self->dict = ldict; Modified: python/branches/tlee-ast-optimize/Objects/dictobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/dictobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/dictobject.c Tue Jul 1 14:28:00 2008 @@ -1253,7 +1253,7 @@ PyObject *key; long hash; - if (dictresize(mp, PySet_GET_SIZE(seq))) + if (dictresize(mp, Py_SIZE(seq))) return NULL; while (_PyDict_Next(seq, &pos, &key, &oldvalue, &hash)) { @@ -2037,7 +2037,7 @@ { Py_ssize_t res; - res = sizeof(PyDictObject) + sizeof(mp->ma_table); + res = sizeof(PyDictObject); if (mp->ma_table != mp->ma_smalltable) res = res + (mp->ma_mask + 1) * sizeof(PyDictEntry); return PyInt_FromSsize_t(res); Modified: python/branches/tlee-ast-optimize/PCbuild/_bsddb.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/_bsddb.vcproj (original) +++ python/branches/tlee-ast-optimize/PCbuild/_bsddb.vcproj Tue Jul 1 14:28:00 2008 @@ -43,6 +43,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Deleted: python/branches/tlee-ast-optimize/PCbuild/_bsddb44.vcproj ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/_bsddb44.vcproj Tue Jul 1 14:28:00 2008 +++ (empty file) @@ -1,1252 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modified: python/branches/tlee-ast-optimize/PCbuild/pcbuild.sln ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/pcbuild.sln (original) +++ python/branches/tlee-ast-optimize/PCbuild/pcbuild.sln Tue Jul 1 14:28:00 2008 @@ -41,7 +41,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb", "_bsddb.vcproj", "{B4D38F3F-68FB-42EC-A45D-E00657BB3627}" ProjectSection(ProjectDependencies) = postProject {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - {62172C7D-B39E-409A-B352-370FF5098C19} = {62172C7D-B39E-409A-B352-370FF5098C19} {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} EndProjectSection EndProject @@ -121,11 +120,6 @@ {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_bsddb44", "_bsddb44.vcproj", "{62172C7D-B39E-409A-B352-370FF5098C19}" - ProjectSection(ProjectDependencies) = postProject - {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}" ProjectSection(ProjectDependencies) = postProject {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} = {6DE10744-E396-40A5-B4E2-1B69AA7C8D31} @@ -510,22 +504,6 @@ {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|Win32.Build.0 = Release|Win32 {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.ActiveCfg = Release|x64 {447F05A8-F581-4CAC-A466-5AC7936E207E}.Release|x64.Build.0 = Release|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.ActiveCfg = Debug|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|Win32.Build.0 = Debug|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.ActiveCfg = Debug|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Debug|x64.Build.0 = Debug|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGInstrument|x64.Build.0 = PGInstrument|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.PGUpdate|x64.Build.0 = PGUpdate|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.ActiveCfg = Release|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|Win32.Build.0 = Release|Win32 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.ActiveCfg = Release|x64 - {62172C7D-B39E-409A-B352-370FF5098C19}.Release|x64.Build.0 = Release|x64 {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.ActiveCfg = Debug|Win32 {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|Win32.Build.0 = Debug|Win32 {A1A295E5-463C-437F-81CA-1F32367685DA}.Debug|x64.ActiveCfg = Debug|x64 Modified: python/branches/tlee-ast-optimize/PCbuild/pyproject.vsprops ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/pyproject.vsprops (original) +++ python/branches/tlee-ast-optimize/PCbuild/pyproject.vsprops Tue Jul 1 14:28:00 2008 @@ -50,11 +50,11 @@ /> &5 +echo $ECHO_N "checking for long double support... $ECHO_C" >&6; } +have_long_double=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +long double x; x = (long double)0.; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LONG_DOUBLE 1 +_ACEOF + + have_long_double=yes + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $have_long_double" >&5 +echo "${ECHO_T}$have_long_double" >&6; } +if test "$have_long_double" = yes ; then +{ echo "$as_me:$LINENO: checking for long double" >&5 +echo $ECHO_N "checking for long double... $ECHO_C" >&6; } +if test "${ac_cv_type_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef long double ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_long_double=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_double=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5 +echo "${ECHO_T}$ac_cv_type_long_double" >&6; } + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ echo "$as_me:$LINENO: checking size of long double" >&5 +echo $ECHO_N "checking size of long double... $ECHO_C" >&6; } +if test "${ac_cv_sizeof_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo= ac_hi= +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +int +main () +{ +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_lo=`expr '(' $ac_mid ')' + 1` +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long_double=$ac_lo;; +'') if test "$ac_cv_type_long_double" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_long_double=0 + fi ;; +esac +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + typedef long double ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (((long int) (sizeof (ac__type_sizeof_))) < 0) + { + long int i = longval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%ld\n", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ((long int) (sizeof (ac__type_sizeof_)))) + return 1; + fprintf (f, "%lu\n", i); + } + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long_double=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_long_double" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long double) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_long_double=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_double" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_double" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double +_ACEOF + + +fi + { echo "$as_me:$LINENO: checking for _Bool support" >&5 echo $ECHO_N "checking for _Bool support... $ECHO_C" >&6; } have_c99_bool=no Modified: python/branches/tlee-ast-optimize/configure.in ============================================================================== --- python/branches/tlee-ast-optimize/configure.in (original) +++ python/branches/tlee-ast-optimize/configure.in Tue Jul 1 14:28:00 2008 @@ -1328,7 +1328,7 @@ have_long_double=yes ]) AC_MSG_RESULT($have_long_double) -if test "$have_long_long" = yes ; then +if test "$have_long_double" = yes ; then AC_CHECK_SIZEOF(long double, 12) fi Modified: python/branches/tlee-ast-optimize/pyconfig.h.in ============================================================================== --- python/branches/tlee-ast-optimize/pyconfig.h.in (original) +++ python/branches/tlee-ast-optimize/pyconfig.h.in Tue Jul 1 14:28:00 2008 @@ -384,6 +384,9 @@ /* Define to 1 if you have the `log1p' function. */ #undef HAVE_LOG1P +/* Define this if you have the type long double. */ +#undef HAVE_LONG_DOUBLE + /* Define this if you have the type long long. */ #undef HAVE_LONG_LONG @@ -887,6 +890,9 @@ /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG +/* The size of `long double', as computed by sizeof. */ +#undef SIZEOF_LONG_DOUBLE + /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG Modified: python/branches/tlee-ast-optimize/setup.py ============================================================================== --- python/branches/tlee-ast-optimize/setup.py (original) +++ python/branches/tlee-ast-optimize/setup.py Tue Jul 1 14:28:00 2008 @@ -1258,6 +1258,17 @@ HAVE_BROKEN_SEM_UNLINK=1 ) libraries = [] + + elif platform in ('freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'): + # FreeBSD's P1003.1b semaphore support is very experimental + # and has many known problems. (as of June 2008) + macros = dict( # FreeBSD + HAVE_SEM_OPEN=0, + HAVE_SEM_TIMEDWAIT=0, + HAVE_FD_TRANSFER=1, + ) + libraries = [] + else: # Linux and other unices macros = dict( HAVE_SEM_OPEN=1, From python-checkins at python.org Tue Jul 1 16:34:13 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 1 Jul 2008 16:34:13 +0200 (CEST) Subject: [Python-checkins] r64613 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080701143413.8A9031E4002@bag.python.org> Author: guilherme.polo Date: Tue Jul 1 16:33:39 2008 New Revision: 64613 Log: Not worth adding the possibility to remove custom options, it requires creating a new layout every time; Empty _current_options after running pack_forget on every widget; Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Tue Jul 1 16:33:39 2008 @@ -6,8 +6,6 @@ # XXX ToDo List: # * Save/Load style changes, maybe. -# * Add a way to remove options (only custom options): -# - Not possible in tk, but could recreate the widget and not set it. # * Add a way to edit images/elements. # * Add pre-defined elements for the current theme: # - Just after editing elements feature is added. @@ -480,6 +478,7 @@ # remove previous widgets for widget in self._current_options: widget.pack_forget() + self._current_options = [] def _update_style_configframe(self): """Update the configure frame for the current widget.""" @@ -515,13 +514,14 @@ return True lbl = ttk.Label(frame, text=opt_name) + lbl.pack(side='top', anchor='w') entry = ttk.Entry(frame) entry.insert(0, opt_value) entry.configure(validate='key', validatecommand=(self.master.register(change_opt), opt_name, '%P')) entry.validate() - lbl.pack(side='top', anchor='w') entry.pack(side='top', fill='x', pady=3) + self._current_options = self._current_options or [] self._current_options.extend([lbl, entry]) From python-checkins at python.org Tue Jul 1 16:41:03 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 1 Jul 2008 16:41:03 +0200 (CEST) Subject: [Python-checkins] r64614 - sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py Message-ID: <20080701144103.54EE01E400A@bag.python.org> Author: guilherme.polo Date: Tue Jul 1 16:41:03 2008 New Revision: 64614 Log: page_names may remain as None if they aren't specified, fixed Modified: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py Modified: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py Tue Jul 1 16:41:03 2008 @@ -34,6 +34,7 @@ Notebook.__init__(self, master, **kw) self.pages = {} + page_names = page_names or () for name in page_names: self.add_page(name) From buildbot at python.org Tue Jul 1 17:37:28 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 15:37:28 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080701153728.D60F51E4002@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1065 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,mark.summerfield BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jul 1 21:15:41 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 19:15:41 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080701191541.F38291E400D@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/563 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,mark.summerfield BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 352, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 375, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 330, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/urllib/request.py", line 1100, in unknown_open raise urllib.error.URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jul 1 21:34:53 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 1 Jul 2008 21:34:53 +0200 (CEST) Subject: [Python-checkins] r64622 - in python/trunk: Lib/test/test_syntax.py Misc/NEWS Python/ast.c Message-ID: <20080701193453.2E9F01E4002@bag.python.org> Author: benjamin.peterson Date: Tue Jul 1 21:34:52 2008 New Revision: 64622 Log: #3219 repeated keyword arguments aren't allowed in function calls anymore Modified: python/trunk/Lib/test/test_syntax.py python/trunk/Misc/NEWS python/trunk/Python/ast.c Modified: python/trunk/Lib/test/test_syntax.py ============================================================================== --- python/trunk/Lib/test/test_syntax.py (original) +++ python/trunk/Lib/test/test_syntax.py Tue Jul 1 21:34:52 2008 @@ -417,6 +417,11 @@ ... SyntaxError: can't assign to function call (, line 6) +>>> f(a=23, a=234) +Traceback (most recent call last): + ... +SyntaxError: keyword argument repeated (, line 1) + """ import re Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jul 1 21:34:52 2008 @@ -21,6 +21,10 @@ slice(None, 10, -1).indices(10) returns (9, 9, -1) instead of (9, 10, -1). +- Issue #3219: Calling a function with repeated keyword arguments, f(a=2, a=23), + would not cause a syntax error. This was regression from 2.4 caused by the + switch to the new compiler. + Build ----- Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Tue Jul 1 21:34:52 2008 @@ -1912,6 +1912,8 @@ else { keyword_ty kw; identifier key; + int k; + char *tmp; /* CHILD(ch, 0) is test, but must be an identifier? */ e = ast_for_expr(c, CHILD(ch, 0)); @@ -1933,6 +1935,14 @@ key = e->v.Name.id; if (!forbidden_check(c, CHILD(ch, 0), PyBytes_AS_STRING(key))) return NULL; + for (k = 0; k < nkeywords; k++) { + tmp = PyString_AS_STRING( + ((keyword_ty)asdl_seq_GET(keywords, k))->arg); + if (!strcmp(tmp, PyString_AS_STRING(key))) { + ast_error(CHILD(ch, 0), "keyword argument repeated"); + return NULL; + } + } e = ast_for_expr(c, CHILD(ch, 2)); if (!e) return NULL; From python-checkins at python.org Tue Jul 1 21:51:55 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 1 Jul 2008 21:51:55 +0200 (CEST) Subject: [Python-checkins] r64623 - python/trunk/Doc/whatsnew/2.6.rst Message-ID: <20080701195155.30C261E4002@bag.python.org> Author: benjamin.peterson Date: Tue Jul 1 21:51:54 2008 New Revision: 64623 Log: write a short little section for multiprocessing; it still needs help Modified: python/trunk/Doc/whatsnew/2.6.rst Modified: python/trunk/Doc/whatsnew/2.6.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.6.rst (original) +++ python/trunk/Doc/whatsnew/2.6.rst Tue Jul 1 21:51:54 2008 @@ -526,7 +526,21 @@ PEP 371: The ``multiprocessing`` Package ===================================================== -XXX write this. +.. XXX I think this still needs help + +:mod:`multiprocessing` makes it easy to distribute work over multiple processes. +Its API is similiar to that of :mod:`threading`. For example:: + + from multiprocessing import Process + + def long_hard_task(n): + print n * 43 + + for i in range(10): + Process(target=long_hard_task, args=(i)).start() + +will multiply the numbers between 0 and 10 times 43 and print out the result +concurrently. .. seealso:: From python-checkins at python.org Tue Jul 1 21:59:00 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 Jul 2008 21:59:00 +0200 (CEST) Subject: [Python-checkins] r64625 - python/trunk/Doc/library/subprocess.rst Message-ID: <20080701195900.B455B1E4002@bag.python.org> Author: georg.brandl Date: Tue Jul 1 21:59:00 2008 New Revision: 64625 Log: Add a link to PEP 324. Modified: python/trunk/Doc/library/subprocess.rst Modified: python/trunk/Doc/library/subprocess.rst ============================================================================== --- python/trunk/Doc/library/subprocess.rst (original) +++ python/trunk/Doc/library/subprocess.rst Tue Jul 1 21:59:00 2008 @@ -23,6 +23,10 @@ Information about how the :mod:`subprocess` module can be used to replace these modules and functions can be found in the following sections. +.. seealso:: + + :pep:`324` -- PEP proposing the subprocess module + Using the subprocess Module --------------------------- From python-checkins at python.org Tue Jul 1 22:11:27 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 Jul 2008 22:11:27 +0200 (CEST) Subject: [Python-checkins] r64628 - in doctools/branches/0.4.x: CHANGES sphinx/textwriter.py Message-ID: <20080701201127.810A91E4002@bag.python.org> Author: georg.brandl Date: Tue Jul 1 22:11:27 2008 New Revision: 64628 Log: Add sub-/superscript node handling to TextBuilder. #3217. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/textwriter.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Tue Jul 1 22:11:27 2008 @@ -1,3 +1,9 @@ +Release 0.4.1 (in development) +============================== + +* Added sub-/superscript node handling to TextBuilder. + + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/sphinx/textwriter.py ============================================================================== --- doctools/branches/0.4.x/sphinx/textwriter.py (original) +++ doctools/branches/0.4.x/sphinx/textwriter.py Tue Jul 1 22:11:27 2008 @@ -571,6 +571,16 @@ def depart_literal(self, node): self.add_text('``') + def visit_subscript(self, node): + self.add_text('_') + def depart_subscript(self, node): + pass + + def visit_superscript(self, node): + self.add_text('^') + def depart_superscript(self, node): + pass + def visit_footnote_reference(self, node): self.add_text('[%s]' % node.astext()) raise nodes.SkipNode From python-checkins at python.org Tue Jul 1 22:13:15 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 Jul 2008 22:13:15 +0200 (CEST) Subject: [Python-checkins] r64629 - in doctools/trunk: sphinx/textwriter.py Message-ID: <20080701201316.05FB31E4002@bag.python.org> Author: georg.brandl Date: Tue Jul 1 22:13:15 2008 New Revision: 64629 Log: Merged revisions 64628 via svnmerge from svn+ssh://pythondev at svn.python.org/doctools/branches/0.4.x ........ r64628 | georg.brandl | 2008-07-01 22:11:27 +0200 (Tue, 01 Jul 2008) | 2 lines Add sub-/superscript node handling to TextBuilder. #3217. ........ Modified: doctools/trunk/ (props changed) doctools/trunk/sphinx/textwriter.py Modified: doctools/trunk/sphinx/textwriter.py ============================================================================== --- doctools/trunk/sphinx/textwriter.py (original) +++ doctools/trunk/sphinx/textwriter.py Tue Jul 1 22:13:15 2008 @@ -571,6 +571,16 @@ def depart_literal(self, node): self.add_text('``') + def visit_subscript(self, node): + self.add_text('_') + def depart_subscript(self, node): + pass + + def visit_superscript(self, node): + self.add_text('^') + def depart_superscript(self, node): + pass + def visit_footnote_reference(self, node): self.add_text('[%s]' % node.astext()) raise nodes.SkipNode From python-checkins at python.org Tue Jul 1 22:18:11 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 Jul 2008 22:18:11 +0200 (CEST) Subject: [Python-checkins] r64630 - python/trunk/Doc/library/msilib.rst Message-ID: <20080701201811.2FB711E400C@bag.python.org> Author: georg.brandl Date: Tue Jul 1 22:18:10 2008 New Revision: 64630 Log: #3216: fix Execute's parameter description. Modified: python/trunk/Doc/library/msilib.rst Modified: python/trunk/Doc/library/msilib.rst ============================================================================== --- python/trunk/Doc/library/msilib.rst (original) +++ python/trunk/Doc/library/msilib.rst Tue Jul 1 22:18:10 2008 @@ -1,4 +1,3 @@ - :mod:`msilib` --- Read and write Microsoft Installer files ========================================================== @@ -165,11 +164,11 @@ ------------ -.. method:: View.Execute([params=None]) +.. method:: View.Execute(params) - Execute the SQL query of the view, through :cfunc:`MSIViewExecute`. *params* is - an optional record describing actual values of the parameter tokens in the - query. + Execute the SQL query of the view, through :cfunc:`MSIViewExecute`. If + *params* is not ``None``, it is a record describing actual values of the + parameter tokens in the query. .. method:: View.GetColumnInfo(kind) From buildbot at python.org Tue Jul 1 22:21:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 20:21:43 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080701202143.D87831E4002@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/118 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_metaclass make: *** [buildbottest] Error 1 sincerely, -The Buildbot From wjcuvweaexis at yahoo.com.cn Sat Jul 5 22:28:13 2008 From: wjcuvweaexis at yahoo.com.cn (=?big5?q?=AA=EC=ACK=B9=EA=AC=EF=AA=BA=AA=F8=AA=A9=C1=A1T?=) Date: Sun, 6 Jul 2008 04:28:13 +0800 Subject: [Python-checkins] =?big5?b?qfqsULTarHa4yy6lda1uMTIwpLh+vdC2aaRK?= =?big5?b?pEa40SEh?= Message-ID: <614347.79948.bm@omp208.mail.ukl.yahoo.com> An HTML attachment was scrubbed... URL: From python-checkins at python.org Tue Jul 1 22:38:05 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 1 Jul 2008 22:38:05 +0200 (CEST) Subject: [Python-checkins] r64633 - in python/trunk: Lib/test/test_file.py Misc/NEWS Python/ceval.c Message-ID: <20080701203805.06B0B1E4002@bag.python.org> Author: amaury.forgeotdarc Date: Tue Jul 1 22:38:04 2008 New Revision: 64633 Log: #3242: fix a crash in "print", if sys.stdout is set to a custom object, whose write() method installs another sys.stdout. Will backport. Modified: python/trunk/Lib/test/test_file.py python/trunk/Misc/NEWS python/trunk/Python/ceval.c Modified: python/trunk/Lib/test/test_file.py ============================================================================== --- python/trunk/Lib/test/test_file.py (original) +++ python/trunk/Lib/test/test_file.py Tue Jul 1 22:38:04 2008 @@ -503,13 +503,31 @@ self._test_close_open_io(io_func) +class StdoutTests(unittest.TestCase): + + def test_move_stdout_on_write(self): + # Issue 3242: sys.stdout can be replaced (and freed) during a + # print statement; prevent a segfault in this case + save_stdout = sys.stdout + + class File: + def write(self, data): + if '\n' in data: + sys.stdout = save_stdout + + try: + sys.stdout = File() + print "some text" + finally: + sys.stdout = save_stdout + def test_main(): # Historically, these tests have been sloppy about removing TESTFN. # So get rid of it no matter what. try: run_unittest(AutoFileTests, OtherFileTests, FileSubclassTests, - FileThreadingTests) + FileThreadingTests, StdoutTests) finally: if os.path.exists(TESTFN): os.unlink(TESTFN) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jul 1 22:38:04 2008 @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #3242: Fix a crash inside the print statement, if sys.stdout is + set to a custom object whose write() method happens to install + another file in sys.stdout. + - Issue #3088: Corrected a race condition in classes derived from threading.local: the first member set by a thread could be saved in another thread's dictionary. Modified: python/trunk/Python/ceval.c ============================================================================== --- python/trunk/Python/ceval.c (original) +++ python/trunk/Python/ceval.c Tue Jul 1 22:38:04 2008 @@ -1617,9 +1617,11 @@ "lost sys.stdout"); } if (w != NULL) { + Py_INCREF(w); err = PyFile_WriteString("\n", w); if (err == 0) PyFile_SoftSpace(w, 0); + Py_DECREF(w); } Py_XDECREF(stream); stream = NULL; From buildbot at python.org Tue Jul 1 22:38:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 20:38:10 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080701203810.B1C631E4002@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%20trunk/builds/1685 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jul 1 22:45:09 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 Jul 2008 22:45:09 +0200 (CEST) Subject: [Python-checkins] r64635 - python/trunk/Doc/library/stdtypes.rst Message-ID: <20080701204509.97F0B1E400F@bag.python.org> Author: georg.brandl Date: Tue Jul 1 22:45:09 2008 New Revision: 64635 Log: #1523853: add note about fread(). Modified: python/trunk/Doc/library/stdtypes.rst Modified: python/trunk/Doc/library/stdtypes.rst ============================================================================== --- python/trunk/Doc/library/stdtypes.rst (original) +++ python/trunk/Doc/library/stdtypes.rst Tue Jul 1 22:45:09 2008 @@ -2058,6 +2058,10 @@ that when in non-blocking mode, less data than what was requested may be returned, even if no *size* parameter was given. + .. note:: + As this function depends of the underlying C function :cfunc:`fread`, + it resembles its behaviour in details like caching EOF and others. + .. method:: file.readline([size]) From python-checkins at python.org Tue Jul 1 22:50:02 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 Jul 2008 22:50:02 +0200 (CEST) Subject: [Python-checkins] r64638 - python/trunk/Doc/reference/expressions.rst Message-ID: <20080701205002.B90371E4002@bag.python.org> Author: georg.brandl Date: Tue Jul 1 22:50:02 2008 New Revision: 64638 Log: #1410739: add a footnote about "is" and "unusual" behavior. Modified: python/trunk/Doc/reference/expressions.rst Modified: python/trunk/Doc/reference/expressions.rst ============================================================================== --- python/trunk/Doc/reference/expressions.rst (original) +++ python/trunk/Doc/reference/expressions.rst Tue Jul 1 22:50:02 2008 @@ -1113,7 +1113,7 @@ The operators :keyword:`is` and :keyword:`is not` test for object identity: ``x is y`` is true if and only if *x* and *y* are the same object. ``x is not y`` -yields the inverse truth value. +yields the inverse truth value. [#]_ .. _booleans: @@ -1352,3 +1352,7 @@ only, but this caused surprises because people expected to be able to test a dictionary for emptiness by comparing it to ``{}``. +.. [#] Due to automatic garbage-collection, free lists, and the dynamic nature of + descriptors, you may notice seemingly unusual behaviour in certain uses of + the :keyword:`is` operator, like those involving comparisons between instance + methods, or constants. Check their documentation for more info. From python-checkins at python.org Tue Jul 1 22:52:56 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 1 Jul 2008 22:52:56 +0200 (CEST) Subject: [Python-checkins] r64639 - in python/branches/release25-maint: Lib/test/test_file.py Misc/NEWS Python/ceval.c Message-ID: <20080701205256.BB7E41E4011@bag.python.org> Author: amaury.forgeotdarc Date: Tue Jul 1 22:52:56 2008 New Revision: 64639 Log: #3242: fix a crash in "print", if sys.stdout is set to a custom object, whose write() method installs another sys.stdout. Backport of r64633 Modified: python/branches/release25-maint/Lib/test/test_file.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Python/ceval.c Modified: python/branches/release25-maint/Lib/test/test_file.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_file.py (original) +++ python/branches/release25-maint/Lib/test/test_file.py Tue Jul 1 22:52:56 2008 @@ -323,11 +323,30 @@ os.unlink(TESTFN) +class StdoutTests(unittest.TestCase): + + def test_move_stdout_on_write(self): + # Issue 3242: sys.stdout can be replaced (and freed) during a + # print statement; prevent a segfault in this case + save_stdout = sys.stdout + + class File: + def write(self, data): + if '\n' in data: + sys.stdout = save_stdout + + try: + sys.stdout = File() + print "some text" + finally: + sys.stdout = save_stdout + + def test_main(): # Historically, these tests have been sloppy about removing TESTFN. # So get rid of it no matter what. try: - run_unittest(AutoFileTests, OtherFileTests) + run_unittest(AutoFileTests, OtherFileTests, StdoutTests) finally: if os.path.exists(TESTFN): os.unlink(TESTFN) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Tue Jul 1 22:52:56 2008 @@ -12,6 +12,10 @@ Core and builtins ----------------- +- Issue #3242: Fix a crash inside the print statement, if sys.stdout is + set to a custom object whose write() method happens to install + another file in sys.stdout. + - Issue #3100: Corrected a crash on deallocation of a subclassed weakref which holds the last (strong) reference to its referent. Modified: python/branches/release25-maint/Python/ceval.c ============================================================================== --- python/branches/release25-maint/Python/ceval.c (original) +++ python/branches/release25-maint/Python/ceval.c Tue Jul 1 22:52:56 2008 @@ -1603,9 +1603,11 @@ "lost sys.stdout"); } if (w != NULL) { + Py_INCREF(w); err = PyFile_WriteString("\n", w); if (err == 0) PyFile_SoftSpace(w, 0); + Py_DECREF(w); } Py_XDECREF(stream); stream = NULL; From python-checkins at python.org Tue Jul 1 22:56:03 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 Jul 2008 22:56:03 +0200 (CEST) Subject: [Python-checkins] r64640 - python/trunk/Python/ceval.c Message-ID: <20080701205603.BFA6B1E4015@bag.python.org> Author: georg.brandl Date: Tue Jul 1 22:56:03 2008 New Revision: 64640 Log: Add a comment about incref'ing w. Modified: python/trunk/Python/ceval.c Modified: python/trunk/Python/ceval.c ============================================================================== --- python/trunk/Python/ceval.c (original) +++ python/trunk/Python/ceval.c Tue Jul 1 22:56:03 2008 @@ -1617,6 +1617,8 @@ "lost sys.stdout"); } if (w != NULL) { + /* w.write() may replace sys.stdout, so we + * have to keep our reference to it */ Py_INCREF(w); err = PyFile_WriteString("\n", w); if (err == 0) From python-checkins at python.org Tue Jul 1 22:59:50 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 1 Jul 2008 22:59:50 +0200 (CEST) Subject: [Python-checkins] r64641 - in python/branches/release25-maint: Lib/test/test_threading_local.py Misc/NEWS Modules/threadmodule.c Message-ID: <20080701205950.600801E4013@bag.python.org> Author: amaury.forgeotdarc Date: Tue Jul 1 22:59:49 2008 New Revision: 64641 Log: #Issue3088 in-progress: Race condition with instances of classes derived from threading.local: When a thread touches such an object for the first time, a new thread-local __dict__ is created, and the __init__ method is run. But a thread switch can occur here; if the other thread touches the same object, it installs another __dict__; when the first thread resumes, it updates the dictionary of the second... This is the deep cause of the failures in test_multiprocessing involving "managers" objects. Backport of r64601. Modified: python/branches/release25-maint/Lib/test/test_threading_local.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/threadmodule.c Modified: python/branches/release25-maint/Lib/test/test_threading_local.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_threading_local.py (original) +++ python/branches/release25-maint/Lib/test/test_threading_local.py Tue Jul 1 22:59:49 2008 @@ -2,6 +2,34 @@ from doctest import DocTestSuite from test import test_support +class ThreadingLocalTest(unittest.TestCase): + def test_derived(self): + # Issue 3088: if there is a threads switch inside the __init__ + # of a threading.local derived class, the per-thread dictionary + # is created but not correctly set on the object. + # The first member set may be bogus. + import threading + import time + class Local(threading.local): + def __init__(self): + time.sleep(0.01) + local = Local() + + def f(i): + local.x = i + # Simply check that the variable is correctly set + self.assertEqual(local.x, i) + + threads= [] + for i in range(10): + t = threading.Thread(target=f, args=(i,)) + t.start() + threads.append(t) + + for t in threads: + t.join() + + def test_main(): suite = DocTestSuite('_threading_local') @@ -19,6 +47,7 @@ suite.addTest(DocTestSuite('_threading_local', setUp=setUp, tearDown=tearDown) ) + suite.addTest(unittest.makeSuite(ThreadingLocalTest)) test_support.run_suite(suite) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Tue Jul 1 22:59:49 2008 @@ -16,6 +16,10 @@ set to a custom object whose write() method happens to install another file in sys.stdout. +- Issue #3088: Corrected a race condition in classes derived from + threading.local: the first member set by a thread could be saved in + another thread's dictionary. + - Issue #3100: Corrected a crash on deallocation of a subclassed weakref which holds the last (strong) reference to its referent. Modified: python/branches/release25-maint/Modules/threadmodule.c ============================================================================== --- python/branches/release25-maint/Modules/threadmodule.c (original) +++ python/branches/release25-maint/Modules/threadmodule.c Tue Jul 1 22:59:49 2008 @@ -294,7 +294,10 @@ } } - else if (self->dict != ldict) { + + /* The call to tp_init above may have caused another thread to run. + Install our ldict again. */ + if (self->dict != ldict) { Py_CLEAR(self->dict); Py_INCREF(ldict); self->dict = ldict; From python-checkins at python.org Tue Jul 1 23:02:36 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 Jul 2008 23:02:36 +0200 (CEST) Subject: [Python-checkins] r64642 - in doctools/branches/0.4.x: CHANGES sphinx/roles.py Message-ID: <20080701210236.0D38D1E4002@bag.python.org> Author: georg.brandl Date: Tue Jul 1 23:02:35 2008 New Revision: 64642 Log: #3251: label names are case insensitive. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/roles.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Tue Jul 1 23:02:35 2008 @@ -3,6 +3,9 @@ * Added sub-/superscript node handling to TextBuilder. +* Label names in references are now case-insensitive, since reST label + names are always lowercased. + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/sphinx/roles.py ============================================================================== --- doctools/branches/0.4.x/sphinx/roles.py (original) +++ doctools/branches/0.4.x/sphinx/roles.py Tue Jul 1 23:02:35 2008 @@ -175,6 +175,9 @@ # normalize whitespace in definition terms (if the term reference is # broken over a line, a newline will be in target) target = ws_re.sub(' ', target).lower() + elif typ == 'ref': + # reST label names are always lowercased + target = ws_re.sub('', target).lower() else: # remove all whitespace to avoid referencing problems target = ws_re.sub('', target) From python-checkins at python.org Tue Jul 1 23:24:55 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 1 Jul 2008 23:24:55 +0200 (CEST) Subject: [Python-checkins] r64643 - doctools/branches/0.4.x/doc/ext/autodoc.rst Message-ID: <20080701212455.8CA5B1E4002@bag.python.org> Author: georg.brandl Date: Tue Jul 1 23:24:55 2008 New Revision: 64643 Log: Add a note about decorated functions. Modified: doctools/branches/0.4.x/doc/ext/autodoc.rst Modified: doctools/branches/0.4.x/doc/ext/autodoc.rst ============================================================================== --- doctools/branches/0.4.x/doc/ext/autodoc.rst (original) +++ doctools/branches/0.4.x/doc/ext/autodoc.rst Tue Jul 1 23:24:55 2008 @@ -136,6 +136,17 @@ These work exactly like :dir:`autoclass` etc., but do not offer the options used for automatic member documentation. + .. note:: + + If you document decorated functions or methods, keep in mind that autodoc + retrieves its docstrings by importing the module and inspecting the + ``__doc__`` attribute of the given function or method. That means that if + a decorator replaces the decorated function with another, it must copy the + original ``__doc__`` to the new function. + + From Python 2.5, :func:`functools.wraps` can be used to create + well-behaved decorating functions. + There are also new config values that you can set: From buildbot at python.org Tue Jul 1 23:51:34 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 21:51:34 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080701215134.DE5411E4013@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/400 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jul 2 00:07:49 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 22:07:49 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080701220749.D7D231E4002@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1068 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_metaclass make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jul 2 00:29:37 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 22:29:37 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080701222938.136511E4002@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/325 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jul 2 00:33:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 22:33:35 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 2.5 Message-ID: <20080701223335.33A591E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%202.5/builds/511 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket ====================================================================== FAIL: testInterruptedTimeout (test.test_socket.TCPTimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/net/taipan/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socket.py", line 879, in testInterruptedTimeout self.fail("got Alarm in wrong place") AssertionError: got Alarm in wrong place sincerely, -The Buildbot From python-checkins at python.org Wed Jul 2 00:46:37 2008 From: python-checkins at python.org (brett.cannon) Date: Wed, 2 Jul 2008 00:46:37 +0200 (CEST) Subject: [Python-checkins] r64644 - peps/trunk/pep-3108.txt Message-ID: <20080701224637.AC5191E4017@bag.python.org> Author: brett.cannon Date: Wed Jul 2 00:46:37 2008 New Revision: 64644 Log: It looks like the cl module was properly handled for 2.6 already. Modified: peps/trunk/pep-3108.txt Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Wed Jul 2 00:46:37 2008 @@ -51,8 +51,8 @@ period. -Previously deprecated ---------------------- +Previously deprecated [done] +---------------------------- PEP 4 lists all modules that have been deprecated in the stdlib [#pep-0004]_. The specified motivations mirror those listed in @@ -69,7 +69,7 @@ + Documented as deprecated since Python 2.4 without an explicit reason. -* cl [done: 3.0] +* cl [done: 2.6, 3.0] + Documented as obsolete since Python 2.0 or earlier. + Interface to SGI hardware. From buildbot at python.org Wed Jul 2 00:49:16 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 01 Jul 2008 22:49:16 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI 2.5 Message-ID: <20080701224916.983331E4002@bag.python.org> The Buildbot has detected a new failure of ARM Linux EABI 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%20EABI%202.5/builds/5 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-armeabi Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Wed Jul 2 00:53:53 2008 From: python-checkins at python.org (brett.cannon) Date: Wed, 2 Jul 2008 00:53:53 +0200 (CEST) Subject: [Python-checkins] r64645 - peps/trunk/pep-3108.txt Message-ID: <20080701225353.1D5681E4002@bag.python.org> Author: brett.cannon Date: Wed Jul 2 00:53:52 2008 New Revision: 64645 Log: The urllib package has been handled for 3.0 (I think). Modified: peps/trunk/pep-3108.txt Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Wed Jul 2 00:53:52 2008 @@ -826,8 +826,8 @@ and ``tkSimpleDialog`` have no naming conflicts. -urllib package (TODO) -///////////////////// +urllib package [done: 3.0] (TODO deprecations, fixers for 2.6) +////////////////////////////////////////////////////////////// Originally this new package was to be named ``url``, but because of the common use of the name as a variable, it has been deemed better From python-checkins at python.org Wed Jul 2 00:59:36 2008 From: python-checkins at python.org (barry.warsaw) Date: Wed, 2 Jul 2008 00:59:36 +0200 (CEST) Subject: [Python-checkins] r64646 - peps/trunk/pep-0361.txt Message-ID: <20080701225936.771051E4002@bag.python.org> Author: barry.warsaw Date: Wed Jul 2 00:59:36 2008 New Revision: 64646 Log: Update planned release dates. Modified: peps/trunk/pep-0361.txt Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Wed Jul 2 00:59:36 2008 @@ -55,10 +55,11 @@ Apr 02 2008: Python 2.6a2 and 3.0a4 are released May 08 2008: Python 2.6a3 and 3.0a5 are released Jun 18 2008: Python 2.6b1 and 3.0b1 are released - Jul 02 2008: Python 2.6b2 and 3.0b2 planned - Aug 06 2008: Python 2.6rc1 and 3.0rc1 planned - Aug 20 2008: Python 2.6rc2 and 3.0rc2 planned - Sep 03 2008: Python 2.6 and 3.0 final + Jul 15 2008: Python 2.6b2 and 3.0b2 planned + Aug 23 2008: Python 2.6b3 and 3.0b3 planned + Sep 03 2008: Python 2.6rc1 and 3.0rc1 planned + Sep 17 2008: Python 2.6rc2 and 3.0rc2 planned + Oct 01 2008: Python 2.6 and 3.0 final planned Completed features for 3.0 From python-checkins at python.org Wed Jul 2 01:33:06 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 2 Jul 2008 01:33:06 +0200 (CEST) Subject: [Python-checkins] r64647 - in python/trunk/Doc: glossary.rst library/abc.rst Message-ID: <20080701233306.7CB511E4002@bag.python.org> Author: benjamin.peterson Date: Wed Jul 2 01:33:06 2008 New Revision: 64647 Log: add ABC to the glossary Modified: python/trunk/Doc/glossary.rst python/trunk/Doc/library/abc.rst Modified: python/trunk/Doc/glossary.rst ============================================================================== --- python/trunk/Doc/glossary.rst (original) +++ python/trunk/Doc/glossary.rst Wed Jul 2 01:33:06 2008 @@ -24,6 +24,14 @@ 2to3 is available in the standard library as :mod:`lib2to3`; a standalone entry point is provided as :file:`Tools/scripts/2to3`. + Abstract Base Class + Abstract Base Classes (abbreviated ABCs) complement :term:`duck-typing` by + providing a way to define interfaces when other techniques like :func:`hasattr` + would be clumsy. Python comes with many builtin ABCs for data structures + (in the :mod:`collections` module), numbers (in the :mod:`numbers` + module), and streams (in the :mod:`io` module). You can create your own + ABC with the :mod:`abc` module. + argument A value passed to a function or method, assigned to a name local to the body. A function or method may have both positional arguments and @@ -116,15 +124,16 @@ be any object with a :meth:`__hash__` function, not just integers starting from zero. Called a hash in Perl. - duck-typing + duck-typing Pythonic programming style that determines an object's type by inspection of its method or attribute signature rather than by explicit relationship to some type object ("If it looks like a duck and quacks like a duck, it must be a duck.") By emphasizing interfaces rather than specific types, well-designed code improves its flexibility by allowing polymorphic substitution. Duck-typing avoids tests using :func:`type` or - :func:`isinstance`. Instead, it typically employs :func:`hasattr` tests or - :term:`EAFP` programming. + :func:`isinstance`. (Note, however, that duck-typing can be complemented + with abstract base classes.) Instead, it typically employs :func:`hasattr` + tests or :term:`EAFP` programming. EAFP Easier to ask for forgiveness than permission. This common Python coding Modified: python/trunk/Doc/library/abc.rst ============================================================================== --- python/trunk/Doc/library/abc.rst (original) +++ python/trunk/Doc/library/abc.rst Wed Jul 2 01:33:06 2008 @@ -9,10 +9,10 @@ .. versionadded:: 2.6 -This module provides the infrastructure for defining abstract base classes -(ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this was added -to Python. (See also :pep:`3141` and the :mod:`numbers` module regarding a type -hierarchy for numbers based on ABCs.) +This module provides the infrastructure for defining :term:`abstract base +classes` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this +was added to Python. (See also :pep:`3141` and the :mod:`numbers` module +regarding a type hierarchy for numbers based on ABCs.) The :mod:`collections` module has some concrete classes that derive from ABCs; these can, of course, be further derived. In addition the From python-checkins at python.org Wed Jul 2 03:54:43 2008 From: python-checkins at python.org (barry.warsaw) Date: Wed, 2 Jul 2008 03:54:43 +0200 (CEST) Subject: [Python-checkins] r64648 - peps/trunk/pep-0361.txt Message-ID: <20080702015443.7D8531E4002@bag.python.org> Author: barry.warsaw Date: Wed Jul 2 03:54:43 2008 New Revision: 64648 Log: add link to gcal Modified: peps/trunk/pep-0361.txt Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Wed Jul 2 03:54:43 2008 @@ -61,6 +61,10 @@ Sep 17 2008: Python 2.6rc2 and 3.0rc2 planned Oct 01 2008: Python 2.6 and 3.0 final planned + See the public `Google calendar`_ + +.. `Google calendar` http://www.google.com/calendar/ical/b6v58qvojllt0i6ql654r1vh00%40group.calendar.google.com/public/basic.ics + Completed features for 3.0 From python-checkins at python.org Wed Jul 2 03:57:09 2008 From: python-checkins at python.org (brett.cannon) Date: Wed, 2 Jul 2008 03:57:09 +0200 (CEST) Subject: [Python-checkins] r64649 - in python/trunk: Doc/library/urllib.rst Lib/test/test_urllib.py Lib/test/test_urllibnet.py Lib/urllib.py Misc/NEWS Message-ID: <20080702015709.1D7EB1E4002@bag.python.org> Author: brett.cannon Date: Wed Jul 2 03:57:08 2008 New Revision: 64649 Log: Handle urllib's renaming for Python 3.0: * Deprecate urllib.urlopen() in favor of urllib2.urlopen() for 3.0. * Update docs to mention split/rename of the module and deprecation of urlopen(). Changes to lib2to3 are in a separate commit. Work is for issue #2885. Modified: python/trunk/Doc/library/urllib.rst python/trunk/Lib/test/test_urllib.py python/trunk/Lib/test/test_urllibnet.py python/trunk/Lib/urllib.py python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/urllib.rst ============================================================================== --- python/trunk/Doc/library/urllib.rst (original) +++ python/trunk/Doc/library/urllib.rst Wed Jul 2 03:57:08 2008 @@ -4,6 +4,13 @@ .. module:: urllib :synopsis: Open an arbitrary network resource by URL (requires sockets). +.. note:: + The :mod:`urllib` module has been split into parts and renamed in + Python 3.0 to :mod:`urllib.request`, :mod:`urllib.parse`, + and :mod:`urllib.error`. The :term:`2to3` tool will automatically adapt + imports when converting your sources to 3.0. + Also note that the :func:`urllib.urlopen` function has been removed in + Python 3.0 in favor of :func:`urllib2.urlopen`. .. index:: single: WWW @@ -116,6 +123,10 @@ .. versionchanged:: 2.6 Added :meth:`getcode` to returned object and support for the :envvar:`no_proxy` environment variable. + + .. deprecated:: 2.6 + The :func:`urlopen` function has been removed in Python 3.0 in favor + of :func:`urllib2.urlopen`. .. function:: urlretrieve(url[, filename[, reporthook[, data]]]) Modified: python/trunk/Lib/test/test_urllib.py ============================================================================== --- python/trunk/Lib/test/test_urllib.py (original) +++ python/trunk/Lib/test/test_urllib.py Wed Jul 2 03:57:08 2008 @@ -640,16 +640,20 @@ def test_main(): - test_support.run_unittest( - urlopen_FileTests, - urlopen_HttpTests, - urlretrieve_FileTests, - QuotingTests, - UnquotingTests, - urlencode_Tests, - Pathname_Tests, - #FTPWrapperTests, - ) + import warnings + with test_support.catch_warning(record=False): + warnings.filterwarnings('ignore', ".*urllib\.urlopen.*Python 3.0", + DeprecationWarning) + test_support.run_unittest( + urlopen_FileTests, + urlopen_HttpTests, + urlretrieve_FileTests, + QuotingTests, + UnquotingTests, + urlencode_Tests, + Pathname_Tests, + #FTPWrapperTests, + ) Modified: python/trunk/Lib/test/test_urllibnet.py ============================================================================== --- python/trunk/Lib/test/test_urllibnet.py (original) +++ python/trunk/Lib/test/test_urllibnet.py Wed Jul 2 03:57:08 2008 @@ -182,9 +182,13 @@ def test_main(): test_support.requires('network') - test_support.run_unittest(URLTimeoutTest, - urlopenNetworkTests, - urlretrieveNetworkTests) + from warnings import filterwarnings + with test_support.catch_warning(record=False): + filterwarnings('ignore', '.*urllib\.urlopen.*Python 3.0', + DeprecationWarning) + test_support.run_unittest(URLTimeoutTest, + urlopenNetworkTests, + urlretrieveNetworkTests) if __name__ == "__main__": test_main() Modified: python/trunk/Lib/urllib.py ============================================================================== --- python/trunk/Lib/urllib.py (original) +++ python/trunk/Lib/urllib.py Wed Jul 2 03:57:08 2008 @@ -28,6 +28,7 @@ import time import sys from urlparse import urljoin as basejoin +import warnings __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", @@ -69,7 +70,11 @@ # Shortcut for basic usage _urlopener = None def urlopen(url, data=None, proxies=None): - """urlopen(url [, data]) -> open file-like object""" + """Create a file-like object for the specified URL to read from.""" + from warnings import warnpy3k + warnings.warnpy3k("urllib.urlopen() has been removed in Python 3.0 in " + "favor of urllib2.urlopen()", stacklevel=2) + global _urlopener if proxies is not None: opener = FancyURLopener(proxies=proxies) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jul 2 03:57:08 2008 @@ -29,11 +29,24 @@ would not cause a syntax error. This was regression from 2.4 caused by the switch to the new compiler. + +Library +------- + +- Issue #2885 (partial): The urllib.urlopen() function has been deprecated for + removal in Python 3.0 in favor of urllib2.urlopen(). + +- Issue #2885 (partial): lib2to3 has been updated to handle the renaming of the + urllib module in Python 3.0 to urllib.request, urllib.parse, and + urllib.error. + + Build ----- - Issue #3215: Build sqlite3 as sqlite3.dll, not sqlite3.pyd. + What's New in Python 2.6 beta 1? ================================ From python-checkins at python.org Wed Jul 2 04:00:11 2008 From: python-checkins at python.org (brett.cannon) Date: Wed, 2 Jul 2008 04:00:11 +0200 (CEST) Subject: [Python-checkins] r64651 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Message-ID: <20080702020011.EE4671E4015@bag.python.org> Author: brett.cannon Date: Wed Jul 2 04:00:11 2008 New Revision: 64651 Log: Update fix_imports for urllib. Had to change the fixer itself to handle modules that are split across several renames in 3.0. Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Wed Jul 2 04:00:11 2008 @@ -272,6 +272,35 @@ 'commands': ('subprocess', ['getstatusoutput', 'getoutput']), 'UserString' : ('collections', ['UserString']), 'UserList' : ('collections', ['UserList']), + 'urllib' : ( + 'urllib.request', + ['URLOpener', 'FancyURLOpener', 'urlretrieve', + '_urlopener', 'urlcleanup'], + 'urllib.parse', + ['quote', 'quote_plus', 'unquote', 'unquote_plus', + 'urlencode', 'pathname2url', 'url2pathname'], + 'urllib.error', ['ContentTooShortError'],), + 'urllib2' : ( + 'urllib.request', + ['urlopen', 'install_opener', 'build_opener', + 'Request', 'OpenerDirector', 'BaseHandler', + 'HTTPDefaultErrorHandler', 'HTTPRedirectHandler', + 'HTTPCookieProcessor', 'ProxyHandler', + 'HTTPPasswordMgr', + 'HTTPPasswordMgrWithDefaultRealm', + 'AbstractBasicAuthHandler', + 'HTTPBasicAuthHandler', 'ProxyBasicAuthHandler', + 'AbstractDigestAuthHandler', + 'HTTPDigestAuthHander', 'ProxyDigestAuthHandler', + 'HTTPHandler', 'HTTPSHandler', 'FileHandler', + 'FTPHandler', 'CacheFTPHandler', + 'UnknownHandler'], + 'urllib.error', ['URLError', 'HTTPError'],), + 'urlparse' : ('urllib.parse', + ['urlparse', 'urlunparse', 'urlsplit', + 'urlunsplit', 'urljoin', 'urldefrag', + 'ParseResult', 'SplitResult']), + 'robotparser' : ('urllib.robotparser', ['RobotFileParser']), } @@ -281,24 +310,26 @@ def build_pattern(): bare = set() - for old_module, (new_module, members) in MAPPING.items(): - bare.add(old_module) - bare.update(members) - members = alternates(members) - yield """import_name< 'import' (module=%r - | dotted_as_names< any* module=%r any* >) > - """ % (old_module, old_module) - yield """import_from< 'from' module_name=%r 'import' - ( %s | import_as_name< %s 'as' any > | - import_as_names< any* >) > - """ % (old_module, members, members) - yield """import_from< 'from' module_name=%r 'import' star='*' > - """ % old_module - yield """import_name< 'import' - dotted_as_name< module_name=%r 'as' any > > - """ % old_module - yield """power< module_name=%r trailer< '.' %s > any* > - """ % (old_module, members) + for old_module, changes in MAPPING.items(): + changes_iter = iter(changes) + for new_module, members in zip(changes_iter, changes_iter): + bare.add(old_module) + bare.update(members) + members = alternates(members) + yield """import_name< 'import' (module=%r + | dotted_as_names< any* module=%r any* >) > + """ % (old_module, old_module) + yield """import_from< 'from' module_name=%r 'import' + ( %s | import_as_name< %s 'as' any > | + import_as_names< any* >) > + """ % (old_module, members, members) + yield """import_from< 'from' module_name=%r 'import' star='*' > + """ % old_module + yield """import_name< 'import' + dotted_as_name< module_name=%r 'as' any > > + """ % old_module + yield """power< module_name=%r trailer< '.' %s > any* > + """ % (old_module, members) yield """bare_name=%s""" % alternates(bare) @@ -328,16 +359,19 @@ star = results.get("star") if import_mod or mod_name: - new_name, members = MAPPING[(import_mod or mod_name).value] - - if import_mod: - self.replace[import_mod.value] = new_name - import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) - elif mod_name: - if star: - self.cannot_convert(node, "Cannot handle star imports.") - else: - mod_name.replace(Name(new_name, prefix=mod_name.get_prefix())) + changes = MAPPING[(import_mod or mod_name).value] + changes_iter = iter(changes) + for new_name, members in zip(changes_iter, changes_iter): + if import_mod: + self.replace[import_mod.value] = new_name + import_mod.replace(Name(new_name, + prefix=import_mod.get_prefix())) + elif mod_name: + if star: + self.cannot_convert(node, "Cannot handle star imports.") + else: + mod_name.replace(Name(new_name, + prefix=mod_name.get_prefix())) elif bare_name: bare_name = bare_name[0] new_name = self.replace.get(bare_name.value) From python-checkins at python.org Wed Jul 2 04:06:11 2008 From: python-checkins at python.org (brett.cannon) Date: Wed, 2 Jul 2008 04:06:11 +0200 (CEST) Subject: [Python-checkins] r64652 - peps/trunk/pep-3108.txt Message-ID: <20080702020611.861121E4002@bag.python.org> Author: brett.cannon Date: Wed Jul 2 04:06:11 2008 New Revision: 64652 Log: Update status of the urllib package. Modified: peps/trunk/pep-3108.txt Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Wed Jul 2 04:06:11 2008 @@ -826,21 +826,22 @@ and ``tkSimpleDialog`` have no naming conflicts. -urllib package [done: 3.0] (TODO deprecations, fixers for 2.6) -////////////////////////////////////////////////////////////// +urllib package [done: 3.0] (TODO urllib2, urlparse, robotparser) +///////////////////////////////////////////////////////////////// Originally this new package was to be named ``url``, but because of the common use of the name as a variable, it has been deemed better to keep the name ``urllib`` and instead shift existing modules around into a new package. -================== =================================== +================== ================================================ Current Name Replacement Name -================== =================================== -urllib2 urllib.request +================== ================================================ +urllib2 urllib.request, urllib.error urlparse urllib.parse -urllib urllib.parse, urllib.request [6]_ -================== =================================== +urllib urllib.parse, urllib.request, urllib.error [6]_ +robotparser urllib.robotparser +================== ================================================ .. [6] The quoting-related functions from ``urllib`` will be added to ``urllib.parse``. ``urllib.URLOpener`` and From python-checkins at python.org Wed Jul 2 04:07:40 2008 From: python-checkins at python.org (barry.warsaw) Date: Wed, 2 Jul 2008 04:07:40 +0200 (CEST) Subject: [Python-checkins] r64653 - peps/trunk/pep-0361.txt Message-ID: <20080702020740.9803E1E4002@bag.python.org> Author: barry.warsaw Date: Wed Jul 2 04:07:40 2008 New Revision: 64653 Log: add link to gcal Modified: peps/trunk/pep-0361.txt Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Wed Jul 2 04:07:40 2008 @@ -63,8 +63,6 @@ See the public `Google calendar`_ -.. `Google calendar` http://www.google.com/calendar/ical/b6v58qvojllt0i6ql654r1vh00%40group.calendar.google.com/public/basic.ics - Completed features for 3.0 @@ -256,6 +254,8 @@ .. [#pep3127] PEP 3127 (Integer Literal Support and Syntax) http://www.python.org/dev/peps/pep-3127 +.. _Google calendar: http://www.google.com/calendar/ical/b6v58qvojllt0i6ql654r1vh00%40group.calendar.google.com/public/basic.ics + Copyright From buildbot at python.org Wed Jul 2 06:18:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 04:18:36 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080702041837.267FA1E4002@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1070 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_xmlrpc_net make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jul 2 09:11:20 2008 From: python-checkins at python.org (thomas.lee) Date: Wed, 2 Jul 2008 09:11:20 +0200 (CEST) Subject: [Python-checkins] r64654 - in python/branches/tlee-ast-optimize: Doc/glossary.rst Doc/library/abc.rst Doc/library/msilib.rst Doc/library/stdtypes.rst Doc/library/subprocess.rst Doc/library/urllib.rst Doc/reference/expressions.rst Doc/whatsnew/2.6.rst Lib/test/test_file.py Lib/test/test_syntax.py Lib/test/test_urllib.py Lib/test/test_urllibnet.py Lib/urllib.py Misc/NEWS Python/ast.c Python/ceval.c Message-ID: <20080702071120.E5A7C1E4002@bag.python.org> Author: thomas.lee Date: Wed Jul 2 09:11:19 2008 New Revision: 64654 Log: Merged revisions 64612-64653 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r64622 | benjamin.peterson | 2008-07-02 05:34:52 +1000 (Wed, 02 Jul 2008) | 1 line #3219 repeated keyword arguments aren't allowed in function calls anymore ........ r64623 | benjamin.peterson | 2008-07-02 05:51:54 +1000 (Wed, 02 Jul 2008) | 1 line write a short little section for multiprocessing; it still needs help ........ r64625 | georg.brandl | 2008-07-02 05:59:00 +1000 (Wed, 02 Jul 2008) | 2 lines Add a link to PEP 324. ........ r64630 | georg.brandl | 2008-07-02 06:18:10 +1000 (Wed, 02 Jul 2008) | 2 lines #3216: fix Execute's parameter description. ........ r64633 | amaury.forgeotdarc | 2008-07-02 06:38:04 +1000 (Wed, 02 Jul 2008) | 5 lines #3242: fix a crash in "print", if sys.stdout is set to a custom object, whose write() method installs another sys.stdout. Will backport. ........ r64635 | georg.brandl | 2008-07-02 06:45:09 +1000 (Wed, 02 Jul 2008) | 2 lines #1523853: add note about fread(). ........ r64638 | georg.brandl | 2008-07-02 06:50:02 +1000 (Wed, 02 Jul 2008) | 2 lines #1410739: add a footnote about "is" and "unusual" behavior. ........ r64640 | georg.brandl | 2008-07-02 06:56:03 +1000 (Wed, 02 Jul 2008) | 2 lines Add a comment about incref'ing w. ........ r64647 | benjamin.peterson | 2008-07-02 09:33:06 +1000 (Wed, 02 Jul 2008) | 1 line add ABC to the glossary ........ r64649 | brett.cannon | 2008-07-02 11:57:08 +1000 (Wed, 02 Jul 2008) | 8 lines Handle urllib's renaming for Python 3.0: * Deprecate urllib.urlopen() in favor of urllib2.urlopen() for 3.0. * Update docs to mention split/rename of the module and deprecation of urlopen(). Changes to lib2to3 are in a separate commit. Work is for issue #2885. ........ Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/glossary.rst python/branches/tlee-ast-optimize/Doc/library/abc.rst python/branches/tlee-ast-optimize/Doc/library/msilib.rst python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst python/branches/tlee-ast-optimize/Doc/library/subprocess.rst python/branches/tlee-ast-optimize/Doc/library/urllib.rst python/branches/tlee-ast-optimize/Doc/reference/expressions.rst python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst python/branches/tlee-ast-optimize/Lib/test/test_file.py python/branches/tlee-ast-optimize/Lib/test/test_syntax.py python/branches/tlee-ast-optimize/Lib/test/test_urllib.py python/branches/tlee-ast-optimize/Lib/test/test_urllibnet.py python/branches/tlee-ast-optimize/Lib/urllib.py python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Python/ast.c python/branches/tlee-ast-optimize/Python/ceval.c Modified: python/branches/tlee-ast-optimize/Doc/glossary.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/glossary.rst (original) +++ python/branches/tlee-ast-optimize/Doc/glossary.rst Wed Jul 2 09:11:19 2008 @@ -24,6 +24,14 @@ 2to3 is available in the standard library as :mod:`lib2to3`; a standalone entry point is provided as :file:`Tools/scripts/2to3`. + Abstract Base Class + Abstract Base Classes (abbreviated ABCs) complement :term:`duck-typing` by + providing a way to define interfaces when other techniques like :func:`hasattr` + would be clumsy. Python comes with many builtin ABCs for data structures + (in the :mod:`collections` module), numbers (in the :mod:`numbers` + module), and streams (in the :mod:`io` module). You can create your own + ABC with the :mod:`abc` module. + argument A value passed to a function or method, assigned to a name local to the body. A function or method may have both positional arguments and @@ -116,15 +124,16 @@ be any object with a :meth:`__hash__` function, not just integers starting from zero. Called a hash in Perl. - duck-typing + duck-typing Pythonic programming style that determines an object's type by inspection of its method or attribute signature rather than by explicit relationship to some type object ("If it looks like a duck and quacks like a duck, it must be a duck.") By emphasizing interfaces rather than specific types, well-designed code improves its flexibility by allowing polymorphic substitution. Duck-typing avoids tests using :func:`type` or - :func:`isinstance`. Instead, it typically employs :func:`hasattr` tests or - :term:`EAFP` programming. + :func:`isinstance`. (Note, however, that duck-typing can be complemented + with abstract base classes.) Instead, it typically employs :func:`hasattr` + tests or :term:`EAFP` programming. EAFP Easier to ask for forgiveness than permission. This common Python coding Modified: python/branches/tlee-ast-optimize/Doc/library/abc.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/abc.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/abc.rst Wed Jul 2 09:11:19 2008 @@ -9,10 +9,10 @@ .. versionadded:: 2.6 -This module provides the infrastructure for defining abstract base classes -(ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this was added -to Python. (See also :pep:`3141` and the :mod:`numbers` module regarding a type -hierarchy for numbers based on ABCs.) +This module provides the infrastructure for defining :term:`abstract base +classes` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this +was added to Python. (See also :pep:`3141` and the :mod:`numbers` module +regarding a type hierarchy for numbers based on ABCs.) The :mod:`collections` module has some concrete classes that derive from ABCs; these can, of course, be further derived. In addition the Modified: python/branches/tlee-ast-optimize/Doc/library/msilib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/msilib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/msilib.rst Wed Jul 2 09:11:19 2008 @@ -1,4 +1,3 @@ - :mod:`msilib` --- Read and write Microsoft Installer files ========================================================== @@ -165,11 +164,11 @@ ------------ -.. method:: View.Execute([params=None]) +.. method:: View.Execute(params) - Execute the SQL query of the view, through :cfunc:`MSIViewExecute`. *params* is - an optional record describing actual values of the parameter tokens in the - query. + Execute the SQL query of the view, through :cfunc:`MSIViewExecute`. If + *params* is not ``None``, it is a record describing actual values of the + parameter tokens in the query. .. method:: View.GetColumnInfo(kind) Modified: python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst Wed Jul 2 09:11:19 2008 @@ -2058,6 +2058,10 @@ that when in non-blocking mode, less data than what was requested may be returned, even if no *size* parameter was given. + .. note:: + As this function depends of the underlying C function :cfunc:`fread`, + it resembles its behaviour in details like caching EOF and others. + .. method:: file.readline([size]) Modified: python/branches/tlee-ast-optimize/Doc/library/subprocess.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/subprocess.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/subprocess.rst Wed Jul 2 09:11:19 2008 @@ -23,6 +23,10 @@ Information about how the :mod:`subprocess` module can be used to replace these modules and functions can be found in the following sections. +.. seealso:: + + :pep:`324` -- PEP proposing the subprocess module + Using the subprocess Module --------------------------- Modified: python/branches/tlee-ast-optimize/Doc/library/urllib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/urllib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/urllib.rst Wed Jul 2 09:11:19 2008 @@ -4,6 +4,13 @@ .. module:: urllib :synopsis: Open an arbitrary network resource by URL (requires sockets). +.. note:: + The :mod:`urllib` module has been split into parts and renamed in + Python 3.0 to :mod:`urllib.request`, :mod:`urllib.parse`, + and :mod:`urllib.error`. The :term:`2to3` tool will automatically adapt + imports when converting your sources to 3.0. + Also note that the :func:`urllib.urlopen` function has been removed in + Python 3.0 in favor of :func:`urllib2.urlopen`. .. index:: single: WWW @@ -116,6 +123,10 @@ .. versionchanged:: 2.6 Added :meth:`getcode` to returned object and support for the :envvar:`no_proxy` environment variable. + + .. deprecated:: 2.6 + The :func:`urlopen` function has been removed in Python 3.0 in favor + of :func:`urllib2.urlopen`. .. function:: urlretrieve(url[, filename[, reporthook[, data]]]) Modified: python/branches/tlee-ast-optimize/Doc/reference/expressions.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/reference/expressions.rst (original) +++ python/branches/tlee-ast-optimize/Doc/reference/expressions.rst Wed Jul 2 09:11:19 2008 @@ -1113,7 +1113,7 @@ The operators :keyword:`is` and :keyword:`is not` test for object identity: ``x is y`` is true if and only if *x* and *y* are the same object. ``x is not y`` -yields the inverse truth value. +yields the inverse truth value. [#]_ .. _booleans: @@ -1352,3 +1352,7 @@ only, but this caused surprises because people expected to be able to test a dictionary for emptiness by comparing it to ``{}``. +.. [#] Due to automatic garbage-collection, free lists, and the dynamic nature of + descriptors, you may notice seemingly unusual behaviour in certain uses of + the :keyword:`is` operator, like those involving comparisons between instance + methods, or constants. Check their documentation for more info. Modified: python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst (original) +++ python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst Wed Jul 2 09:11:19 2008 @@ -526,7 +526,21 @@ PEP 371: The ``multiprocessing`` Package ===================================================== -XXX write this. +.. XXX I think this still needs help + +:mod:`multiprocessing` makes it easy to distribute work over multiple processes. +Its API is similiar to that of :mod:`threading`. For example:: + + from multiprocessing import Process + + def long_hard_task(n): + print n * 43 + + for i in range(10): + Process(target=long_hard_task, args=(i)).start() + +will multiply the numbers between 0 and 10 times 43 and print out the result +concurrently. .. seealso:: Modified: python/branches/tlee-ast-optimize/Lib/test/test_file.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_file.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_file.py Wed Jul 2 09:11:19 2008 @@ -503,13 +503,31 @@ self._test_close_open_io(io_func) +class StdoutTests(unittest.TestCase): + + def test_move_stdout_on_write(self): + # Issue 3242: sys.stdout can be replaced (and freed) during a + # print statement; prevent a segfault in this case + save_stdout = sys.stdout + + class File: + def write(self, data): + if '\n' in data: + sys.stdout = save_stdout + + try: + sys.stdout = File() + print "some text" + finally: + sys.stdout = save_stdout + def test_main(): # Historically, these tests have been sloppy about removing TESTFN. # So get rid of it no matter what. try: run_unittest(AutoFileTests, OtherFileTests, FileSubclassTests, - FileThreadingTests) + FileThreadingTests, StdoutTests) finally: if os.path.exists(TESTFN): os.unlink(TESTFN) Modified: python/branches/tlee-ast-optimize/Lib/test/test_syntax.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_syntax.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_syntax.py Wed Jul 2 09:11:19 2008 @@ -417,6 +417,11 @@ ... SyntaxError: can't assign to function call (, line 6) +>>> f(a=23, a=234) +Traceback (most recent call last): + ... +SyntaxError: keyword argument repeated (, line 1) + """ import re Modified: python/branches/tlee-ast-optimize/Lib/test/test_urllib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_urllib.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_urllib.py Wed Jul 2 09:11:19 2008 @@ -640,16 +640,20 @@ def test_main(): - test_support.run_unittest( - urlopen_FileTests, - urlopen_HttpTests, - urlretrieve_FileTests, - QuotingTests, - UnquotingTests, - urlencode_Tests, - Pathname_Tests, - #FTPWrapperTests, - ) + import warnings + with test_support.catch_warning(record=False): + warnings.filterwarnings('ignore', ".*urllib\.urlopen.*Python 3.0", + DeprecationWarning) + test_support.run_unittest( + urlopen_FileTests, + urlopen_HttpTests, + urlretrieve_FileTests, + QuotingTests, + UnquotingTests, + urlencode_Tests, + Pathname_Tests, + #FTPWrapperTests, + ) Modified: python/branches/tlee-ast-optimize/Lib/test/test_urllibnet.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_urllibnet.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_urllibnet.py Wed Jul 2 09:11:19 2008 @@ -182,9 +182,13 @@ def test_main(): test_support.requires('network') - test_support.run_unittest(URLTimeoutTest, - urlopenNetworkTests, - urlretrieveNetworkTests) + from warnings import filterwarnings + with test_support.catch_warning(record=False): + filterwarnings('ignore', '.*urllib\.urlopen.*Python 3.0', + DeprecationWarning) + test_support.run_unittest(URLTimeoutTest, + urlopenNetworkTests, + urlretrieveNetworkTests) if __name__ == "__main__": test_main() Modified: python/branches/tlee-ast-optimize/Lib/urllib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/urllib.py (original) +++ python/branches/tlee-ast-optimize/Lib/urllib.py Wed Jul 2 09:11:19 2008 @@ -28,6 +28,7 @@ import time import sys from urlparse import urljoin as basejoin +import warnings __all__ = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve", "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus", @@ -69,7 +70,11 @@ # Shortcut for basic usage _urlopener = None def urlopen(url, data=None, proxies=None): - """urlopen(url [, data]) -> open file-like object""" + """Create a file-like object for the specified URL to read from.""" + from warnings import warnpy3k + warnings.warnpy3k("urllib.urlopen() has been removed in Python 3.0 in " + "favor of urllib2.urlopen()", stacklevel=2) + global _urlopener if proxies is not None: opener = FancyURLopener(proxies=proxies) Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Wed Jul 2 09:11:19 2008 @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #3242: Fix a crash inside the print statement, if sys.stdout is + set to a custom object whose write() method happens to install + another file in sys.stdout. + - Issue #3088: Corrected a race condition in classes derived from threading.local: the first member set by a thread could be saved in another thread's dictionary. @@ -21,11 +25,28 @@ slice(None, 10, -1).indices(10) returns (9, 9, -1) instead of (9, 10, -1). +- Issue #3219: Calling a function with repeated keyword arguments, f(a=2, a=23), + would not cause a syntax error. This was regression from 2.4 caused by the + switch to the new compiler. + + +Library +------- + +- Issue #2885 (partial): The urllib.urlopen() function has been deprecated for + removal in Python 3.0 in favor of urllib2.urlopen(). + +- Issue #2885 (partial): lib2to3 has been updated to handle the renaming of the + urllib module in Python 3.0 to urllib.request, urllib.parse, and + urllib.error. + + Build ----- - Issue #3215: Build sqlite3 as sqlite3.dll, not sqlite3.pyd. + What's New in Python 2.6 beta 1? ================================ Modified: python/branches/tlee-ast-optimize/Python/ast.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/ast.c (original) +++ python/branches/tlee-ast-optimize/Python/ast.c Wed Jul 2 09:11:19 2008 @@ -1912,6 +1912,8 @@ else { keyword_ty kw; identifier key; + int k; + char *tmp; /* CHILD(ch, 0) is test, but must be an identifier? */ e = ast_for_expr(c, CHILD(ch, 0)); @@ -1933,6 +1935,14 @@ key = e->v.Name.id; if (!forbidden_check(c, CHILD(ch, 0), PyBytes_AS_STRING(key))) return NULL; + for (k = 0; k < nkeywords; k++) { + tmp = PyString_AS_STRING( + ((keyword_ty)asdl_seq_GET(keywords, k))->arg); + if (!strcmp(tmp, PyString_AS_STRING(key))) { + ast_error(CHILD(ch, 0), "keyword argument repeated"); + return NULL; + } + } e = ast_for_expr(c, CHILD(ch, 2)); if (!e) return NULL; Modified: python/branches/tlee-ast-optimize/Python/ceval.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/ceval.c (original) +++ python/branches/tlee-ast-optimize/Python/ceval.c Wed Jul 2 09:11:19 2008 @@ -1617,9 +1617,13 @@ "lost sys.stdout"); } if (w != NULL) { + /* w.write() may replace sys.stdout, so we + * have to keep our reference to it */ + Py_INCREF(w); err = PyFile_WriteString("\n", w); if (err == 0) PyFile_SoftSpace(w, 0); + Py_DECREF(w); } Py_XDECREF(stream); stream = NULL; From python-checkins at python.org Wed Jul 2 11:37:02 2008 From: python-checkins at python.org (mark.dickinson) Date: Wed, 2 Jul 2008 11:37:02 +0200 (CEST) Subject: [Python-checkins] r64655 - in python/trunk/Lib: decimal.py test/test_decimal.py Message-ID: <20080702093702.33B9C1E4002@bag.python.org> Author: mark.dickinson Date: Wed Jul 2 11:37:01 2008 New Revision: 64655 Log: Replace occurrences of '\d' with '[0-9]' in Decimal regex, to make sure that the behaviour of Decimal doesn't change if/when re.UNICODE becomes assumed in Python 3.0. Also add a check that alternative Unicode digits (e.g. u'\N{FULLWIDTH DIGIT ONE}') are *not* accepted in a numeric string. Modified: python/trunk/Lib/decimal.py python/trunk/Lib/test/test_decimal.py Modified: python/trunk/Lib/decimal.py ============================================================================== --- python/trunk/Lib/decimal.py (original) +++ python/trunk/Lib/decimal.py Wed Jul 2 11:37:01 2008 @@ -5337,20 +5337,20 @@ # other meaning for \d than the numbers [0-9]. import re -_parser = re.compile(r""" # A numeric string consists of: +_parser = re.compile(r""" # A numeric string consists of: # \s* - (?P[-+])? # an optional sign, followed by either... + (?P[-+])? # an optional sign, followed by either... ( - (?=\d|\.\d) # ...a number (with at least one digit) - (?P\d*) # consisting of a (possibly empty) integer part - (\.(?P\d*))? # followed by an optional fractional part - (E(?P[-+]?\d+))? # followed by an optional exponent, or... + (?=[0-9]|\.[0-9]) # ...a number (with at least one digit) + (?P[0-9]*) # having a (possibly empty) integer part + (\.(?P[0-9]*))? # followed by an optional fractional part + (E(?P[-+]?[0-9]+))? # followed by an optional exponent, or... | - Inf(inity)? # ...an infinity, or... + Inf(inity)? # ...an infinity, or... | - (?Ps)? # ...an (optionally signaling) - NaN # NaN - (?P\d*) # with (possibly empty) diagnostic information. + (?Ps)? # ...an (optionally signaling) + NaN # NaN + (?P[0-9]*) # with (possibly empty) diagnostic info. ) # \s* \Z Modified: python/trunk/Lib/test/test_decimal.py ============================================================================== --- python/trunk/Lib/test/test_decimal.py (original) +++ python/trunk/Lib/test/test_decimal.py Wed Jul 2 11:37:01 2008 @@ -432,6 +432,9 @@ self.assertEqual(str(Decimal(u'-Inf')), '-Infinity') self.assertEqual(str(Decimal(u'NaN123')), 'NaN123') + #but alternate unicode digits should not + self.assertEqual(str(Decimal(u'\uff11')), 'NaN') + def test_explicit_from_tuples(self): #zero From buildbot at python.org Wed Jul 2 11:42:12 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 09:42:12 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc trunk Message-ID: <20080702094212.511B21E4002@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%20trunk/builds/224 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: mark.dickinson BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Wed Jul 2 12:20:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 10:20:35 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080702102035.43F431E4002@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%20trunk/builds/1689 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/bsddb/test/test_replication.py", line 101, in setUp self.assertTrue(time.time() The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%20trunk/builds/812 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jul 2 15:09:19 2008 From: python-checkins at python.org (nick.coghlan) Date: Wed, 2 Jul 2008 15:09:19 +0200 (CEST) Subject: [Python-checkins] r64656 - in python/trunk: Lib/pydoc.py Lib/test/test_pydoc.py Misc/NEWS Message-ID: <20080702130919.BD5171E400A@bag.python.org> Author: nick.coghlan Date: Wed Jul 2 15:09:19 2008 New Revision: 64656 Log: Issue 3190: pydoc now hides module __package__ attributes Modified: python/trunk/Lib/pydoc.py python/trunk/Lib/test/test_pydoc.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/pydoc.py ============================================================================== --- python/trunk/Lib/pydoc.py (original) +++ python/trunk/Lib/pydoc.py Wed Jul 2 15:09:19 2008 @@ -160,8 +160,9 @@ def visiblename(name, all=None): """Decide whether to show documentation on a variable.""" # Certain special names are redundant. - if name in ('__builtins__', '__doc__', '__file__', '__path__', - '__module__', '__name__', '__slots__'): return 0 + _hidden_names = ('__builtins__', '__doc__', '__file__', '__path__', + '__module__', '__name__', '__slots__', '__package__') + if name in _hidden_names: return 0 # Private names are hidden, but special names are displayed. if name.startswith('__') and name.endswith('__'): return 1 if all is not None: Modified: python/trunk/Lib/test/test_pydoc.py ============================================================================== --- python/trunk/Lib/test/test_pydoc.py (original) +++ python/trunk/Lib/test/test_pydoc.py Wed Jul 2 15:09:19 2008 @@ -57,7 +57,6 @@ DATA __author__ = 'Benjamin Peterson' __credits__ = 'Nobody' - __package__ = None __version__ = '1.2.3.4' VERSION @@ -146,7 +145,6 @@         __author__ = 'Benjamin Peterson'
__credits__ = 'Nobody'
-__package__ = None
__version__ = '1.2.3.4'

Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jul 2 15:09:19 2008 @@ -33,6 +33,9 @@ Library ------- +- Issue #3190: Pydoc now hides the automatic module attribute __package__ (the + handling is now the same as that of other special attributes like __name__). + - Issue #2885 (partial): The urllib.urlopen() function has been deprecated for removal in Python 3.0 in favor of urllib2.urlopen(). From python-checkins at python.org Wed Jul 2 15:10:54 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 2 Jul 2008 15:10:54 +0200 (CEST) Subject: [Python-checkins] r64657 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080702131054.23EDD1E4002@bag.python.org> Author: guilherme.polo Date: Wed Jul 2 15:10:53 2008 New Revision: 64657 Log: Renamed _current_options to _custom_options as it only stores custom options per widget now. Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Wed Jul 2 15:10:53 2008 @@ -16,7 +16,7 @@ import cStringIO import Tkinter from tkSimpleDialog import Dialog, askstring -from tkMessageBox import showwarning +from tkMessageBox import showwarning, showerror from tkFileDialog import askopenfilename def map_widgets(): @@ -95,10 +95,8 @@ def widget_notebook(widget, master, **kw): """Create a sample notebook with 2 tabs.""" w = widget(master, **kw) - t1 = ttk.Frame(w, width=150, height=150) - t2 = ttk.Frame(w, width=150, height=150) - w.add(t1, text="Tab 1") - w.add(t2, text="Tab 2") + w.add(ttk.Frame(w, width=150, height=150), text="Tab 1") + w.add(ttk.Frame(w, width=150, height=150), text="Tab 2") return w def widget_treeview(widget, master, **kw): @@ -106,7 +104,7 @@ w = widget(master, columns=[0, 1], **kw) w.column('#0', width=70) for i in range(2): - w.column(i, width=40, ) + w.column(i, width=40) w.heading(i, text=i) w.insert('', 'end', text="Row %d" % i, values=[i, i + 1]) return w @@ -120,11 +118,9 @@ def widget_paned(widget, master, **kw): """Create a sample Panedwindow with two children.""" - w = widget(master, height=150, **kw) - c1 = ttk.Label(w, text="Top") - c2 = ttk.Label(w, text="Bottom") - w.add(c1) - w.add(c2) + w = widget(master, height=150, orient='vertical', **kw) + w.add(ttk.Label(w, text="Top")) + w.add(ttk.Label(w, text="Bottom")) return w def widget_expand(widget, master, **kw): @@ -303,7 +299,7 @@ else: self.result = Tkinter.PhotoImage(name=img_name, file=img_path) except Tkinter.TclError, err: - showwarning("Error creating image", err, parent=self) + showerror("Error creating image", err, parent=self) return False return True @@ -380,13 +376,13 @@ if not isinstance(values['opts'], dict): raise ValueError except (NameError, SyntaxError), err: - showwarning("Invalid options specification", + showerror("Invalid options specification", "Options should be formatted according to a dict.\n\n" "Error: %s" % err, parent=self) return False except ValueError: - showwarning("Invalid options specification", + showerror("Invalid options specification", "Options should be formatted according to a dict.", parent=self) return False @@ -403,14 +399,14 @@ self.master = frame.master width = 640 - height = width - 50#int(width * 3 / 4) + height = width - 50 self.master.geometry('%dx%d' % (width, height)) self.master.minsize(width, height) self.master.title(title) self._style = ttk.Style(self.master) self._current_widget = {'layout': None, 'widget': None} - self._current_options = None + self._custom_options = {} # custom options per widget self.__create_menu() self.__setup_widgets() @@ -437,7 +433,7 @@ widget_style = "Custom.%s" % widget_name widget_name = treeview.item(treeview.parent(sel))['text'] else: - self._empty_layout_text() + self._empty_layout() widget = self._widget[widget_name] widget_style = widget_style or widget['class'] @@ -473,12 +469,13 @@ self._widget[name]['tv_item'] != selection) def _remove_previous_widgets(self): - """Remove widgets from the style frames.""" - self._current_options = self._current_options or [] - # remove previous widgets - for widget in self._current_options: + """Remove labels and entries from the style frames.""" + widgets = self._configframe.pack_slaves() + self._mapframe.pack_slaves() + + for widget in widgets: + if widget.winfo_class() == 'TButton': + continue widget.pack_forget() - self._current_options = [] def _update_style_configframe(self): """Update the configure frame for the current widget.""" @@ -522,21 +519,18 @@ entry.validate() entry.pack(side='top', fill='x', pady=3) - self._current_options = self._current_options or [] - self._current_options.extend([lbl, entry]) - def _update_layout_text(self, layout_name): """Update the layout text for the current widget.""" output = cStringIO.StringIO() pprint.pprint(self._style.layout(layout_name), stream=output) layout = output.getvalue() output.close() - self._empty_layout_text() + self._empty_layout() self.layouttext.layout = layout_name self.layouttext.insert('1.0', layout) # set new text - def _empty_layout_text(self): - """Clear current text in the layout text widget.""" + def _empty_layout(self): + """Clear current text in the layout text widget and unset layout.""" self.layouttext.delete('1.0', 'end') self.layouttext.layout = None @@ -547,7 +541,7 @@ return text = self.layouttext.get('1.0', 'end') - if not text.strip(): # no text + if not text.strip(): # no layout return # XXX Warning: eval usage! self._style.layout(layout, eval(text)) @@ -563,7 +557,7 @@ def _ask_new_frame_opt(self, frame, func): """Open a dialog asking for a new option to be added in the - specified frame.""" + specified frame and then add it.""" widget = self._current_widget if widget['widget'] is None: showwarning("No widget active", @@ -575,10 +569,16 @@ dlg = NewOption(self.master) if dlg.result is not None: option, value = dlg.result + + if layout_name not in self._custom_options: + self._custom_options[layout_name] = [] + + self._custom_options[layout_name].append(option) self._add_opt_frame(frame, func, layout_name, option, value) def _ask_new_element(self, frame): - """Open a dialog for getting data for a new style element.""" + """Open a dialog for getting data for a new style element and then + create it.""" dlg = NewElement(self.master, imglist=self._imagelist) if dlg.result: name = dlg.result['elementname'] @@ -598,7 +598,7 @@ self._style.element_create(name, dlg.result['etype'], *args, **dlg.result['opts']) except Tkinter.TclError, err: - showwarning("Element couldn't be created", + showerror("Element couldn't be created", "The specified element couldn'be created, reason: " "\n%s" % err, parent=self.master) else: From buildbot at python.org Wed Jul 2 16:10:31 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 14:10:31 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080702141031.936431E4037@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3644 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 523, in __bootstrap_inner self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 478, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_smtplib.py", line 108, in debugging_server poll_fun(0.01, asyncore.socket_map) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 103, in readwrite obj.handle_expt_event() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 448, in handle_expt_event raise socket.error(err, msg) error: [Errno 54] Connection reset by peer 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jul 2 18:44:21 2008 From: python-checkins at python.org (jesse.noller) Date: Wed, 2 Jul 2008 18:44:21 +0200 (CEST) Subject: [Python-checkins] r64663 - python/trunk/Lib/test/test_multiprocessing.py Message-ID: <20080702164421.64EDE1E400A@bag.python.org> Author: jesse.noller Date: Wed Jul 2 18:44:09 2008 New Revision: 64663 Log: Reenable the manager tests with Amaury's threading fix Modified: python/trunk/Lib/test/test_multiprocessing.py Modified: python/trunk/Lib/test/test_multiprocessing.py ============================================================================== --- python/trunk/Lib/test/test_multiprocessing.py (original) +++ python/trunk/Lib/test/test_multiprocessing.py Wed Jul 2 18:44:09 2008 @@ -960,7 +960,6 @@ def sqr(x, wait=0.0): time.sleep(wait) return x*x -""" class _TestPool(BaseTestCase): def test_apply(self): @@ -1030,7 +1029,6 @@ join = TimingWrapper(self.pool.join) join() self.assertTrue(join.elapsed < 0.2) -""" # # Test that manager has expected number of shared objects left # @@ -1333,7 +1331,6 @@ self.assertRaises(ValueError, a.send_bytes, msg, 4, -1) -""" class _TestListenerClient(BaseTestCase): ALLOWED_TYPES = ('processes', 'threads') @@ -1353,7 +1350,6 @@ self.assertEqual(conn.recv(), 'hello') p.join() l.close() -""" # # Test of sending connection and socket objects between processes # @@ -1769,28 +1765,28 @@ multiprocessing.get_logger().setLevel(LOG_LEVEL) - #ProcessesMixin.pool = multiprocessing.Pool(4) - #ThreadsMixin.pool = multiprocessing.dummy.Pool(4) - #ManagerMixin.manager.__init__() - #ManagerMixin.manager.start() - #ManagerMixin.pool = ManagerMixin.manager.Pool(4) + ProcessesMixin.pool = multiprocessing.Pool(4) + ThreadsMixin.pool = multiprocessing.dummy.Pool(4) + ManagerMixin.manager.__init__() + ManagerMixin.manager.start() + ManagerMixin.pool = ManagerMixin.manager.Pool(4) testcases = ( - sorted(testcases_processes.values(), key=lambda tc:tc.__name__) #+ - #sorted(testcases_threads.values(), key=lambda tc:tc.__name__) + - #sorted(testcases_manager.values(), key=lambda tc:tc.__name__) + sorted(testcases_processes.values(), key=lambda tc:tc.__name__) + + sorted(testcases_threads.values(), key=lambda tc:tc.__name__) + + sorted(testcases_manager.values(), key=lambda tc:tc.__name__) ) loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase suite = unittest.TestSuite(loadTestsFromTestCase(tc) for tc in testcases) run(suite) - #ThreadsMixin.pool.terminate() - #ProcessesMixin.pool.terminate() - #ManagerMixin.pool.terminate() - #ManagerMixin.manager.shutdown() + ThreadsMixin.pool.terminate() + ProcessesMixin.pool.terminate() + ManagerMixin.pool.terminate() + ManagerMixin.manager.shutdown() - #del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool + del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool def main(): test_main(unittest.TextTestRunner(verbosity=2).run) From python-checkins at python.org Wed Jul 2 18:52:56 2008 From: python-checkins at python.org (facundo.batista) Date: Wed, 2 Jul 2008 18:52:56 +0200 (CEST) Subject: [Python-checkins] r64664 - in python/trunk: Doc/library/rlcompleter.rst Lib/rlcompleter.py Misc/NEWS Message-ID: <20080702165256.391BC1E4002@bag.python.org> Author: facundo.batista Date: Wed Jul 2 18:52:55 2008 New Revision: 64664 Log: Issue #449227: Now with the rlcompleter module, callable objects are added a '(' when completed. Modified: python/trunk/Doc/library/rlcompleter.rst python/trunk/Lib/rlcompleter.py python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/rlcompleter.rst ============================================================================== --- python/trunk/Doc/library/rlcompleter.rst (original) +++ python/trunk/Doc/library/rlcompleter.rst Wed Jul 2 18:52:55 2008 @@ -20,9 +20,9 @@ >>> import readline >>> readline.parse_and_bind("tab: complete") >>> readline. - readline.__doc__ readline.get_line_buffer readline.read_init_file - readline.__file__ readline.insert_text readline.set_completer - readline.__name__ readline.parse_and_bind + readline.__doc__ readline.get_line_buffer( readline.read_init_file( + readline.__file__ readline.insert_text( readline.set_completer( + readline.__name__ readline.parse_and_bind( >>> readline. The :mod:`rlcompleter` module is designed for use with Python's interactive Modified: python/trunk/Lib/rlcompleter.py ============================================================================== --- python/trunk/Lib/rlcompleter.py (original) +++ python/trunk/Lib/rlcompleter.py Wed Jul 2 18:52:55 2008 @@ -92,6 +92,11 @@ except IndexError: return None + def _callable_postfix(self, val, word): + if callable(val): + word = word + "(" + return word + def global_matches(self, text): """Compute matches when text is a simple name. @@ -102,12 +107,13 @@ import keyword matches = [] n = len(text) - for list in [keyword.kwlist, - __builtin__.__dict__, - self.namespace]: - for word in list: + for word in keyword.kwlist: + if word[:n] == text: + matches.append(word) + for nspace in [__builtin__.__dict__, self.namespace]: + for word, val in nspace.items(): if word[:n] == text and word != "__builtins__": - matches.append(word) + matches.append(self._callable_postfix(val, word)) return matches def attr_matches(self, text): @@ -139,7 +145,9 @@ n = len(attr) for word in words: if word[:n] == attr and word != "__builtins__": - matches.append("%s.%s" % (expr, word)) + val = getattr(object, word) + word = self._callable_postfix(val, "%s.%s" % (expr, word)) + matches.append(word) return matches def get_class_members(klass): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jul 2 18:52:55 2008 @@ -33,6 +33,9 @@ Library ------- +- Issue #449227: Now with the rlcompleter module, callable objects are added + "(" when completed. + - Issue #3190: Pydoc now hides the automatic module attribute __package__ (the handling is now the same as that of other special attributes like __name__). From python-checkins at python.org Wed Jul 2 18:56:52 2008 From: python-checkins at python.org (jesse.noller) Date: Wed, 2 Jul 2008 18:56:52 +0200 (CEST) Subject: [Python-checkins] r64665 - python/trunk/Lib/test/test_multiprocessing.py Message-ID: <20080702165652.19B3B1E4002@bag.python.org> Author: jesse.noller Date: Wed Jul 2 18:56:51 2008 New Revision: 64665 Log: Add #!/usr/bin/env python for ben Modified: python/trunk/Lib/test/test_multiprocessing.py Modified: python/trunk/Lib/test/test_multiprocessing.py ============================================================================== --- python/trunk/Lib/test/test_multiprocessing.py (original) +++ python/trunk/Lib/test/test_multiprocessing.py Wed Jul 2 18:56:51 2008 @@ -1,3 +1,5 @@ +#!/usr/bin/env python + # # Unit tests for the multiprocessing package # From buildbot at python.org Wed Jul 2 18:57:37 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 16:57:37 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080702165737.8F1491E4002@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1176 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jul 2 19:20:08 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 17:20:08 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080702172008.9889C1E400E@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/716 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista,jesse.noller BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Wed Jul 2 20:02:09 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 2 Jul 2008 20:02:09 +0200 (CEST) Subject: [Python-checkins] r64667 - in sandbox/trunk/ttk-gsoc/samples/img: add.gif remove.gif stock_properties.gif Message-ID: <20080702180209.6AA041E4002@bag.python.org> Author: guilherme.polo Date: Wed Jul 2 20:02:09 2008 New Revision: 64667 Log: Added some Tango icons used by theming.py app Added: sandbox/trunk/ttk-gsoc/samples/img/add.gif (contents, props changed) sandbox/trunk/ttk-gsoc/samples/img/remove.gif (contents, props changed) sandbox/trunk/ttk-gsoc/samples/img/stock_properties.gif (contents, props changed) Added: sandbox/trunk/ttk-gsoc/samples/img/add.gif ============================================================================== Binary file. No diff available. Added: sandbox/trunk/ttk-gsoc/samples/img/remove.gif ============================================================================== Binary file. No diff available. Added: sandbox/trunk/ttk-gsoc/samples/img/stock_properties.gif ============================================================================== Binary file. No diff available. From python-checkins at python.org Wed Jul 2 20:04:07 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 2 Jul 2008 20:04:07 +0200 (CEST) Subject: [Python-checkins] r64668 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080702180407.2E4141E400B@bag.python.org> Author: guilherme.polo Date: Wed Jul 2 20:04:06 2008 New Revision: 64668 Log: Images can be edited and removed now; Added support for image format specification; Removed self._custom_options as it has no uses, at least for now; The sash between the top and bottom frames is adjusted just when the app starts now. Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Wed Jul 2 20:04:06 2008 @@ -6,10 +6,11 @@ # XXX ToDo List: # * Save/Load style changes, maybe. -# * Add a way to edit images/elements. +# * Add a way to edit elements. # * Add pre-defined elements for the current theme: # - Just after editing elements feature is added. +import os import sys import ttk import pprint @@ -19,6 +20,8 @@ from tkMessageBox import showwarning, showerror from tkFileDialog import askopenfilename +IMAGE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "img") + def map_widgets(): """Maps Ttk widgets to their respective layout(s), factory and possibly others.""" @@ -247,16 +250,22 @@ return False -class NewImage(NewOption): # reusing buttonbox - """A dialog that asks for a image name and image path or data.""" +class ImageDialog(NewOption): # reusing buttonbox + """A dialog that asks for a image name and image path or data and then + creates a PhotoImage from the data, or, receives data to edit.""" - def __init__(self, master, title="New Image"): + def __init__(self, master, title="New Image", image=None): + self._editing = True if image else False + self._image = image NewOption.__init__(self, master, title) def body(self, master): lbl = ttk.Label(master, text="Image name") self.img_name = ttk.Entry(master) + lbl_format = ttk.Label(master, text="Image Format") + self.img_format = ttk.Entry(master) + lbl_val = ttk.Label(master, text="Image path") self.img_path = ttk.Entry(master) browse = ttk.Button(master, text="Find", command=self._find_image) @@ -264,21 +273,34 @@ lbl_other = ttk.Label(master, text="or") lbl_data = ttk.Label(master, text="Image data") - self.img_data = ScrolledText(master, width=60, height=6) + self.img_data = ScrolledText(master, width=60, height=8) lbl.grid(row=0, column=0, padx=6, sticky='e') self.img_name.grid(row=0, column=1, padx=6, columnspan=2, sticky='ew') - lbl_val.grid(row=1, column=0, padx=6, pady=6, sticky='e') - self.img_path.grid(row=1, column=1, padx=6, sticky='ew') - browse.grid(row=1, column=2, padx=6, sticky='e') - lbl_other.grid(row=2, columnspan=3, pady=3) - lbl_data.grid(row=3, column=0, padx=6, sticky='new') - self.img_data.grid(row=3, column=1, columnspan=2) + lbl_format.grid(row=1, column=0, padx=6, sticky='e', pady=6) + self.img_format.grid(row=1, column=1, padx=6, columnspan=2, + sticky='ew', pady=6) + lbl_val.grid(row=2, column=0, padx=6, sticky='e') + self.img_path.grid(row=2, column=1, padx=6, sticky='ew') + browse.grid(row=2, column=2, padx=6, sticky='e') + lbl_other.grid(row=3, columnspan=3, pady=3) + lbl_data.grid(row=4, column=0, padx=6, sticky='new') + self.img_data.grid(row=4, column=1, columnspan=2) master.grid_columnconfigure(1, weight=1) self.resizable(False, False) + if self._editing: + self.img_name.insert(0, self._image.name) + self.img_name['state'] = 'readonly' + self.img_format.insert(0, self._image['format']) + + if self._image['file']: + self.img_path.insert(0, self._image['file']) + else: + self.img_data.insert('1.0', self._image['data']) + def validate(self): """Verify that a name was defined and only one between data and image path has been defined.""" @@ -293,18 +315,54 @@ "a image path or the image data.", parent=self) return False + if self._editing: + if not self._change_image(img_name, img_path, img_data): + return False + else: + if not self._create_image(img_name, img_path, img_data): + return False + + return True + + def _create_image(self, img_name, img_path, img_data): + """Create a new PhotoImage.""" try: + kwargs = {'name': img_name} + if self.img_format.get(): + kwargs['format'] = self.img_format.get() + if img_data: - self.result = Tkinter.PhotoImage(name=img_name, data=img_data) + kwargs['data'] = img_data else: - self.result = Tkinter.PhotoImage(name=img_name, file=img_path) + kwargs['file'] = img_path + + self.result = Tkinter.PhotoImage(**kwargs) except Tkinter.TclError, err: showerror("Error creating image", err, parent=self) return False + else: + return True - return True + def _change_image(self, img_name, img_path, img_data): + """Change an existing PhotoImage.""" + try: + if self.img_format.get(): + self._image['format'] = self.img_format.get() + + if img_path: + self._image['file'] = img_path + self._image['data'] = '' + else: + self._image['file'] = '' + self._image['data'] = img_data + except Tkinter.TclError, err: + showerror("Error updating image", err, parent=self) + return False + else: + return True def _find_image(self): + """Open a file browser and search for the image path.""" path = askopenfilename(parent=self) if path: # erase previous content @@ -406,7 +464,7 @@ self._style = ttk.Style(self.master) self._current_widget = {'layout': None, 'widget': None} - self._custom_options = {} # custom options per widget + self._images = {} self.__create_menu() self.__setup_widgets() @@ -555,7 +613,7 @@ self._update_layout_text(layout[layout.find('.') + 1:]) self.layouttext.layout = layout - def _ask_new_frame_opt(self, frame, func): + def _new_frame_opt(self, frame, func): """Open a dialog asking for a new option to be added in the specified frame and then add it.""" widget = self._current_widget @@ -569,14 +627,9 @@ dlg = NewOption(self.master) if dlg.result is not None: option, value = dlg.result - - if layout_name not in self._custom_options: - self._custom_options[layout_name] = [] - - self._custom_options[layout_name].append(option) self._add_opt_frame(frame, func, layout_name, option, value) - def _ask_new_element(self, frame): + def _new_element(self, frame): """Open a dialog for getting data for a new style element and then create it.""" dlg = NewElement(self.master, imglist=self._imagelist) @@ -595,8 +648,8 @@ # create element try: - self._style.element_create(name, dlg.result['etype'], *args, - **dlg.result['opts']) + self._style.element_create(name, + dlg.result['etype'], *args, **dlg.result['opts']) except Tkinter.TclError, err: showerror("Element couldn't be created", "The specified element couldn'be created, reason: " @@ -605,16 +658,42 @@ # add it to the list self._elems.set(name) self._elems['values'] = (self._elems['values'] or ()) + (name, ) + # the new element could have affected the current widget, so + # we need to update the preview area. + treeview = self._tv_widgets + self._change_preview(treeview, invalid=True) - def _ask_new_image(self): + def _new_image(self): """Add a new image to the image combobox. This image can be used in any widget layout.""" - dlg = NewImage(self.master) + dlg = ImageDialog(self.master) if dlg.result: # add new image to the images list img = dlg.result - self._imagelist.set(img.name) + img_name = img.name + self._images[img_name] = img + self._imagelist.set(img_name) self._imagelist['values'] = (self._imagelist['values'] or ()) + \ - (img.name, ) + (img_name, ) + + def _edit_image(self): + """Edit current selected image in imagelist.""" + img_name = self._imagelist.get() + if not img_name: + return + + ImageDialog(self.master, "Editing Image", self._images[img_name]) + + def _remove_image(self): + """Remove current selected image in imagelist.""" + img_name = self._imagelist.get() + if not img_name: + return + + del self._images[img_name] + values = set(self._imagelist['values']) - set([img_name]) + self._imagelist['values'] = list(values) + value = values.pop() if values else '' + self._imagelist.set(value) def _change_theme(self, event): """New theme selected at themes combobox, change current theme.""" @@ -662,7 +741,7 @@ left.pack(side='left', fill='y') # widget listing self._tv_widgets = ScrolledTreeview(left, selectmode='browse') - self._tv_widgets.pack(side='top', fill='y', anchor='w', expand=True) + self._tv_widgets.pack(side='top', fill='y', expand=True) self._tv_widgets.heading('#0', text="Widgets") self._tv_widgets.bind('<>', self._change_preview) @@ -672,27 +751,26 @@ # preview area self._preview_area = ttk.Frame(topright, width=200) - self._preview_area.pack(anchor='center', side='left', expand=True, - fill='both', padx=12) + self._preview_area.pack(side='left', expand=True, fill='both', padx=12) # options, images and themes frames = ttk.Frame(topright) frames.pack(side='right', anchor='n') # style notebook and frames styleframe = ttk.Labelframe(frames, text="Style", padding=6) - styleframe.pack(fill='both', anchor='n') + styleframe.pack(fill='both') stylenb = ttk.Notebook(styleframe) # style configure self._configframe = ttk.Frame(stylenb, padding=6) newopt = ttk.Button(self._configframe, text="Add option", - command=lambda: self._ask_new_frame_opt(self._configframe, + command=lambda: self._new_frame_opt(self._configframe, self._style.configure)) newopt.pack(side='bottom', anchor='e') self._configframe.pack() # style map self._mapframe = ttk.Frame(stylenb, padding=6) newmopt = ttk.Button(self._mapframe, text="Add option", - command=lambda: self._ask_new_frame_opt(self._mapframe, + command=lambda: self._new_frame_opt(self._mapframe, self._style.map)) newmopt.pack(side='bottom', anchor='e') self._mapframe.pack() @@ -701,7 +779,7 @@ self._elems = ttk.Combobox(elemframe, state='readonly') self._elems.pack(fill='x', pady=6) newelem = ttk.Button(elemframe, text="New element", - command=lambda: self._ask_new_element(elemframe)) + command=lambda: self._new_element(elemframe)) newelem.pack(side='bottom', anchor='e') elemframe.pack() # themes @@ -711,7 +789,7 @@ state='readonly') themes.set("Pick one") themes.bind('<>', self._change_theme) - themes.pack(fill='x') + themes.pack(fill='x', pady=6) # add frames to the style notebook stylenb.add(self._configframe, text="Configure") stylenb.add(self._mapframe, text="Map") @@ -719,16 +797,32 @@ stylenb.add(themeframe, text="Themes") stylenb.pack(fill='both', anchor='n') # images frame - imagesframe = ttk.Labelframe(frames, text="Images", padding=6) - self._imagelist = ttk.Combobox(imagesframe, state='readonly') - self._imagelist.pack(fill='x', pady=6) - newimg = ttk.Button(imagesframe, text="Add Image", - command=self._ask_new_image) - newimg.pack(side='bottom', anchor='e') + imagesframe = ttk.Labelframe(frames, padding=6) imagesframe.pack(fill='x', pady=12) + iframe = ttk.Frame(imagesframe) + imagesframe['labelwidget'] = iframe + self.__img_add = Tkinter.PhotoImage(file=os.path.join(IMAGE_DIR, + 'add.gif')) + self.__img_edit = Tkinter.PhotoImage(file=os.path.join(IMAGE_DIR, + 'stock_properties.gif')) + self.__img_del = Tkinter.PhotoImage(file=os.path.join(IMAGE_DIR, + 'remove.gif')) + ilbl = ttk.Label(iframe, text="Images") + iadd = ttk.Button(iframe, image=self.__img_add.name, + style='Toolbutton', command=self._new_image) + iedit = ttk.Button(iframe, image=self.__img_edit.name, + style='Toolbutton', command=self._edit_image) + iremove = ttk.Button(iframe, image=self.__img_del.name, + style='Toolbutton', command=self._remove_image) + ilbl.pack(side='left') + iadd.pack(side='left') + iedit.pack(side='left') + iremove.pack(side='left') + self._imagelist = ttk.Combobox(imagesframe, state='readonly') + self._imagelist.pack(fill='x') # bottom frame (layout) - bottom = ttk.Frame(paned, padding=[0, 0, 6]) + bottom = ttk.Frame(paned) bottom.pack(side='bottom') layoutframe = ttk.Labelframe(bottom, text="Layout", padding=6) layoutframe.pack(fill='both', expand=True) @@ -749,13 +843,16 @@ paned.add(top, weight=1) paned.add(bottom, weight=0) paned.pack(fill='both', expand=True) - paned.bind('', self.__adjust_sash) + self.__funcid = paned.bind('', self.__adjust_sash) def __adjust_sash(self, event): - """Adjust sash position between the top frame and the bottom frame.""" + """Adjust the initial sash position between the top frame and the + bottom frame.""" height = self.master.geometry().split('x')[1].split('+')[0] paned = event.widget paned.sashpos(0, int(height) - 180) + paned.unbind('', self.__funcid) + del self.__funcid def __fill_treeview(self): """Insert available widgets in the treeview.""" From buildbot at python.org Wed Jul 2 21:19:26 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 19:19:26 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080702191926.D77FC1E4002@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1074 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jul 2 21:43:49 2008 From: python-checkins at python.org (brett.cannon) Date: Wed, 2 Jul 2008 21:43:49 +0200 (CEST) Subject: [Python-checkins] r64669 - in sandbox/trunk/2to3/lib2to3: fixes/fix_imports.py tests/test_fixers.py Message-ID: <20080702194349.5FB5D1E4002@bag.python.org> Author: brett.cannon Date: Wed Jul 2 21:43:48 2008 New Revision: 64669 Log: Backing out last change until fix_imports is working again. Also re-enable the testing for fix_imports; if it is deemed that it takes too long to run then a random sample should be taken and used to test it. Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Wed Jul 2 21:43:48 2008 @@ -272,35 +272,6 @@ 'commands': ('subprocess', ['getstatusoutput', 'getoutput']), 'UserString' : ('collections', ['UserString']), 'UserList' : ('collections', ['UserList']), - 'urllib' : ( - 'urllib.request', - ['URLOpener', 'FancyURLOpener', 'urlretrieve', - '_urlopener', 'urlcleanup'], - 'urllib.parse', - ['quote', 'quote_plus', 'unquote', 'unquote_plus', - 'urlencode', 'pathname2url', 'url2pathname'], - 'urllib.error', ['ContentTooShortError'],), - 'urllib2' : ( - 'urllib.request', - ['urlopen', 'install_opener', 'build_opener', - 'Request', 'OpenerDirector', 'BaseHandler', - 'HTTPDefaultErrorHandler', 'HTTPRedirectHandler', - 'HTTPCookieProcessor', 'ProxyHandler', - 'HTTPPasswordMgr', - 'HTTPPasswordMgrWithDefaultRealm', - 'AbstractBasicAuthHandler', - 'HTTPBasicAuthHandler', 'ProxyBasicAuthHandler', - 'AbstractDigestAuthHandler', - 'HTTPDigestAuthHander', 'ProxyDigestAuthHandler', - 'HTTPHandler', 'HTTPSHandler', 'FileHandler', - 'FTPHandler', 'CacheFTPHandler', - 'UnknownHandler'], - 'urllib.error', ['URLError', 'HTTPError'],), - 'urlparse' : ('urllib.parse', - ['urlparse', 'urlunparse', 'urlsplit', - 'urlunsplit', 'urljoin', 'urldefrag', - 'ParseResult', 'SplitResult']), - 'robotparser' : ('urllib.robotparser', ['RobotFileParser']), } @@ -310,26 +281,24 @@ def build_pattern(): bare = set() - for old_module, changes in MAPPING.items(): - changes_iter = iter(changes) - for new_module, members in zip(changes_iter, changes_iter): - bare.add(old_module) - bare.update(members) - members = alternates(members) - yield """import_name< 'import' (module=%r - | dotted_as_names< any* module=%r any* >) > - """ % (old_module, old_module) - yield """import_from< 'from' module_name=%r 'import' - ( %s | import_as_name< %s 'as' any > | - import_as_names< any* >) > - """ % (old_module, members, members) - yield """import_from< 'from' module_name=%r 'import' star='*' > - """ % old_module - yield """import_name< 'import' - dotted_as_name< module_name=%r 'as' any > > - """ % old_module - yield """power< module_name=%r trailer< '.' %s > any* > - """ % (old_module, members) + for old_module, (new_module, members) in MAPPING.items(): + bare.add(old_module) + bare.update(members) + members = alternates(members) + yield """import_name< 'import' (module=%r + | dotted_as_names< any* module=%r any* >) > + """ % (old_module, old_module) + yield """import_from< 'from' module_name=%r 'import' + ( %s | import_as_name< %s 'as' any > | + import_as_names< any* >) > + """ % (old_module, members, members) + yield """import_from< 'from' module_name=%r 'import' star='*' > + """ % old_module + yield """import_name< 'import' + dotted_as_name< module_name=%r 'as' any > > + """ % old_module + yield """power< module_name=%r trailer< '.' %s > any* > + """ % (old_module, members) yield """bare_name=%s""" % alternates(bare) @@ -359,19 +328,16 @@ star = results.get("star") if import_mod or mod_name: - changes = MAPPING[(import_mod or mod_name).value] - changes_iter = iter(changes) - for new_name, members in zip(changes_iter, changes_iter): - if import_mod: - self.replace[import_mod.value] = new_name - import_mod.replace(Name(new_name, - prefix=import_mod.get_prefix())) - elif mod_name: - if star: - self.cannot_convert(node, "Cannot handle star imports.") - else: - mod_name.replace(Name(new_name, - prefix=mod_name.get_prefix())) + new_name, members = MAPPING[(import_mod or mod_name).value] + + if import_mod: + self.replace[import_mod.value] = new_name + import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) + elif mod_name: + if star: + self.cannot_convert(node, "Cannot handle star imports.") + else: + mod_name.replace(Name(new_name, prefix=mod_name.get_prefix())) elif bare_name: bare_name = bare_name[0] new_name = self.replace.get(bare_name.value) Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Wed Jul 2 21:43:48 2008 @@ -1403,10 +1403,7 @@ s = "foo(xreadlines)" self.unchanged(s) -# Disable test, as it takes a too long time to run, and also -# fails in 2.6. -#class Test_imports(FixerTestCase): -class Test_imports: +class Test_imports(FixerTestCase): fixer = "imports" from ..fixes.fix_imports import MAPPING as modules From buildbot at python.org Wed Jul 2 22:23:45 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 20:23:45 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080702202345.DAD571E400A@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/330 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jul 2 22:38:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 20:38:15 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080702203815.AD5E51E400A@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/128 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jul 2 23:01:34 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 21:01:34 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080702210134.5A0FB1E401A@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1180 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jul 2 23:40:12 2008 From: python-checkins at python.org (brett.cannon) Date: Wed, 2 Jul 2008 23:40:12 +0200 (CEST) Subject: [Python-checkins] r64673 - python/trunk/Lib/test/test_cookielib.py Message-ID: <20080702214012.346E81E400A@bag.python.org> Author: brett.cannon Date: Wed Jul 2 23:40:11 2008 New Revision: 64673 Log: FIx some Latin-1 characters to be UTF-8 as the file encoding specifies. Closes issue #3261. THankjs Leo Soto for the bug report. Modified: python/trunk/Lib/test/test_cookielib.py Modified: python/trunk/Lib/test/test_cookielib.py ============================================================================== --- python/trunk/Lib/test/test_cookielib.py (original) +++ python/trunk/Lib/test/test_cookielib.py Wed Jul 2 23:40:11 2008 @@ -1530,13 +1530,13 @@ "foo = bar; version = 1") cookie = interact_2965( - c, "http://www.acme.com/foo%2f%25/<<%0anew?/???", + c, "http://www.acme.com/foo%2f%25/<<%0anew??/??????", 'bar=baz; path="/foo/"; version=1'); version_re = re.compile(r'^\$version=\"?1\"?', re.I) self.assert_("foo=bar" in cookie and version_re.search(cookie)) cookie = interact_2965( - c, "http://www.acme.com/foo/%25/<<%0anew?/???") + c, "http://www.acme.com/foo/%25/<<%0anew??/??????") self.assert_(not cookie) # unicode URL doesn't raise exception From python-checkins at python.org Wed Jul 2 23:46:57 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 2 Jul 2008 23:46:57 +0200 (CEST) Subject: [Python-checkins] r64675 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080702214657.A6DDC1E400B@bag.python.org> Author: guilherme.polo Date: Wed Jul 2 23:46:57 2008 New Revision: 64675 Log: Removed unused imports; Some options, for some widgets, were not being fetched; Other misc changes; Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Wed Jul 2 23:46:57 2008 @@ -11,12 +11,11 @@ # - Just after editing elements feature is added. import os -import sys import ttk import pprint import cStringIO import Tkinter -from tkSimpleDialog import Dialog, askstring +from tkSimpleDialog import Dialog from tkMessageBox import showwarning, showerror from tkFileDialog import askopenfilename @@ -121,9 +120,9 @@ def widget_paned(widget, master, **kw): """Create a sample Panedwindow with two children.""" - w = widget(master, height=150, orient='vertical', **kw) - w.add(ttk.Label(w, text="Top")) - w.add(ttk.Label(w, text="Bottom")) + w = widget(master, height=150, **kw) + w.add(ttk.Label(w, text="Child 1")) + w.add(ttk.Label(w, text="Child 2")) return w def widget_expand(widget, master, **kw): @@ -546,14 +545,14 @@ def _update_style(self, func, frame): """Treeview selection changed, update the displayed style.""" widget = self._current_widget - layout_name = widget['layout'] - raw_name = layout_name[layout_name.find('.', 1) + 1:] - options = func(raw_name) - options.update(func(layout_name)) + widget_base_layout = widget['widget'].winfo_class() + custom_layout = widget['layout'] + options = func(widget_base_layout) + options.update(func(custom_layout)) # add options to the specified frame for opt_name, opt_value in options.items(): - self._add_opt_frame(frame, func, layout_name, opt_name, opt_value) + self._add_opt_frame(frame, func, custom_layout, opt_name, opt_value) def _add_opt_frame(self, frame, func, layout_name, opt_name, opt_value): """Add a new option to a frame.""" @@ -614,7 +613,7 @@ self.layouttext.layout = layout def _new_frame_opt(self, frame, func): - """Open a dialog asking for a new option to be added in the + """Open a dialog asking for a new custom option to be added in the specified frame and then add it.""" widget = self._current_widget if widget['widget'] is None: @@ -862,10 +861,10 @@ self._add_widget(name, opts) -def main(args=None): +def main(): root = Tkinter.Tk() app = MainWindow(root, 'Ttk Theming') root.mainloop() if __name__ == "__main__": - main(sys.argv) + main() From python-checkins at python.org Wed Jul 2 23:52:42 2008 From: python-checkins at python.org (brett.cannon) Date: Wed, 2 Jul 2008 23:52:42 +0200 (CEST) Subject: [Python-checkins] r64677 - python/trunk/Lib/test/test_cookielib.py Message-ID: <20080702215242.A042A1E400A@bag.python.org> Author: brett.cannon Date: Wed Jul 2 23:52:42 2008 New Revision: 64677 Log: Revert r64673 and instead just change the file encoding. Modified: python/trunk/Lib/test/test_cookielib.py Modified: python/trunk/Lib/test/test_cookielib.py ============================================================================== --- python/trunk/Lib/test/test_cookielib.py (original) +++ python/trunk/Lib/test/test_cookielib.py Wed Jul 2 23:52:42 2008 @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: latin-1 -*- """Tests for cookielib.py.""" import re, os, time @@ -1530,13 +1530,13 @@ "foo = bar; version = 1") cookie = interact_2965( - c, "http://www.acme.com/foo%2f%25/<<%0anew??/??????", + c, "http://www.acme.com/foo%2f%25/<<%0anew?/???", 'bar=baz; path="/foo/"; version=1'); version_re = re.compile(r'^\$version=\"?1\"?', re.I) self.assert_("foo=bar" in cookie and version_re.search(cookie)) cookie = interact_2965( - c, "http://www.acme.com/foo/%25/<<%0anew??/??????") + c, "http://www.acme.com/foo/%25/<<%0anew?/???") self.assert_(not cookie) # unicode URL doesn't raise exception From buildbot at python.org Wed Jul 2 23:58:49 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 21:58:49 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20080702215849.8D9641E400A@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%20trunk/builds/148 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_cookielib test_pickletools ====================================================================== FAIL: test_url_encoding (test.test_cookielib.LWPCookieTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/test/test_cookielib.py", line 1536, in test_url_encoding self.assert_("foo=bar" in cookie and version_re.search(cookie)) AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu Jul 3 00:08:29 2008 From: python-checkins at python.org (brett.cannon) Date: Thu, 3 Jul 2008 00:08:29 +0200 (CEST) Subject: [Python-checkins] r64680 - in python/branches/release25-maint: Lib/test/test_cookielib.py Misc/NEWS Message-ID: <20080702220829.78DAC1E4016@bag.python.org> Author: brett.cannon Date: Thu Jul 3 00:08:29 2008 New Revision: 64680 Log: Backport of r64677. Modified: python/branches/release25-maint/Lib/test/test_cookielib.py python/branches/release25-maint/Misc/NEWS Modified: python/branches/release25-maint/Lib/test/test_cookielib.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_cookielib.py (original) +++ python/branches/release25-maint/Lib/test/test_cookielib.py Thu Jul 3 00:08:29 2008 @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: latin-1 -*- """Tests for cookielib.py.""" import re, os, time Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Thu Jul 3 00:08:29 2008 @@ -117,6 +117,8 @@ Tests ----- +- Issue #3261: test_cookielib had an improper file encoding specified. + - Patch #2232: os.tmpfile might fail on Windows if the user has no permission to create files in the root directory. From buildbot at python.org Thu Jul 3 00:11:11 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 22:11:11 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080702221111.EA97D1E4013@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/130 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_distutils ====================================================================== ERROR: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/distutils/tests/test_build_ext.py", line 48, in test_build_ext import xx ImportError: /tmp/pythontest_heO_R7/xx.so: undefined symbol: Py_FindMethod make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 00:23:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 22:23:36 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080702222336.D20271E400A@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%20trunk/builds/1693 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cookielib ====================================================================== FAIL: test_url_encoding (test.test_cookielib.LWPCookieTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/test/test_cookielib.py", line 1536, in test_url_encoding self.assert_("foo=bar" in cookie and version_re.search(cookie)) AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 00:31:55 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 22:31:55 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk Message-ID: <20080702223156.0F5571E400A@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%20trunk/builds/274 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cookielib ====================================================================== FAIL: test_url_encoding (test.test_cookielib.LWPCookieTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/test/test_cookielib.py", line 1536, in test_url_encoding self.assert_("foo=bar" in cookie and version_re.search(cookie)) AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 00:32:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 22:32:07 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc trunk Message-ID: <20080702223207.2D8651E400A@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%20trunk/builds/228 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cookielib ====================================================================== FAIL: test_url_encoding (test.test_cookielib.LWPCookieTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_cookielib.py", line 1536, in test_url_encoding self.assert_("foo=bar" in cookie and version_re.search(cookie)) AssertionError sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 00:40:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 22:40:10 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080702224010.620A21E400A@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/407 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 00:52:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 22:52:07 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080702225207.DB4171E400A@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3647 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cookielib ====================================================================== FAIL: test_url_encoding (test.test_cookielib.LWPCookieTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_cookielib.py", line 1536, in test_url_encoding self.assert_("foo=bar" in cookie and version_re.search(cookie)) AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 00:53:11 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 22:53:11 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian trunk Message-ID: <20080702225311.30EFB1E400A@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%20trunk/builds/816 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cookielib ====================================================================== FAIL: test_url_encoding (test.test_cookielib.LWPCookieTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/test/test_cookielib.py", line 1536, in test_url_encoding self.assert_("foo=bar" in cookie and version_re.search(cookie)) AssertionError make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 01:01:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 23:01:15 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080702230115.4E2D81E4017@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/718 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 01:07:11 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 23:07:11 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080702230711.EB1AE1E400A@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/231 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_distutils ====================================================================== ERROR: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/distutils/tests/test_build_ext.py", line 48, in test_build_ext import xx ImportError: /tmp/pythontest_1WvQI7/xx.so: undefined symbol: Py_FindMethod make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 01:21:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 23:21:47 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080702232147.AA4001E400A@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/133 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_distutils ====================================================================== ERROR: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/distutils/tests/test_build_ext.py", line 48, in test_build_ext import xx ImportError: /tmp/pythontest_ACFrOl/xx.so: undefined symbol: PyObject_GenericGetattr make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 01:28:25 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 23:28:25 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080702232825.8B6BA1E400E@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/332 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_distutils test_funcattrs ====================================================================== ERROR: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/distutils/tests/test_build_ext.py", line 48, in test_build_ext import xx ImportError: /tmp/pythontest_rejOdA/xx.so: undefined symbol: Py_FindMethod make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu Jul 3 01:40:29 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Thu, 3 Jul 2008 01:40:29 +0200 (CEST) Subject: [Python-checkins] r64685 - python/trunk/Modules/nismodule.c Message-ID: <20080702234029.18BDF1E4021@bag.python.org> Author: amaury.forgeotdarc Date: Thu Jul 3 01:40:28 2008 New Revision: 64685 Log: Try a blind fix to nismodule which fails on the solaris10 3.0 buildbot: the GIL must be re-acquired in the callback function Modified: python/trunk/Modules/nismodule.c Modified: python/trunk/Modules/nismodule.c ============================================================================== --- python/trunk/Modules/nismodule.c (original) +++ python/trunk/Modules/nismodule.c Thu Jul 3 01:40:28 2008 @@ -98,6 +98,7 @@ struct ypcallback_data { PyObject *dict; int fix; + PyThreadState *state; }; static int @@ -109,6 +110,7 @@ PyObject *val; int err; + PyEval_RestoreThread(indata->state); if (indata->fix) { if (inkeylen > 0 && inkey[inkeylen-1] == '\0') inkeylen--; @@ -127,10 +129,11 @@ err = PyDict_SetItem(indata->dict, key, val); Py_DECREF(key); Py_DECREF(val); - if (err != 0) { + if (err != 0) PyErr_Clear(); - return 1; - } + indata->state = PyEval_SaveThread(); + if (err != 0) + return 1; return 0; } return 1; @@ -206,9 +209,9 @@ data.dict = dict; map = nis_mapname (map, &data.fix); cb.data = (char *)&data; - Py_BEGIN_ALLOW_THREADS + data.state = PyEval_SaveThread(); err = yp_all (domain, map, &cb); - Py_END_ALLOW_THREADS + PyEval_RestoreThread(data.state); if (err != 0) { Py_DECREF(dict); return nis_error(err); From buildbot at python.org Thu Jul 3 01:43:52 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 23:43:52 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080702234353.0C7351E400A@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/573 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_distutils ====================================================================== ERROR: test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/distutils/tests/test_build_ext.py", line 48, in test_build_ext import xx ImportError: /home/pybot/tmp/pythontest_ageC_D/xx.so: undefined symbol: Py_FindMethod make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 01:54:14 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 02 Jul 2008 23:54:14 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20080702235414.AB25C1E400A@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3318 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/cluster/members/member0/tmp/tmpCs5zcV/cgi-bin/file2.py", line 2, in import cgi Traceback (most recent call last): File "/net/taipan/scratch1/nnorwitz/python/trunk.norwitz-tru64/build/Lib/test/test_socket.py", line 123, in clientRun Fatal Python error: UNREF invalid object sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 02:24:18 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 03 Jul 2008 00:24:18 +0000 Subject: [Python-checkins] buildbot failure in x86 FreeBSD 2 trunk Message-ID: <20080703002418.A13711E400A@bag.python.org> The Buildbot has detected a new failure of x86 FreeBSD 2 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20FreeBSD%202%20trunk/builds/15 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: werven-freebsd Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Thu Jul 3 03:47:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 03 Jul 2008 01:47:43 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080703014743.D38C01E400A@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1210 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From nnorwitz at gmail.com Thu Jul 3 11:17:10 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 3 Jul 2008 05:17:10 -0400 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20080703091710.GA2153@python.psfb.org> More important issues: ---------------------- test_ssl leaked [131, 0, 0] references, sum=131 Less important issues: ---------------------- test_cmd_line leaked [0, 0, -50] references, sum=-50 test_socketserver leaked [0, 0, 80] references, sum=80 test_sys leaked [2, 2, 2] references, sum=6 test_threading leaked [0, 2, -2] references, sum=0 test_urllib2_localnet leaked [428, -422, 146] references, sum=152 From python-checkins at python.org Thu Jul 3 14:50:04 2008 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 3 Jul 2008 14:50:04 +0200 (CEST) Subject: [Python-checkins] r64687 - python/trunk/Doc/library/stdtypes.rst Message-ID: <20080703125004.0FA661E400B@bag.python.org> Author: andrew.kuchling Date: Thu Jul 3 14:50:03 2008 New Revision: 64687 Log: Tweak wording Modified: python/trunk/Doc/library/stdtypes.rst Modified: python/trunk/Doc/library/stdtypes.rst ============================================================================== --- python/trunk/Doc/library/stdtypes.rst (original) +++ python/trunk/Doc/library/stdtypes.rst Thu Jul 3 14:50:03 2008 @@ -2055,12 +2055,12 @@ files, like ttys, it makes sense to continue reading after an EOF is hit.) Note that this method may call the underlying C function :cfunc:`fread` more than once in an effort to acquire as close to *size* bytes as possible. Also note - that when in non-blocking mode, less data than what was requested may be + that when in non-blocking mode, less data than was requested may be returned, even if no *size* parameter was given. .. note:: - As this function depends of the underlying C function :cfunc:`fread`, - it resembles its behaviour in details like caching EOF and others. + As this function depends on the underlying :cfunc:`fread` C function, + it will behave the same in details such as caching EOF. .. method:: file.readline([size]) From python-checkins at python.org Thu Jul 3 14:51:15 2008 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 3 Jul 2008 14:51:15 +0200 (CEST) Subject: [Python-checkins] r64688 - in python/trunk: Doc/library/zipfile.rst Lib/test/test_zipfile.py Lib/test/test_zipfile64.py Lib/zipfile.py Misc/NEWS Message-ID: <20080703125115.1BFF91E400A@bag.python.org> Author: martin.v.loewis Date: Thu Jul 3 14:51:14 2008 New Revision: 64688 Log: Patch #1622: Correct interpretation of various ZIP header fields. Also fixes - Issue #1526: Allow more than 64k files to be added to Zip64 file. - Issue #1746: Correct handling of zipfile archive comments (previously archives with comments over 4k were flagged as invalid). Allow writing Zip files with archives by setting the 'comment' attribute of a ZipFile. Modified: python/trunk/Doc/library/zipfile.rst python/trunk/Lib/test/test_zipfile.py python/trunk/Lib/test/test_zipfile64.py python/trunk/Lib/zipfile.py python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/zipfile.rst ============================================================================== --- python/trunk/Doc/library/zipfile.rst (original) +++ python/trunk/Doc/library/zipfile.rst Thu Jul 3 14:51:14 2008 @@ -285,7 +285,7 @@ member of the given :class:`ZipInfo` instance. By default, the :class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`. -The following data attribute is also available: +The following data attributes are also available: .. attribute:: ZipFile.debug @@ -294,6 +294,12 @@ output) to ``3`` (the most output). Debugging information is written to ``sys.stdout``. +.. attribute:: ZipFile.comment + + The comment text associated with the ZIP file. If assigning a comment to a + :class:`ZipFile` instance created with mode 'a' or 'w', this should be a + string no longer than 65535 bytes. Comments longer than this will be + truncated in the written archive when :meth:`ZipFile.close` is called. .. _pyzipfile-objects: Modified: python/trunk/Lib/test/test_zipfile.py ============================================================================== --- python/trunk/Lib/test/test_zipfile.py (original) +++ python/trunk/Lib/test/test_zipfile.py Thu Jul 3 14:51:14 2008 @@ -712,6 +712,54 @@ zipf.writestr("foo.txt\x00qqq", "O, for a Muse of Fire!") self.assertEqual(zipf.namelist(), ['foo.txt']) + def test_StructSizes(self): + # check that ZIP internal structure sizes are calculated correctly + self.assertEqual(zipfile.sizeEndCentDir, 22) + self.assertEqual(zipfile.sizeCentralDir, 46) + self.assertEqual(zipfile.sizeEndCentDir64, 56) + self.assertEqual(zipfile.sizeEndCentDir64Locator, 20) + + def testComments(self): + # This test checks that comments on the archive are handled properly + + # check default comment is empty + zipf = zipfile.ZipFile(TESTFN, mode="w") + self.assertEqual(zipf.comment, '') + zipf.writestr("foo.txt", "O, for a Muse of Fire!") + zipf.close() + zipfr = zipfile.ZipFile(TESTFN, mode="r") + self.assertEqual(zipfr.comment, '') + zipfr.close() + + # check a simple short comment + comment = 'Bravely taking to his feet, he beat a very brave retreat.' + zipf = zipfile.ZipFile(TESTFN, mode="w") + zipf.comment = comment + zipf.writestr("foo.txt", "O, for a Muse of Fire!") + zipf.close() + zipfr = zipfile.ZipFile(TESTFN, mode="r") + self.assertEqual(zipfr.comment, comment) + zipfr.close() + + # check a comment of max length + comment2 = ''.join(['%d' % (i**3 % 10) for i in xrange((1 << 16)-1)]) + zipf = zipfile.ZipFile(TESTFN, mode="w") + zipf.comment = comment2 + zipf.writestr("foo.txt", "O, for a Muse of Fire!") + zipf.close() + zipfr = zipfile.ZipFile(TESTFN, mode="r") + self.assertEqual(zipfr.comment, comment2) + zipfr.close() + + # check a comment that is too long is truncated + zipf = zipfile.ZipFile(TESTFN, mode="w") + zipf.comment = comment2 + 'oops' + zipf.writestr("foo.txt", "O, for a Muse of Fire!") + zipf.close() + zipfr = zipfile.ZipFile(TESTFN, mode="r") + self.assertEqual(zipfr.comment, comment2) + zipfr.close() + def tearDown(self): support.unlink(TESTFN) support.unlink(TESTFN2) Modified: python/trunk/Lib/test/test_zipfile64.py ============================================================================== --- python/trunk/Lib/test/test_zipfile64.py (original) +++ python/trunk/Lib/test/test_zipfile64.py Thu Jul 3 14:51:14 2008 @@ -2,6 +2,7 @@ # The test_support.requires call is the only reason for keeping this separate # from test_zipfile from test import test_support + # XXX(nnorwitz): disable this test by looking for extra largfile resource # which doesn't exist. This test takes over 30 minutes to run in general # and requires more disk space than most of the buildbots. @@ -93,8 +94,31 @@ if os.path.exists(fname): os.remove(fname) + +class OtherTests(unittest.TestCase): + def testMoreThan64kFiles(self): + # This test checks that more than 64k files can be added to an archive, + # and that the resulting archive can be read properly by ZipFile + zipf = zipfile.ZipFile(TESTFN, mode="w") + zipf.debug = 100 + numfiles = (1 << 16) * 3/2 + for i in xrange(numfiles): + zipf.writestr("foo%08d" % i, "%d" % (i**3 % 57)) + self.assertEqual(len(zipf.namelist()), numfiles) + zipf.close() + + zipf2 = zipfile.ZipFile(TESTFN, mode="r") + self.assertEqual(len(zipf2.namelist()), numfiles) + for i in xrange(numfiles): + self.assertEqual(zipf2.read("foo%08d" % i), "%d" % (i**3 % 57)) + zipf.close() + + def tearDown(self): + test_support.unlink(TESTFN) + test_support.unlink(TESTFN2) + def test_main(): - run_unittest(TestsWithSourceFile) + run_unittest(TestsWithSourceFile, OtherTests) if __name__ == "__main__": test_main() Modified: python/trunk/Lib/zipfile.py ============================================================================== --- python/trunk/Lib/zipfile.py (original) +++ python/trunk/Lib/zipfile.py Thu Jul 3 14:51:14 2008 @@ -27,31 +27,79 @@ error = BadZipfile # The exception raised by this module ZIP64_LIMIT= (1 << 31) - 1 +ZIP_FILECOUNT_LIMIT = 1 << 16 +ZIP_MAX_COMMENT = (1 << 16) - 1 # constants for Zip file compression methods ZIP_STORED = 0 ZIP_DEFLATED = 8 # Other ZIP compression methods not supported -# Here are some struct module formats for reading headers -structEndArchive = "<4s4H2LH" # 9 items, end of archive, 22 bytes -stringEndArchive = "PK\005\006" # magic number for end of archive record -structCentralDir = "<4s4B4HLLL5HLL"# 19 items, central directory, 46 bytes -stringCentralDir = "PK\001\002" # magic number for central directory -structFileHeader = "<4s2B4HLLL2H" # 12 items, file header record, 30 bytes -stringFileHeader = "PK\003\004" # magic number for file header -structEndArchive64Locator = "<4sLQL" # 4 items, locate Zip64 header, 20 bytes -stringEndArchive64Locator = "PK\x06\x07" # magic token for locator header -structEndArchive64 = "<4sQHHLLQQQQ" # 10 items, end of archive (Zip64), 56 bytes -stringEndArchive64 = "PK\x06\x06" # magic token for Zip64 header - +# Below are some formats and associated data for reading/writing headers using +# the struct module. The names and structures of headers/records are those used +# in the PKWARE description of the ZIP file format: +# http://www.pkware.com/documents/casestudies/APPNOTE.TXT +# (URL valid as of January 2008) + +# The "end of central directory" structure, magic number, size, and indices +# (section V.I in the format document) +structEndCentDir = "<4s4H2LH" +magicEndCentDir = "PK\005\006" +sizeEndCentDir = struct.calcsize(structEndCentDir) + +_ECD_SIGNATURE = 0 +_ECD_DISK_NUMBER = 1 +_ECD_DISK_START = 2 +_ECD_ENTRIES_THIS_DISK = 3 +_ECD_ENTRIES_TOTAL = 4 +_ECD_SIZE = 5 +_ECD_OFFSET = 6 +_ECD_COMMENT_SIZE = 7 +# These last two indices are not part of the structure as defined in the +# spec, but they are used internally by this module as a convenience +_ECD_COMMENT = 8 +_ECD_LOCATION = 9 + +# The "central directory" structure, magic number, size, and indices +# of entries in the structure (section V.F in the format document) +structCentralDir = "<4s4B4HL2L5H2L" +magicCentralDir = "PK\001\002" +sizeCentralDir = struct.calcsize(structCentralDir) + +# The "local file header" structure, magic number, size, and indices +# (section V.A in the format document) +structFileHeader = "<4s2B4HL2L2H" +magicFileHeader = "PK\003\004" +sizeFileHeader = struct.calcsize(structFileHeader) + +# The "Zip64 end of central directory locator" structure, magic number, and size +structEndCentDir64Locator = "<4sLQL" +magicEndCentDir64Locator = "PK\x06\x07" +sizeEndCentDir64Locator = struct.calcsize(structEndCentDir64Locator) + +# The "Zip64 end of central directory" record, magic number, size, and indices +# (section V.G in the format document) +structEndCentDir64 = "<4sQ2H2L4Q" +magicEndCentDir64 = "PK\x06\x06" +sizeEndCentDir64 = struct.calcsize(structEndCentDir64) + +_CD64_SIGNATURE = 0 +_CD64_DIRECTORY_RECSIZE = 1 +_CD64_CREATE_VERSION = 2 +_CD64_EXTRACT_VERSION = 3 +_CD64_DISK_NUMBER = 4 +_CD64_DISK_NUMBER_START = 5 +_CD64_NUMBER_ENTRIES_THIS_DISK = 6 +_CD64_NUMBER_ENTRIES_TOTAL = 7 +_CD64_DIRECTORY_SIZE = 8 +_CD64_OFFSET_START_CENTDIR = 9 # indexes of entries in the central directory structure _CD_SIGNATURE = 0 _CD_CREATE_VERSION = 1 _CD_CREATE_SYSTEM = 2 _CD_EXTRACT_VERSION = 3 -_CD_EXTRACT_SYSTEM = 4 # is this meaningful? +_CD_EXTRACT_SYSTEM = 4 _CD_FLAG_BITS = 5 _CD_COMPRESS_TYPE = 6 _CD_TIME = 7 @@ -67,10 +115,15 @@ _CD_EXTERNAL_FILE_ATTRIBUTES = 17 _CD_LOCAL_HEADER_OFFSET = 18 -# indexes of entries in the local file header structure +# The "local file header" structure, magic number, size, and indices +# (section V.A in the format document) +structFileHeader = "<4s2B4HL2L2H" +magicFileHeader = "PK\003\004" +sizeFileHeader = struct.calcsize(structFileHeader) + _FH_SIGNATURE = 0 _FH_EXTRACT_VERSION = 1 -_FH_EXTRACT_SYSTEM = 2 # is this meaningful? +_FH_EXTRACT_SYSTEM = 2 _FH_GENERAL_PURPOSE_FLAG_BITS = 3 _FH_COMPRESSION_METHOD = 4 _FH_LAST_MOD_TIME = 5 @@ -81,6 +134,28 @@ _FH_FILENAME_LENGTH = 10 _FH_EXTRA_FIELD_LENGTH = 11 +# The "Zip64 end of central directory locator" structure, magic number, and size +structEndCentDir64Locator = "<4sLQL" +magicEndCentDir64Locator = "PK\x06\x07" +sizeEndCentDir64Locator = struct.calcsize(structEndCentDir64Locator) + +# The "Zip64 end of central directory" record, magic number, size, and indices +# (section V.G in the format document) +structEndCentDir64 = "<4sQ2H2L4Q" +magicEndCentDir64 = "PK\x06\x06" +sizeEndCentDir64 = struct.calcsize(structEndCentDir64) + +_CD64_SIGNATURE = 0 +_CD64_DIRECTORY_RECSIZE = 1 +_CD64_CREATE_VERSION = 2 +_CD64_EXTRACT_VERSION = 3 +_CD64_DISK_NUMBER = 4 +_CD64_DISK_NUMBER_START = 5 +_CD64_NUMBER_ENTRIES_THIS_DISK = 6 +_CD64_NUMBER_ENTRIES_TOTAL = 7 +_CD64_DIRECTORY_SIZE = 8 +_CD64_OFFSET_START_CENTDIR = 9 + def is_zipfile(filename): """Quickly see if file is a ZIP file by checking the magic number.""" try: @@ -97,33 +172,31 @@ """ Read the ZIP64 end-of-archive records and use that to update endrec """ - locatorSize = struct.calcsize(structEndArchive64Locator) - fpin.seek(offset - locatorSize, 2) - data = fpin.read(locatorSize) - sig, diskno, reloff, disks = struct.unpack(structEndArchive64Locator, data) - if sig != stringEndArchive64Locator: + fpin.seek(offset - sizeEndCentDir64Locator, 2) + data = fpin.read(sizeEndCentDir64Locator) + sig, diskno, reloff, disks = struct.unpack(structEndCentDir64Locator, data) + if sig != magicEndCentDir64Locator: return endrec if diskno != 0 or disks != 1: raise BadZipfile("zipfiles that span multiple disks are not supported") # Assume no 'zip64 extensible data' - endArchiveSize = struct.calcsize(structEndArchive64) - fpin.seek(offset - locatorSize - endArchiveSize, 2) - data = fpin.read(endArchiveSize) + fpin.seek(offset - sizeEndCentDir64Locator - sizeEndCentDir64, 2) + data = fpin.read(sizeEndCentDir64) sig, sz, create_version, read_version, disk_num, disk_dir, \ dircount, dircount2, dirsize, diroffset = \ - struct.unpack(structEndArchive64, data) - if sig != stringEndArchive64: + struct.unpack(structEndCentDir64, data) + if sig != magicEndCentDir64: return endrec # Update the original endrec using data from the ZIP64 record - endrec[1] = disk_num - endrec[2] = disk_dir - endrec[3] = dircount - endrec[4] = dircount2 - endrec[5] = dirsize - endrec[6] = diroffset + endrec[_ECD_DISK_NUMBER] = disk_num + endrec[_ECD_DISK_START] = disk_dir + endrec[_ECD_ENTRIES_THIS_DISK] = dircount + endrec[_ECD_ENTRIES_TOTAL] = dircount2 + endrec[_ECD_SIZE] = dirsize + endrec[_ECD_OFFSET] = diroffset return endrec @@ -132,38 +205,59 @@ The data is a list of the nine items in the ZIP "End of central dir" record followed by a tenth item, the file seek offset of this record.""" - fpin.seek(-22, 2) # Assume no archive comment. - filesize = fpin.tell() + 22 # Get file size + + # Determine file size + fpin.seek(0, 2) + filesize = fpin.tell() + + # Check to see if this is ZIP file with no archive comment (the + # "end of central directory" structure should be the last item in the + # file if this is the case). + fpin.seek(-sizeEndCentDir, 2) data = fpin.read() - if data[0:4] == stringEndArchive and data[-2:] == "\000\000": - endrec = struct.unpack(structEndArchive, data) - endrec = list(endrec) - endrec.append("") # Append the archive comment - endrec.append(filesize - 22) # Append the record start offset - if endrec[-4] == 0xffffffff: - return _EndRecData64(fpin, -22, endrec) + if data[0:4] == magicEndCentDir and data[-2:] == "\000\000": + # the signature is correct and there's no comment, unpack structure + endrec = struct.unpack(structEndCentDir, data) + endrec=list(endrec) + + # Append a blank comment and record start offset + endrec.append("") + endrec.append(filesize - sizeEndCentDir) + if endrec[_ECD_OFFSET] == 0xffffffff: + # the value for the "offset of the start of the central directory" + # indicates that there is a "Zip64 end of central directory" + # structure present, so go look for it + return _EndRecData64(fpin, -sizeEndCentDir, endrec) + return endrec - # Search the last END_BLOCK bytes of the file for the record signature. - # The comment is appended to the ZIP file and has a 16 bit length. - # So the comment may be up to 64K long. We limit the search for the - # signature to a few Kbytes at the end of the file for efficiency. - # also, the signature must not appear in the comment. - END_BLOCK = min(filesize, 1024 * 4) - fpin.seek(filesize - END_BLOCK, 0) + + # Either this is not a ZIP file, or it is a ZIP file with an archive + # comment. Search the end of the file for the "end of central directory" + # record signature. The comment is the last item in the ZIP file and may be + # up to 64K long. It is assumed that the "end of central directory" magic + # number does not appear in the comment. + maxCommentStart = max(filesize - (1 << 16) - sizeEndCentDir, 0) + fpin.seek(maxCommentStart, 0) data = fpin.read() - start = data.rfind(stringEndArchive) - if start >= 0: # Correct signature string was found - endrec = struct.unpack(structEndArchive, data[start:start+22]) - endrec = list(endrec) - comment = data[start+22:] - if endrec[7] == len(comment): # Comment length checks out + start = data.rfind(magicEndCentDir) + if start >= 0: + # found the magic number; attempt to unpack and interpret + recData = data[start:start+sizeEndCentDir] + endrec = list(struct.unpack(structEndCentDir, recData)) + comment = data[start+sizeEndCentDir:] + # check that comment length is correct + if endrec[_ECD_COMMENT_SIZE] == len(comment): # Append the archive comment and start offset endrec.append(comment) - endrec.append(filesize - END_BLOCK + start) - if endrec[-4] == 0xffffffff: - return _EndRecData64(fpin, - END_BLOCK + start, endrec) + endrec.append(maxCommentStart + start) + if endrec[_ECD_OFFSET] == 0xffffffff: + # There is apparently a "Zip64 end of central directory" + # structure present, so go look for it + return _EndRecData64(fpin, start - filesize, endrec) return endrec - return # Error, return None + + # Unable to find a valid end of central directory structure + return class ZipInfo (object): @@ -250,13 +344,13 @@ fmt = ' 1: print endrec - size_cd = endrec[5] # bytes in central directory - offset_cd = endrec[6] # offset of central directory - self.comment = endrec[8] # archive comment - # endrec[9] is the offset of the "End of Central Dir" record - if endrec[9] > ZIP64_LIMIT: - x = endrec[9] - size_cd - 56 - 20 - else: - x = endrec[9] - size_cd + size_cd = endrec[_ECD_SIZE] # bytes in central directory + offset_cd = endrec[_ECD_OFFSET] # offset of central directory + self.comment = endrec[_ECD_COMMENT] # archive comment + # "concat" is zero, unless zip was concatenated to another file - concat = x - offset_cd + concat = endrec[_ECD_LOCATION] - size_cd - offset_cd + if endrec[_ECD_LOCATION] > ZIP64_LIMIT: + # If the offset of the "End of Central Dir" record requires Zip64 + # extension structures, account for them + concat -= (sizeEndCentDir64 + sizeEndCentDir64Locator) + if self.debug > 2: - print "given, inferred, offset", offset_cd, x, concat + inferred = concat + offset_cd + print "given, inferred, offset", offset_cd, inferred, concat # self.start_dir: Position of start of central directory self.start_dir = offset_cd + concat fp.seek(self.start_dir, 0) @@ -682,9 +778,8 @@ fp = cStringIO.StringIO(data) total = 0 while total < size_cd: - centdir = fp.read(46) - total = total + 46 - if centdir[0:4] != stringCentralDir: + centdir = fp.read(sizeCentralDir) + if centdir[0:4] != magicCentralDir: raise BadZipfile, "Bad magic number for central directory" centdir = struct.unpack(structCentralDir, centdir) if self.debug > 2: @@ -694,9 +789,6 @@ x = ZipInfo(filename) x.extra = fp.read(centdir[_CD_EXTRA_FIELD_LENGTH]) x.comment = fp.read(centdir[_CD_COMMENT_LENGTH]) - total = (total + centdir[_CD_FILENAME_LENGTH] - + centdir[_CD_EXTRA_FIELD_LENGTH] - + centdir[_CD_COMMENT_LENGTH]) x.header_offset = centdir[_CD_LOCAL_HEADER_OFFSET] (x.create_version, x.create_system, x.extract_version, x.reserved, x.flag_bits, x.compress_type, t, d, @@ -712,6 +804,12 @@ x.filename = x._decodeFilename() self.filelist.append(x) self.NameToInfo[x.filename] = x + + # update total bytes read from central directory + total = (total + sizeCentralDir + centdir[_CD_FILENAME_LENGTH] + + centdir[_CD_EXTRA_FIELD_LENGTH] + + centdir[_CD_COMMENT_LENGTH]) + if self.debug > 2: print "total", total @@ -743,7 +841,6 @@ except BadZipfile: return zinfo.filename - def getinfo(self, name): """Return the instance of ZipInfo given 'name'.""" info = self.NameToInfo.get(name) @@ -787,8 +884,8 @@ zef_file.seek(zinfo.header_offset, 0) # Skip the file header: - fheader = zef_file.read(30) - if fheader[0:4] != stringFileHeader: + fheader = zef_file.read(sizeFileHeader) + if fheader[0:4] != magicFileHeader: raise BadZipfile, "Bad magic number for file header" fheader = struct.unpack(structFileHeader, fheader) @@ -1048,15 +1145,15 @@ or zinfo.compress_size > ZIP64_LIMIT: extra.append(zinfo.file_size) extra.append(zinfo.compress_size) - file_size = 0xffffffff #-1 - compress_size = 0xffffffff #-1 + file_size = 0xffffffff + compress_size = 0xffffffff else: file_size = zinfo.file_size compress_size = zinfo.compress_size if zinfo.header_offset > ZIP64_LIMIT: extra.append(zinfo.header_offset) - header_offset = 0xffffffffL # -1 32 bit + header_offset = 0xffffffffL else: header_offset = zinfo.header_offset @@ -1076,7 +1173,7 @@ try: filename, flag_bits = zinfo._encodeFilenameFlags() centdir = struct.pack(structCentralDir, - stringCentralDir, create_version, + magicCentralDir, create_version, zinfo.create_system, extract_version, zinfo.reserved, flag_bits, zinfo.compress_type, dostime, dosdate, zinfo.CRC, compress_size, file_size, @@ -1100,27 +1197,35 @@ pos2 = self.fp.tell() # Write end-of-zip-archive record + centDirOffset = pos1 if pos1 > ZIP64_LIMIT: # Need to write the ZIP64 end-of-archive records zip64endrec = struct.pack( - structEndArchive64, stringEndArchive64, + structEndCentDir64, magicEndCentDir64, 44, 45, 45, 0, 0, count, count, pos2 - pos1, pos1) self.fp.write(zip64endrec) zip64locrec = struct.pack( - structEndArchive64Locator, - stringEndArchive64Locator, 0, pos2, 1) + structEndCentDir64Locator, + magicEndCentDir64Locator, 0, pos2, 1) self.fp.write(zip64locrec) + centDirOffset = 0xFFFFFFFF - endrec = struct.pack(structEndArchive, stringEndArchive, - 0, 0, count, count, pos2 - pos1, 0xffffffffL, 0) - self.fp.write(endrec) - - else: - endrec = struct.pack(structEndArchive, stringEndArchive, - 0, 0, count, count, pos2 - pos1, pos1, 0) - self.fp.write(endrec) + # check for valid comment length + if len(self.comment) >= ZIP_MAX_COMMENT: + if self.debug > 0: + msg = 'Archive comment is too long; truncating to %d bytes' \ + % ZIP_MAX_COMMENT + self.comment = self.comment[:ZIP_MAX_COMMENT] + + endrec = struct.pack(structEndCentDir, magicEndCentDir, + 0, 0, count % ZIP_FILECOUNT_LIMIT, + count % ZIP_FILECOUNT_LIMIT, pos2 - pos1, + centDirOffset, len(self.comment)) + self.fp.write(endrec) + self.fp.write(self.comment) self.fp.flush() + if not self._filePassed: self.fp.close() self.fp = None Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jul 3 14:51:14 2008 @@ -33,6 +33,14 @@ Library ------- +- Issue #1622: Correct interpretation of various ZIP header fields. + +- Issue #1526: Allow more than 64k files to be added to Zip64 file. + +- Issue #1746: Correct handling of zipfile archive comments (previously + archives with comments over 4k were flagged as invalid). Allow writing + Zip files with archives by setting the 'comment' attribute of a ZipFile. + - Issue #449227: Now with the rlcompleter module, callable objects are added "(" when completed. From python-checkins at python.org Thu Jul 3 14:57:35 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 3 Jul 2008 14:57:35 +0200 (CEST) Subject: [Python-checkins] r64689 - python/trunk/Doc/glossary.rst Message-ID: <20080703125735.C512E1E400A@bag.python.org> Author: benjamin.peterson Date: Thu Jul 3 14:57:35 2008 New Revision: 64689 Log: lowercase glossary term Modified: python/trunk/Doc/glossary.rst Modified: python/trunk/Doc/glossary.rst ============================================================================== --- python/trunk/Doc/glossary.rst (original) +++ python/trunk/Doc/glossary.rst Thu Jul 3 14:57:35 2008 @@ -24,7 +24,7 @@ 2to3 is available in the standard library as :mod:`lib2to3`; a standalone entry point is provided as :file:`Tools/scripts/2to3`. - Abstract Base Class + abstract base class Abstract Base Classes (abbreviated ABCs) complement :term:`duck-typing` by providing a way to define interfaces when other techniques like :func:`hasattr` would be clumsy. Python comes with many builtin ABCs for data structures From buildbot at python.org Thu Jul 3 14:59:23 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 03 Jul 2008 12:59:23 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080703125924.243271E400A@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/720 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: andrew.kuchling,martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Thu Jul 3 15:01:18 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 3 Jul 2008 15:01:18 +0200 (CEST) Subject: [Python-checkins] r64690 - python/trunk/Doc/library/abc.rst Message-ID: <20080703130118.093941E4029@bag.python.org> Author: benjamin.peterson Date: Thu Jul 3 15:01:17 2008 New Revision: 64690 Log: let the term be linked Modified: python/trunk/Doc/library/abc.rst Modified: python/trunk/Doc/library/abc.rst ============================================================================== --- python/trunk/Doc/library/abc.rst (original) +++ python/trunk/Doc/library/abc.rst Thu Jul 3 15:01:17 2008 @@ -9,8 +9,8 @@ .. versionadded:: 2.6 -This module provides the infrastructure for defining :term:`abstract base -classes` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this +This module provides the infrastructure for defining an :term:`abstract base +class` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this was added to Python. (See also :pep:`3141` and the :mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.) From buildbot at python.org Thu Jul 3 15:02:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 03 Jul 2008 13:02:53 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: <20080703130253.B7DE11E401A@bag.python.org> The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: The web-page 'force build' button was pressed by 'Jesse': Test Build, New builder Build Source Stamp: [branch trunk] HEAD Blamelist: BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From python-checkins at python.org Thu Jul 3 17:04:11 2008 From: python-checkins at python.org (guilherme.polo) Date: Thu, 3 Jul 2008 17:04:11 +0200 (CEST) Subject: [Python-checkins] r64693 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080703150411.34F661E4043@bag.python.org> Author: guilherme.polo Date: Thu Jul 3 17:04:10 2008 New Revision: 64693 Log: Fixed a bug in the image editing dialog which would leave an image with invalid settings; Moved the try/except blocks from _create_image and _change_image back to validate. Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Thu Jul 3 17:04:10 2008 @@ -314,51 +314,45 @@ "a image path or the image data.", parent=self) return False - if self._editing: - if not self._change_image(img_name, img_path, img_data): - return False - else: - if not self._create_image(img_name, img_path, img_data): - return False - - return True - - def _create_image(self, img_name, img_path, img_data): - """Create a new PhotoImage.""" try: - kwargs = {'name': img_name} - if self.img_format.get(): - kwargs['format'] = self.img_format.get() - - if img_data: - kwargs['data'] = img_data + img_format = self.img_format.get() + if self._editing: + # try to create an image with current settings, if it succeeds + # then it is ok to change the image being edited. + self._create_image(None, img_path, img_data, img_format) + self._change_image(img_path, img_data, img_format) else: - kwargs['file'] = img_path - - self.result = Tkinter.PhotoImage(**kwargs) + self._create_image(img_name, img_path, img_data, img_format) except Tkinter.TclError, err: showerror("Error creating image", err, parent=self) return False else: return True - def _change_image(self, img_name, img_path, img_data): - """Change an existing PhotoImage.""" - try: - if self.img_format.get(): - self._image['format'] = self.img_format.get() + def _create_image(self, img_name, img_path, img_data, img_format): + """Create a new PhotoImage.""" + kwargs = {'name': img_name} - if img_path: - self._image['file'] = img_path - self._image['data'] = '' - else: - self._image['file'] = '' - self._image['data'] = img_data - except Tkinter.TclError, err: - showerror("Error updating image", err, parent=self) - return False + if img_format: + kwargs['format'] = img_format + if img_data: + kwargs['data'] = img_data else: - return True + kwargs['file'] = img_path + + self.result = Tkinter.PhotoImage(**kwargs) + + def _change_image(self, img_path, img_data, img_format): + """Change an existing PhotoImage.""" + if img_format: + self._image['format'] = img_format + if img_path: + pfile, data = img_path, '' + else: + pfile, data = '', img_data + + self._image['file'] = pfile + self._image['data'] = data def _find_image(self): """Open a file browser and search for the image path.""" From python-checkins at python.org Thu Jul 3 20:44:24 2008 From: python-checkins at python.org (guilherme.polo) Date: Thu, 3 Jul 2008 20:44:24 +0200 (CEST) Subject: [Python-checkins] r64694 - in sandbox/trunk/ttk-gsoc/samples/img: back.gif dialog-apply.gif Message-ID: <20080703184424.3DBFE1E400A@bag.python.org> Author: guilherme.polo Date: Thu Jul 3 20:44:23 2008 New Revision: 64694 Log: Added more images that are used by theming.py Added: sandbox/trunk/ttk-gsoc/samples/img/back.gif (contents, props changed) sandbox/trunk/ttk-gsoc/samples/img/dialog-apply.gif (contents, props changed) Added: sandbox/trunk/ttk-gsoc/samples/img/back.gif ============================================================================== Binary file. No diff available. Added: sandbox/trunk/ttk-gsoc/samples/img/dialog-apply.gif ============================================================================== Binary file. No diff available. From python-checkins at python.org Thu Jul 3 20:46:59 2008 From: python-checkins at python.org (guilherme.polo) Date: Thu, 3 Jul 2008 20:46:59 +0200 (CEST) Subject: [Python-checkins] r64695 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080703184659.82FFC1E400A@bag.python.org> Author: guilherme.polo Date: Thu Jul 3 20:46:59 2008 New Revision: 64695 Log: Moved the apply and reset buttons at right of layouttext to the labelwidget of Layout's labelframe; A dialog is raised when an invalid layout is entered; Other misc changes; Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Thu Jul 3 20:46:59 2008 @@ -13,17 +13,17 @@ import os import ttk import pprint -import cStringIO import Tkinter +import cStringIO from tkSimpleDialog import Dialog -from tkMessageBox import showwarning, showerror from tkFileDialog import askopenfilename +from tkMessageBox import showwarning, showerror IMAGE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "img") def map_widgets(): """Maps Ttk widgets to their respective layout(s), factory and - possibly others.""" + possibly other things.""" widgets = {} # will discard Style and extension classes unwanted_names = ('Style', 'LabeledScale', 'OptionMenu') @@ -302,7 +302,7 @@ def validate(self): """Verify that a name was defined and only one between data and - image path has been defined.""" + image path was set.""" img_name = self.img_name.get() img_path = self.img_path.get() img_data = self.img_data.get('1.0', 'end').strip() @@ -311,7 +311,7 @@ (not img_path and not img_data): showwarning("Invalid image specification", "You need to specify an image name and then either specify " - "a image path or the image data.", parent=self) + "a image path or the image data, at least.", parent=self) return False try: @@ -343,7 +343,9 @@ self.result = Tkinter.PhotoImage(**kwargs) def _change_image(self, img_path, img_data, img_format): - """Change an existing PhotoImage.""" + """Change an existing PhotoImage. This could easily leave the + image with invalid values, so it is interesting to use + _create_image and check for some exception before calling this one.""" if img_format: self._image['format'] = img_format if img_path: @@ -425,14 +427,14 @@ # XXX Warning: eval usage! values['opts'] = eval(values['opts']) if not isinstance(values['opts'], dict): - raise ValueError + raise TypeError except (NameError, SyntaxError), err: showerror("Invalid options specification", "Options should be formatted according to a dict.\n\n" "Error: %s" % err, parent=self) return False - except ValueError: + except TypeError: showerror("Invalid options specification", "Options should be formatted according to a dict.", parent=self) @@ -457,7 +459,7 @@ self._style = ttk.Style(self.master) self._current_widget = {'layout': None, 'widget': None} - self._images = {} + self._images = {} # images created by the user self.__create_menu() self.__setup_widgets() @@ -595,7 +597,11 @@ if not text.strip(): # no layout return # XXX Warning: eval usage! - self._style.layout(layout, eval(text)) + try: + self._style.layout(layout, eval(text)) + except (SyntaxError, ValueError, NameError, Tkinter.TclError): + showerror("Invalid layout", "The specified layout is invalid, " + "please verify its format.", parent=self.master) def _reset_layout(self): """Reset the layout for current selected widget.""" @@ -817,21 +823,28 @@ # bottom frame (layout) bottom = ttk.Frame(paned) bottom.pack(side='bottom') - layoutframe = ttk.Labelframe(bottom, text="Layout", padding=6) + layoutframe = ttk.Labelframe(bottom, padding=6) layoutframe.pack(fill='both', expand=True) + lframe = ttk.Frame(layoutframe) + layoutframe['labelwidget'] = lframe + self.__img_apply = Tkinter.PhotoImage(file=os.path.join(IMAGE_DIR, + 'dialog-apply.gif')) + self.__img_reset = Tkinter.PhotoImage(file=os.path.join(IMAGE_DIR, + 'back.gif')) + llbl = ttk.Label(lframe, text="Layout") + apply_btn = ttk.Button(lframe, image=self.__img_apply.name, + command=self._apply_layout, style='Toolbutton') + reset_btn = ttk.Button(lframe, image=self.__img_reset.name, + command=self._reset_layout, style='Toolbutton') + llbl.pack(side='left') + apply_btn.pack(side='left') + reset_btn.pack(side='left') + # layouttext textframe = ttk.Frame(layoutframe) textframe.pack(side='left', fill='both', expand=True) self.layouttext = ScrolledText(textframe) self.layouttext.layout = None self.layouttext.pack(expand=True, fill='both') - btnsframe = ttk.Frame(layoutframe, padding=[6, 0, 0, 0]) - btnsframe.pack(side='right', anchor='n', fill='x') - apply_btn = ttk.Button(btnsframe, text="Apply", - command=self._apply_layout) - reset_btn = ttk.Button(btnsframe, text="Reset", - command=self._reset_layout) - apply_btn.pack(side='top') - reset_btn.pack(side='top', pady=6) paned.add(top, weight=1) paned.add(bottom, weight=0) From python-checkins at python.org Thu Jul 3 23:00:08 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 3 Jul 2008 23:00:08 +0200 (CEST) Subject: [Python-checkins] r64697 - sandbox/trunk/release/release.py Message-ID: <20080703210008.0E5371E400C@bag.python.org> Author: benjamin.peterson Date: Thu Jul 3 23:00:07 2008 New Revision: 64697 Log: various improvements - kill extra whitespace - perhaps you should run make install, too (just to check?) - remove .bzrignore and .hgignore from the dist Modified: sandbox/trunk/release/release.py Modified: sandbox/trunk/release/release.py ============================================================================== --- sandbox/trunk/release/release.py (original) +++ sandbox/trunk/release/release.py Thu Jul 3 23:00:07 2008 @@ -53,7 +53,7 @@ 'Please set your EDITOR enviroment variable') if not os.path.exists('.svn'): error('CWD is not a Subversion checkout') - + def get_arg_parser(): usage = '%prog [options] tagname' @@ -132,7 +132,7 @@ def bump(tag): print 'Bumping version to %s' % tag - + wanted_file = 'Misc/RPM/python-%s.spec' % tag.basic_version print 'Updating %s' % wanted_file, if not os.path.exists(wanted_file): @@ -149,7 +149,7 @@ '\n%define libver ' + tag.basic_version constant_replace(wanted_file, new, '#', '') print 'done' - + tweak_patchlevel(tag) print 'Updating Lib/idlelib/idlever.py...', @@ -157,12 +157,12 @@ new = 'IDLE_VERSION = "%s"\n' % tag.next_text fp.write(new) print 'done' - + print 'Updating Lib/distutils/__init__.py...', new = '__version__ = "%s"' % tag.text constant_replace('Lib/distutils/__init__.py', new, '#', '') print 'done' - + other_files = ['README', 'Misc/NEWS'] if tag.patch == 0 and tag.level == "a" and tag.serial == 0: other_files += [ @@ -178,7 +178,7 @@ for fn in other_files: print 'Edit %s' % fn manual_edit(fn) - + print 'Bumped revision' print 'Please commit and use --tag' @@ -204,6 +204,11 @@ run_cmd(['svn', 'export', 'http://svn.python.org/projects/python/tags/r%s' % tag.nickname, python]) + print 'Removing .hgignore and .bzrignore' + for name in ('.hgignore', '.bzrignore'): + try: + os.unlink(os.path.join('dist', name)) + except OSError: pass print 'Making .tgz' run_cmd(['tar cf - %s | gzip -9 > %s.tgz' % (python, python)]) print "Making .tar.bz2" @@ -232,6 +237,7 @@ os.system('gpg -bas ' + tgz) os.system('gpg -bas ' + bz) print '\n**Now extract the archives and run the tests**' + print '**You may also want to run make install and re-test**' class Tag(object): @@ -256,7 +262,7 @@ self.level = data[3] self.serial = int(data[4]) self.basic_version = '%s.%s' % (self.major, self.minor) - + def __str__(self): return self.text @@ -271,7 +277,7 @@ if raw_input('Are you sure you want to branch?') != "y": return run_cmd(['svn', 'copy', get_current_location(), - 'svn+ssh://svn.python.org/projects/python/branches/' + 'svn+ssh://svn.python.org/projects/python/branches/' 'release%s-maint' % (tag.major + tag.minor)]) From buildbot at python.org Fri Jul 4 09:24:33 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 07:24:33 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080704072433.B36541E4003@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/729 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: The web-page 'rebuild' button was pressed by '': Build Source Stamp: [branch py3k] HEAD Blamelist: BUILD FAILED: failed svn sincerely, -The Buildbot From python-checkins at python.org Fri Jul 4 12:21:09 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 12:21:09 +0200 (CEST) Subject: [Python-checkins] r64698 - doctools/branches/0.4.x/sphinx/directives/other.py Message-ID: <20080704102109.ECD1F1E4004@bag.python.org> Author: georg.brandl Date: Fri Jul 4 12:21:09 2008 New Revision: 64698 Log: Allow setting current module to None. Modified: doctools/branches/0.4.x/sphinx/directives/other.py Modified: doctools/branches/0.4.x/sphinx/directives/other.py ============================================================================== --- doctools/branches/0.4.x/sphinx/directives/other.py (original) +++ doctools/branches/0.4.x/sphinx/directives/other.py Fri Jul 4 12:21:09 2008 @@ -117,7 +117,10 @@ # stuff in module foo, but links to module foo won't lead here. env = state.document.settings.env modname = arguments[0].strip() - env.currmodule = modname + if modname == 'None': + env.currmodule = None + else: + env.currmodule = modname return [] currentmodule_directive.arguments = (1, 0, 0) From python-checkins at python.org Fri Jul 4 16:27:25 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 16:27:25 +0200 (CEST) Subject: [Python-checkins] r64699 - in doctools/trunk: doc/ext/autodoc.rst sphinx/directives/other.py sphinx/roles.py Message-ID: <20080704142725.B88FF1E4003@bag.python.org> Author: georg.brandl Date: Fri Jul 4 16:27:25 2008 New Revision: 64699 Log: Merged revisions 64642-64643,64698 via svnmerge from svn+ssh://pythondev at svn.python.org/doctools/branches/0.4.x ........ r64642 | georg.brandl | 2008-07-01 23:02:35 +0200 (Tue, 01 Jul 2008) | 2 lines #3251: label names are case insensitive. ........ r64643 | georg.brandl | 2008-07-01 23:24:55 +0200 (Tue, 01 Jul 2008) | 2 lines Add a note about decorated functions. ........ r64698 | georg.brandl | 2008-07-04 12:21:09 +0200 (Fri, 04 Jul 2008) | 2 lines Allow setting current module to None. ........ Modified: doctools/trunk/ (props changed) doctools/trunk/doc/ext/autodoc.rst doctools/trunk/sphinx/directives/other.py doctools/trunk/sphinx/roles.py Modified: doctools/trunk/doc/ext/autodoc.rst ============================================================================== --- doctools/trunk/doc/ext/autodoc.rst (original) +++ doctools/trunk/doc/ext/autodoc.rst Fri Jul 4 16:27:25 2008 @@ -136,6 +136,17 @@ These work exactly like :dir:`autoclass` etc., but do not offer the options used for automatic member documentation. + .. note:: + + If you document decorated functions or methods, keep in mind that autodoc + retrieves its docstrings by importing the module and inspecting the + ``__doc__`` attribute of the given function or method. That means that if + a decorator replaces the decorated function with another, it must copy the + original ``__doc__`` to the new function. + + From Python 2.5, :func:`functools.wraps` can be used to create + well-behaved decorating functions. + There are also new config values that you can set: Modified: doctools/trunk/sphinx/directives/other.py ============================================================================== --- doctools/trunk/sphinx/directives/other.py (original) +++ doctools/trunk/sphinx/directives/other.py Fri Jul 4 16:27:25 2008 @@ -117,7 +117,10 @@ # stuff in module foo, but links to module foo won't lead here. env = state.document.settings.env modname = arguments[0].strip() - env.currmodule = modname + if modname == 'None': + env.currmodule = None + else: + env.currmodule = modname return [] currentmodule_directive.arguments = (1, 0, 0) Modified: doctools/trunk/sphinx/roles.py ============================================================================== --- doctools/trunk/sphinx/roles.py (original) +++ doctools/trunk/sphinx/roles.py Fri Jul 4 16:27:25 2008 @@ -175,6 +175,9 @@ # normalize whitespace in definition terms (if the term reference is # broken over a line, a newline will be in target) target = ws_re.sub(' ', target).lower() + elif typ == 'ref': + # reST label names are always lowercased + target = ws_re.sub('', target).lower() else: # remove all whitespace to avoid referencing problems target = ws_re.sub('', target) From buildbot at python.org Fri Jul 4 18:10:50 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 16:10:50 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080704161054.7F8A01E4003@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/137 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_format ====================================================================== FAIL: test_format (test.test_format.FormatTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_format.py", line 219, in test_format testformat("%r", "\u0370", "'\u0370'") File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_format.py", line 41, in testformat (formatstr, args, result, output)) AssertionError: '%r' % '\u0370' == "'\\u0370'" != "'\u0370'" make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 18:33:21 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 16:33:21 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080704163321.E22A01E4003@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/235 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_format ====================================================================== FAIL: test_format (test.test_format.FormatTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_format.py", line 219, in test_format testformat("%r", "\u0370", "'\u0370'") File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_format.py", line 41, in testformat (formatstr, args, result, output)) AssertionError: '%r' % '\u0370' == "'\\u0370'" != "'\u0370'" make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 18:47:54 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 16:47:54 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080704164754.2ADD81E4003@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/577 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_format ====================================================================== FAIL: test_format (test.test_format.FormatTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/test/test_format.py", line 219, in test_format testformat("%r", "\u0370", "'\u0370'") File "/home/pybot/buildarea/3.0.klose-debian-s390/build/Lib/test/test_format.py", line 41, in testformat (formatstr, args, result, output)) AssertionError: '%r' % '\u0370' == "'\\u0370'" != "'\u0370'" make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 18:49:28 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 16:49:28 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080704164928.A96F01E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1081 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_format ====================================================================== FAIL: test_format (test.test_format.FormatTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/test/test_format.py", line 219, in test_format testformat("%r", "\u0370", "'\u0370'") File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/test/test_format.py", line 41, in testformat (formatstr, args, result, output)) AssertionError: '%r' % '\u0370' == "'\\u0370'" != "'\u0370'" make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 19:21:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 17:21:51 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080704172152.0160B1E4012@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/336 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_format ====================================================================== FAIL: test_format (test.test_format.FormatTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_format.py", line 219, in test_format testformat("%r", "\u0370", "'\u0370'") File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_format.py", line 41, in testformat (formatstr, args, result, output)) AssertionError: '%r' % '\u0370' == "'\\u0370'" != "'\u0370'" make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 19:22:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 17:22:07 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080704172207.1F48E1E4003@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/411 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_format test_urllib2 ====================================================================== FAIL: test_format (test.test_format.FormatTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_format.py", line 219, in test_format testformat("%r", "\u0370", "'\u0370'") File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_format.py", line 41, in testformat (formatstr, args, result, output)) AssertionError: '%r' % '\u0370' == "'\\u0370'" != "'\u0370'" ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jul 4 19:22:53 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 19:22:53 +0200 (CEST) Subject: [Python-checkins] r64702 - python/trunk/Doc/library/pickle.rst Message-ID: <20080704172253.90E521E4003@bag.python.org> Author: georg.brandl Date: Fri Jul 4 19:22:53 2008 New Revision: 64702 Log: Give the pickle special methods a signature. Modified: python/trunk/Doc/library/pickle.rst Modified: python/trunk/Doc/library/pickle.rst ============================================================================== --- python/trunk/Doc/library/pickle.rst (original) +++ python/trunk/Doc/library/pickle.rst Fri Jul 4 19:22:53 2008 @@ -396,6 +396,8 @@ The pickle protocol ------------------- +.. currentmodule:: None + This section describes the "pickling protocol" that defines the interface between the pickler/unpickler and the objects that are being serialized. This protocol provides a standard way for you to define, customize, and control how @@ -410,129 +412,126 @@ Pickling and unpickling normal class instances ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. index:: - single: __getinitargs__() (copy protocol) - single: __init__() (instance constructor) - -When a pickled class instance is unpickled, its :meth:`__init__` method is -normally *not* invoked. If it is desirable that the :meth:`__init__` method be -called on unpickling, an old-style class can define a method -:meth:`__getinitargs__`, which should return a *tuple* containing the arguments -to be passed to the class constructor (:meth:`__init__` for example). The -:meth:`__getinitargs__` method is called at pickle time; the tuple it returns is -incorporated in the pickle for the instance. - -.. index:: single: __getnewargs__() (copy protocol) - -New-style types can provide a :meth:`__getnewargs__` method that is used for -protocol 2. Implementing this method is needed if the type establishes some -internal invariants when the instance is created, or if the memory allocation is -affected by the values passed to the :meth:`__new__` method for the type (as it -is for tuples and strings). Instances of a :term:`new-style class` :class:`C` -are created using :: - - obj = C.__new__(C, *args) - - -where *args* is the result of calling :meth:`__getnewargs__` on the original -object; if there is no :meth:`__getnewargs__`, an empty tuple is assumed. - -.. index:: - single: __getstate__() (copy protocol) - single: __setstate__() (copy protocol) - single: __dict__ (instance attribute) - -Classes can further influence how their instances are pickled; if the class -defines the method :meth:`__getstate__`, it is called and the return state is -pickled as the contents for the instance, instead of the contents of the -instance's dictionary. If there is no :meth:`__getstate__` method, the -instance's :attr:`__dict__` is pickled. - -Upon unpickling, if the class also defines the method :meth:`__setstate__`, it -is called with the unpickled state. [#]_ If there is no :meth:`__setstate__` -method, the pickled state must be a dictionary and its items are assigned to the -new instance's dictionary. If a class defines both :meth:`__getstate__` and -:meth:`__setstate__`, the state object needn't be a dictionary and these methods -can do what they want. [#]_ - -.. warning:: - - For :term:`new-style class`\es, if :meth:`__getstate__` returns a false - value, the :meth:`__setstate__` method will not be called. +.. method:: object.__getinitargs__() + + When a pickled class instance is unpickled, its :meth:`__init__` method is + normally *not* invoked. If it is desirable that the :meth:`__init__` method + be called on unpickling, an old-style class can define a method + :meth:`__getinitargs__`, which should return a *tuple* containing the + arguments to be passed to the class constructor (:meth:`__init__` for + example). The :meth:`__getinitargs__` method is called at pickle time; the + tuple it returns is incorporated in the pickle for the instance. + +.. method:: object.__getnewargs__() + + New-style types can provide a :meth:`__getnewargs__` method that is used for + protocol 2. Implementing this method is needed if the type establishes some + internal invariants when the instance is created, or if the memory allocation + is affected by the values passed to the :meth:`__new__` method for the type + (as it is for tuples and strings). Instances of a :term:`new-style class` + ``C`` are created using :: + + obj = C.__new__(C, *args) + + where *args* is the result of calling :meth:`__getnewargs__` on the original + object; if there is no :meth:`__getnewargs__`, an empty tuple is assumed. + +.. method:: object.__getstate__() + + Classes can further influence how their instances are pickled; if the class + defines the method :meth:`__getstate__`, it is called and the return state is + pickled as the contents for the instance, instead of the contents of the + instance's dictionary. If there is no :meth:`__getstate__` method, the + instance's :attr:`__dict__` is pickled. + +.. method:: object.__setstate__() + + Upon unpickling, if the class also defines the method :meth:`__setstate__`, + it is called with the unpickled state. [#]_ If there is no + :meth:`__setstate__` method, the pickled state must be a dictionary and its + items are assigned to the new instance's dictionary. If a class defines both + :meth:`__getstate__` and :meth:`__setstate__`, the state object needn't be a + dictionary and these methods can do what they want. [#]_ + + .. warning:: + + For :term:`new-style class`\es, if :meth:`__getstate__` returns a false + value, the :meth:`__setstate__` method will not be called. Pickling and unpickling extension types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. index:: - single: __reduce__() (pickle protocol) - single: __reduce_ex__() (pickle protocol) - single: __safe_for_unpickling__ (pickle protocol) - -When the :class:`Pickler` encounters an object of a type it knows nothing about ---- such as an extension type --- it looks in two places for a hint of how to -pickle it. One alternative is for the object to implement a :meth:`__reduce__` -method. If provided, at pickling time :meth:`__reduce__` will be called with no -arguments, and it must return either a string or a tuple. - -If a string is returned, it names a global variable whose contents are pickled -as normal. The string returned by :meth:`__reduce__` should be the object's -local name relative to its module; the pickle module searches the module -namespace to determine the object's module. - -When a tuple is returned, it must be between two and five elements long. -Optional elements can either be omitted, or ``None`` can be provided as their -value. The contents of this tuple are pickled as normal and used to -reconstruct the object at unpickling time. The semantics of each element are: - -* A callable object that will be called to create the initial version of the - object. The next element of the tuple will provide arguments for this callable, - and later elements provide additional state information that will subsequently - be used to fully reconstruct the pickled data. - - In the unpickling environment this object must be either a class, a callable - registered as a "safe constructor" (see below), or it must have an attribute - :attr:`__safe_for_unpickling__` with a true value. Otherwise, an - :exc:`UnpicklingError` will be raised in the unpickling environment. Note that - as usual, the callable itself is pickled by name. - -* A tuple of arguments for the callable object. - - .. versionchanged:: 2.5 - Formerly, this argument could also be ``None``. - -* Optionally, the object's state, which will be passed to the object's - :meth:`__setstate__` method as described in section :ref:`pickle-inst`. If the - object has no :meth:`__setstate__` method, then, as above, the value must be a - dictionary and it will be added to the object's :attr:`__dict__`. - -* Optionally, an iterator (and not a sequence) yielding successive list items. - These list items will be pickled, and appended to the object using either - ``obj.append(item)`` or ``obj.extend(list_of_items)``. This is primarily used - for list subclasses, but may be used by other classes as long as they have - :meth:`append` and :meth:`extend` methods with the appropriate signature. - (Whether :meth:`append` or :meth:`extend` is used depends on which pickle - protocol version is used as well as the number of items to append, so both must - be supported.) - -* Optionally, an iterator (not a sequence) yielding successive dictionary items, - which should be tuples of the form ``(key, value)``. These items will be - pickled and stored to the object using ``obj[key] = value``. This is primarily - used for dictionary subclasses, but may be used by other classes as long as they - implement :meth:`__setitem__`. - -It is sometimes useful to know the protocol version when implementing -:meth:`__reduce__`. This can be done by implementing a method named -:meth:`__reduce_ex__` instead of :meth:`__reduce__`. :meth:`__reduce_ex__`, when -it exists, is called in preference over :meth:`__reduce__` (you may still -provide :meth:`__reduce__` for backwards compatibility). The -:meth:`__reduce_ex__` method will be called with a single integer argument, the -protocol version. - -The :class:`object` class implements both :meth:`__reduce__` and -:meth:`__reduce_ex__`; however, if a subclass overrides :meth:`__reduce__` but -not :meth:`__reduce_ex__`, the :meth:`__reduce_ex__` implementation detects this -and calls :meth:`__reduce__`. +.. method:: object.__reduce__() + + When the :class:`Pickler` encounters an object of a type it knows nothing + about --- such as an extension type --- it looks in two places for a hint of + how to pickle it. One alternative is for the object to implement a + :meth:`__reduce__` method. If provided, at pickling time :meth:`__reduce__` + will be called with no arguments, and it must return either a string or a + tuple. + + If a string is returned, it names a global variable whose contents are + pickled as normal. The string returned by :meth:`__reduce__` should be the + object's local name relative to its module; the pickle module searches the + module namespace to determine the object's module. + + When a tuple is returned, it must be between two and five elements long. + Optional elements can either be omitted, or ``None`` can be provided as their + value. The contents of this tuple are pickled as normal and used to + reconstruct the object at unpickling time. The semantics of each element + are: + + * A callable object that will be called to create the initial version of the + object. The next element of the tuple will provide arguments for this + callable, and later elements provide additional state information that will + subsequently be used to fully reconstruct the pickled data. + + In the unpickling environment this object must be either a class, a + callable registered as a "safe constructor" (see below), or it must have an + attribute :attr:`__safe_for_unpickling__` with a true value. Otherwise, an + :exc:`UnpicklingError` will be raised in the unpickling environment. Note + that as usual, the callable itself is pickled by name. + + * A tuple of arguments for the callable object. + + .. versionchanged:: 2.5 + Formerly, this argument could also be ``None``. + + * Optionally, the object's state, which will be passed to the object's + :meth:`__setstate__` method as described in section :ref:`pickle-inst`. If + the object has no :meth:`__setstate__` method, then, as above, the value + must be a dictionary and it will be added to the object's :attr:`__dict__`. + + * Optionally, an iterator (and not a sequence) yielding successive list + items. These list items will be pickled, and appended to the object using + either ``obj.append(item)`` or ``obj.extend(list_of_items)``. This is + primarily used for list subclasses, but may be used by other classes as + long as they have :meth:`append` and :meth:`extend` methods with the + appropriate signature. (Whether :meth:`append` or :meth:`extend` is used + depends on which pickle protocol version is used as well as the number of + items to append, so both must be supported.) + + * Optionally, an iterator (not a sequence) yielding successive dictionary + items, which should be tuples of the form ``(key, value)``. These items + will be pickled and stored to the object using ``obj[key] = value``. This + is primarily used for dictionary subclasses, but may be used by other + classes as long as they implement :meth:`__setitem__`. + +.. method:: object.__reduce_ex__(protocol) + + It is sometimes useful to know the protocol version when implementing + :meth:`__reduce__`. This can be done by implementing a method named + :meth:`__reduce_ex__` instead of :meth:`__reduce__`. :meth:`__reduce_ex__`, + when it exists, is called in preference over :meth:`__reduce__` (you may + still provide :meth:`__reduce__` for backwards compatibility). The + :meth:`__reduce_ex__` method will be called with a single integer argument, + the protocol version. + + The :class:`object` class implements both :meth:`__reduce__` and + :meth:`__reduce_ex__`; however, if a subclass overrides :meth:`__reduce__` + but not :meth:`__reduce_ex__`, the :meth:`__reduce_ex__` implementation + detects this and calls :meth:`__reduce__`. An alternative to implementing a :meth:`__reduce__` method on the object to be pickled, is to register the callable with the :mod:`copy_reg` module. This From python-checkins at python.org Fri Jul 4 19:24:01 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 19:24:01 +0200 (CEST) Subject: [Python-checkins] r64703 - in doctools/branches/0.4.x: CHANGES sphinx/linkcheck.py Message-ID: <20080704172401.184A91E4004@bag.python.org> Author: georg.brandl Date: Fri Jul 4 19:24:00 2008 New Revision: 64703 Log: Fix linkcheck builder crash for malformed URLs. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/linkcheck.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Fri Jul 4 19:24:00 2008 @@ -6,6 +6,8 @@ * Label names in references are now case-insensitive, since reST label names are always lowercased. +* Fix linkcheck builder crash for malformed URLs. + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/sphinx/linkcheck.py ============================================================================== --- doctools/branches/0.4.x/sphinx/linkcheck.py (original) +++ doctools/branches/0.4.x/sphinx/linkcheck.py Fri Jul 4 19:24:00 2008 @@ -64,12 +64,13 @@ if uri in self.good: return + lineno = None + while lineno is None and node: + node = node.parent + lineno = node.line + if uri[0:5] == 'http:' or uri[0:6] == 'https:': self.info(uri, nonl=1) - lineno = None - while lineno is None and node: - node = node.parent - lineno = node.line if uri in self.broken: (r, s) = self.broken[uri] From python-checkins at python.org Fri Jul 4 19:32:41 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 19:32:41 +0200 (CEST) Subject: [Python-checkins] r64704 - in doctools/branches/0.4.x: CHANGES sphinx/htmlwriter.py Message-ID: <20080704173241.28BB81E4003@bag.python.org> Author: georg.brandl Date: Fri Jul 4 19:32:40 2008 New Revision: 64704 Log: Add 0.5 compatibility for more admonitions. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/htmlwriter.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Fri Jul 4 19:32:40 2008 @@ -8,6 +8,8 @@ * Fix linkcheck builder crash for malformed URLs. +* Add compatibility for admonitions and docutils 0.5. + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/sphinx/htmlwriter.py ============================================================================== --- doctools/branches/0.4.x/sphinx/htmlwriter.py (original) +++ doctools/branches/0.4.x/sphinx/htmlwriter.py Fri Jul 4 19:32:40 2008 @@ -285,18 +285,55 @@ def depart_module(self, node): pass - # docutils 0.5 compatibility + # these are all for docutils 0.5 compatibility + def visit_note(self, node): self.visit_admonition(node, 'note') def depart_note(self, node): self.depart_admonition(node) - # docutils 0.5 compatibility def visit_warning(self, node): self.visit_admonition(node, 'warning') def depart_warning(self, node): self.depart_admonition(node) + def visit_attention(self, node): + self.visit_admonition(node, 'attention') + + def depart_attention(self, node): + self.depart_admonition() + + def visit_caution(self, node): + self.visit_admonition(node, 'caution') + def depart_caution(self, node): + self.depart_admonition() + + def visit_danger(self, node): + self.visit_admonition(node, 'danger') + def depart_danger(self, node): + self.depart_admonition() + + def visit_error(self, node): + self.visit_admonition(node, 'error') + def depart_error(self, node): + self.depart_admonition() + + def visit_hint(self, node): + self.visit_admonition(node, 'hint') + def depart_hint(self, node): + self.depart_admonition() + + def visit_important(self, node): + self.visit_admonition(node, 'important') + def depart_important(self, node): + self.depart_admonition() + + def visit_tip(self, node): + self.visit_admonition(node, 'tip') + def depart_tip(self, node): + self.depart_admonition() + + # these are only handled specially in the SmartyPantsHTMLTranslator def visit_literal_emphasis(self, node): return self.visit_emphasis(node) From python-checkins at python.org Fri Jul 4 19:38:38 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 19:38:38 +0200 (CEST) Subject: [Python-checkins] r64705 - in doctools/branches/0.4.x: CHANGES sphinx/latexwriter.py Message-ID: <20080704173838.38C611E4003@bag.python.org> Author: georg.brandl Date: Fri Jul 4 19:38:37 2008 New Revision: 64705 Log: Remove silly "rubric" restriction in latex writer. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/latexwriter.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Fri Jul 4 19:38:37 2008 @@ -3,13 +3,17 @@ * Added sub-/superscript node handling to TextBuilder. -* Label names in references are now case-insensitive, since reST label - names are always lowercased. +* Label names in references are now case-insensitive, since reST + label names are always lowercased. * Fix linkcheck builder crash for malformed URLs. * Add compatibility for admonitions and docutils 0.5. +* Remove the silly restriction on "rubric" in the LaTeX writer: you + can now write arbitrary "rubric" directives, and only those with + a title of "Footnotes" will be ignored. + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/sphinx/latexwriter.py ============================================================================== --- doctools/branches/0.4.x/sphinx/latexwriter.py (original) +++ doctools/branches/0.4.x/sphinx/latexwriter.py Fri Jul 4 19:38:37 2008 @@ -419,8 +419,10 @@ def visit_rubric(self, node): if len(node.children) == 1 and node.children[0].astext() == 'Footnotes': raise nodes.SkipNode - self.builder.warn('encountered rubric node not used for footnotes, ' - 'content will be lost') + self.body.append('\\paragraph{') + self.context.append('}\n') + def depart_rubric(self, node): + self.body.append(self.context.pop()) def visit_footnote(self, node): # XXX not optimal, footnotes are at section end From python-checkins at python.org Fri Jul 4 19:41:44 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 19:41:44 +0200 (CEST) Subject: [Python-checkins] r64706 - doctools/branches/0.4.x/doc/markup/para.rst Message-ID: <20080704174144.4BFB21E4003@bag.python.org> Author: georg.brandl Date: Fri Jul 4 19:41:44 2008 New Revision: 64706 Log: Document rubric:: Footnotes behavior. Modified: doctools/branches/0.4.x/doc/markup/para.rst Modified: doctools/branches/0.4.x/doc/markup/para.rst ============================================================================== --- doctools/branches/0.4.x/doc/markup/para.rst (original) +++ doctools/branches/0.4.x/doc/markup/para.rst Fri Jul 4 19:41:44 2008 @@ -77,7 +77,14 @@ .. directive:: .. rubric:: title This directive creates a paragraph heading that is not used to create a - table of contents node. It is currently used for the "Footnotes" caption. + table of contents node. + + .. note:: + + If the *title* of the rubric is "Footnotes", this rubric is ignored by + the LaTeX writer, since it is assumed to only contain footnote + definitions and therefore would create an empty heading. + .. directive:: centered From python-checkins at python.org Fri Jul 4 19:45:29 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 19:45:29 +0200 (CEST) Subject: [Python-checkins] r64707 - doctools/branches/0.4.x/doc/_templates/layout.html Message-ID: <20080704174529.3DC4E1E4003@bag.python.org> Author: georg.brandl Date: Fri Jul 4 19:45:28 2008 New Revision: 64707 Log: Fix XHTML. Modified: doctools/branches/0.4.x/doc/_templates/layout.html Modified: doctools/branches/0.4.x/doc/_templates/layout.html ============================================================================== --- doctools/branches/0.4.x/doc/_templates/layout.html (original) +++ doctools/branches/0.4.x/doc/_templates/layout.html Fri Jul 4 19:45:28 2008 @@ -7,7 +7,7 @@ {% block relbar1 %}
- +
{{ super() }} {% endblock %} From python-checkins at python.org Fri Jul 4 19:50:57 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 19:50:57 +0200 (CEST) Subject: [Python-checkins] r64708 - in doctools/branches/0.4.x/doc/_templates: index.html layout.html Message-ID: <20080704175057.098D41E4003@bag.python.org> Author: georg.brandl Date: Fri Jul 4 19:50:56 2008 New Revision: 64708 Log: More XHTML fixes. Modified: doctools/branches/0.4.x/doc/_templates/index.html doctools/branches/0.4.x/doc/_templates/layout.html Modified: doctools/branches/0.4.x/doc/_templates/index.html ============================================================================== --- doctools/branches/0.4.x/doc/_templates/index.html (original) +++ doctools/branches/0.4.x/doc/_templates/index.html Fri Jul 4 19:50:56 2008 @@ -48,14 +48,14 @@

Documentation

- - - -
Modified: doctools/branches/0.4.x/doc/_templates/layout.html ============================================================================== --- doctools/branches/0.4.x/doc/_templates/layout.html (original) +++ doctools/branches/0.4.x/doc/_templates/layout.html Fri Jul 4 19:50:56 2008 @@ -7,7 +7,7 @@ {% block relbar1 %}

- +Sphinx logo
{{ super() }} {% endblock %} From python-checkins at python.org Fri Jul 4 19:59:56 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 19:59:56 +0200 (CEST) Subject: [Python-checkins] r64710 - in doctools/branches/0.4.x: CHANGES doc/config.rst sphinx/builder.py Message-ID: <20080704175956.81CEC1E4003@bag.python.org> Author: georg.brandl Date: Fri Jul 4 19:59:56 2008 New Revision: 64710 Log: Copy the html_logo to the output static dir. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/doc/config.rst doctools/branches/0.4.x/sphinx/builder.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Fri Jul 4 19:59:56 2008 @@ -14,6 +14,8 @@ can now write arbitrary "rubric" directives, and only those with a title of "Footnotes" will be ignored. +* Copy the HTML logo to the output "_static" directory. + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/doc/config.rst ============================================================================== --- doctools/branches/0.4.x/doc/config.rst (original) +++ doctools/branches/0.4.x/doc/config.rst Fri Jul 4 19:59:56 2008 @@ -215,9 +215,13 @@ .. confval:: html_logo - If given, this must be the name of an image file (within the static path, see - below) that is the logo of the docs. It is placed at the top of the sidebar; - its width should therefore not exceed 200 pixels. Default: ``None``. + If given, this must be the name of an image file that is the logo of the + docs. It is placed at the top of the sidebar; its width should therefore not + exceed 200 pixels. Default: ``None``. + + .. versionadded:: 0.4.1 + The image file will be copied to the ``_static`` directory of the output + HTML, so an already existing file with that name will be overwritten. .. confval:: html_favicon Modified: doctools/branches/0.4.x/sphinx/builder.py ============================================================================== --- doctools/branches/0.4.x/sphinx/builder.py (original) +++ doctools/branches/0.4.x/sphinx/builder.py Fri Jul 4 19:59:56 2008 @@ -590,6 +590,11 @@ elif path.isdir(fullname): shutil.rmtree(targetname) shutil.copytree(fullname, targetname) + # copy logo file (handled differently) + if self.config.html_logo: + logobase = path.basename(self.config.html_logo) + shutil.copyfile(path.join(self.confdir, self.config.html_logo), + path.join(self.outdir, '_static', logobase)) # add pygments style file f = open(path.join(self.outdir, '_static', 'pygments.css'), 'w') f.write(PygmentsBridge('html', self.config.pygments_style).get_stylesheet()) From buildbot at python.org Fri Jul 4 20:08:08 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 18:08:08 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080704180808.C419E1E4003@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1185 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Fri Jul 4 20:37:44 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 20:37:44 +0200 (CEST) Subject: [Python-checkins] r64711 - in doctools/branches/0.4.x: CHANGES sphinx/texinputs/sphinx.sty Message-ID: <20080704183744.172A51E4003@bag.python.org> Author: georg.brandl Date: Fri Jul 4 20:37:43 2008 New Revision: 64711 Log: Fix latex code for module names with underscores that have platforms. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/texinputs/sphinx.sty Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Fri Jul 4 20:37:43 2008 @@ -16,6 +16,8 @@ * Copy the HTML logo to the output "_static" directory. +* Fix LaTeX code for modules with underscores in names and platforms. + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/sphinx/texinputs/sphinx.sty ============================================================================== --- doctools/branches/0.4.x/sphinx/texinputs/sphinx.sty (original) +++ doctools/branches/0.4.x/sphinx/texinputs/sphinx.sty Fri Jul 4 20:37:43 2008 @@ -261,7 +261,7 @@ \@ifundefined{py at modplat@\py at thismodulekey}{ \write\modindexfile{\protect\indexentry{#1@{\texttt{#1}}|hyperpage}{\thepage}}% }{\write\modindexfile{\protect\indexentry{#1@{\texttt{#1 }% - \emph{(\platformof{#1})}}|hyperpage}{\thepage}}% + \emph{(\platformof{\py at thismodulekey})}}|hyperpage}{\thepage}}% } \fi% } From python-checkins at python.org Fri Jul 4 20:46:40 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 20:46:40 +0200 (CEST) Subject: [Python-checkins] r64712 - in doctools/branches/0.4.x: CHANGES sphinx/builder.py sphinx/environment.py Message-ID: <20080704184640.EC8FC1E4003@bag.python.org> Author: georg.brandl Date: Fri Jul 4 20:46:40 2008 New Revision: 64712 Log: Fix a crash with nonlocal image URIs. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/builder.py doctools/branches/0.4.x/sphinx/environment.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Fri Jul 4 20:46:40 2008 @@ -18,6 +18,8 @@ * Fix LaTeX code for modules with underscores in names and platforms. +* Fix a crash with nonlocal image URIs. + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/sphinx/builder.py ============================================================================== --- doctools/branches/0.4.x/sphinx/builder.py (original) +++ doctools/branches/0.4.x/sphinx/builder.py Fri Jul 4 20:46:40 2008 @@ -128,6 +128,9 @@ Pick the best candidate for all image URIs. """ for node in doctree.traverse(nodes.image): + if '?' in node['candidates']: + # don't rewrite nonlocal image URIs + continue if '*' not in node['candidates']: for imgtype in self.supported_image_types: candidate = node['candidates'].get(imgtype, None) Modified: doctools/branches/0.4.x/sphinx/environment.py ============================================================================== --- doctools/branches/0.4.x/sphinx/environment.py (original) +++ doctools/branches/0.4.x/sphinx/environment.py Fri Jul 4 20:46:40 2008 @@ -534,11 +534,12 @@ # Map the mimetype to the corresponding image. The writer may # choose the best image from these candidates. The special key * is # set if there is only single candiate to be used by a writer. + # The special key ? is set for nonlocal URIs. node['candidates'] = candidates = {} imguri = node['uri'] if imguri.find('://') != -1: self.warn(docname, 'Nonlocal image URI found: %s' % imguri, node.line) - candidates['*'] = imguri + candidates['?'] = imguri continue imgpath = path.normpath(path.join(docdir, imguri)) node['uri'] = imgpath From python-checkins at python.org Fri Jul 4 20:49:40 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 20:49:40 +0200 (CEST) Subject: [Python-checkins] r64713 - in doctools/trunk: doc/_templates/index.html doc/_templates/layout.html doc/config.rst doc/markup/para.rst sphinx/builder.py sphinx/environment.py sphinx/htmlwriter.py sphinx/latexwriter.py sphinx/linkcheck.py sphinx/texinputs/sphinx.sty Message-ID: <20080704184940.3A6391E4003@bag.python.org> Author: georg.brandl Date: Fri Jul 4 20:49:39 2008 New Revision: 64713 Log: Merged revisions 64703-64708,64710-64712 via svnmerge from svn+ssh://pythondev at svn.python.org/doctools/branches/0.4.x ........ r64703 | georg.brandl | 2008-07-04 19:24:00 +0200 (Fri, 04 Jul 2008) | 2 lines Fix linkcheck builder crash for malformed URLs. ........ r64704 | georg.brandl | 2008-07-04 19:32:40 +0200 (Fri, 04 Jul 2008) | 2 lines Add 0.5 compatibility for more admonitions. ........ r64705 | georg.brandl | 2008-07-04 19:38:37 +0200 (Fri, 04 Jul 2008) | 2 lines Remove silly "rubric" restriction in latex writer. ........ r64706 | georg.brandl | 2008-07-04 19:41:44 +0200 (Fri, 04 Jul 2008) | 2 lines Document rubric:: Footnotes behavior. ........ r64707 | georg.brandl | 2008-07-04 19:45:28 +0200 (Fri, 04 Jul 2008) | 2 lines Fix XHTML. ........ r64708 | georg.brandl | 2008-07-04 19:50:56 +0200 (Fri, 04 Jul 2008) | 2 lines More XHTML fixes. ........ r64710 | georg.brandl | 2008-07-04 19:59:56 +0200 (Fri, 04 Jul 2008) | 2 lines Copy the html_logo to the output static dir. ........ r64711 | georg.brandl | 2008-07-04 20:37:43 +0200 (Fri, 04 Jul 2008) | 2 lines Fix latex code for module names with underscores that have platforms. ........ r64712 | georg.brandl | 2008-07-04 20:46:40 +0200 (Fri, 04 Jul 2008) | 2 lines Fix a crash with nonlocal image URIs. ........ Modified: doctools/trunk/ (props changed) doctools/trunk/doc/_templates/index.html doctools/trunk/doc/_templates/layout.html doctools/trunk/doc/config.rst doctools/trunk/doc/markup/para.rst doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/environment.py doctools/trunk/sphinx/htmlwriter.py doctools/trunk/sphinx/latexwriter.py doctools/trunk/sphinx/linkcheck.py doctools/trunk/sphinx/texinputs/sphinx.sty Modified: doctools/trunk/doc/_templates/index.html ============================================================================== --- doctools/trunk/doc/_templates/index.html (original) +++ doctools/trunk/doc/_templates/index.html Fri Jul 4 20:49:39 2008 @@ -48,14 +48,14 @@

Documentation

- - - -
Modified: doctools/trunk/doc/_templates/layout.html ============================================================================== --- doctools/trunk/doc/_templates/layout.html (original) +++ doctools/trunk/doc/_templates/layout.html Fri Jul 4 20:49:39 2008 @@ -7,7 +7,7 @@ {% block relbar1 %}
- +Sphinx logo
{{ super() }} {% endblock %} Modified: doctools/trunk/doc/config.rst ============================================================================== --- doctools/trunk/doc/config.rst (original) +++ doctools/trunk/doc/config.rst Fri Jul 4 20:49:39 2008 @@ -215,9 +215,13 @@ .. confval:: html_logo - If given, this must be the name of an image file (within the static path, see - below) that is the logo of the docs. It is placed at the top of the sidebar; - its width should therefore not exceed 200 pixels. Default: ``None``. + If given, this must be the name of an image file that is the logo of the + docs. It is placed at the top of the sidebar; its width should therefore not + exceed 200 pixels. Default: ``None``. + + .. versionadded:: 0.4.1 + The image file will be copied to the ``_static`` directory of the output + HTML, so an already existing file with that name will be overwritten. .. confval:: html_favicon Modified: doctools/trunk/doc/markup/para.rst ============================================================================== --- doctools/trunk/doc/markup/para.rst (original) +++ doctools/trunk/doc/markup/para.rst Fri Jul 4 20:49:39 2008 @@ -77,7 +77,14 @@ .. directive:: .. rubric:: title This directive creates a paragraph heading that is not used to create a - table of contents node. It is currently used for the "Footnotes" caption. + table of contents node. + + .. note:: + + If the *title* of the rubric is "Footnotes", this rubric is ignored by + the LaTeX writer, since it is assumed to only contain footnote + definitions and therefore would create an empty heading. + .. directive:: centered Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Fri Jul 4 20:49:39 2008 @@ -128,6 +128,9 @@ Pick the best candidate for all image URIs. """ for node in doctree.traverse(nodes.image): + if '?' in node['candidates']: + # don't rewrite nonlocal image URIs + continue if '*' not in node['candidates']: for imgtype in self.supported_image_types: candidate = node['candidates'].get(imgtype, None) @@ -590,6 +593,11 @@ elif path.isdir(fullname): shutil.rmtree(targetname) shutil.copytree(fullname, targetname) + # copy logo file (handled differently) + if self.config.html_logo: + logobase = path.basename(self.config.html_logo) + shutil.copyfile(path.join(self.confdir, self.config.html_logo), + path.join(self.outdir, '_static', logobase)) # add pygments style file f = open(path.join(self.outdir, '_static', 'pygments.css'), 'w') f.write(PygmentsBridge('html', self.config.pygments_style).get_stylesheet()) Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Fri Jul 4 20:49:39 2008 @@ -534,11 +534,12 @@ # Map the mimetype to the corresponding image. The writer may # choose the best image from these candidates. The special key * is # set if there is only single candiate to be used by a writer. + # The special key ? is set for nonlocal URIs. node['candidates'] = candidates = {} imguri = node['uri'] if imguri.find('://') != -1: self.warn(docname, 'Nonlocal image URI found: %s' % imguri, node.line) - candidates['*'] = imguri + candidates['?'] = imguri continue imgpath = path.normpath(path.join(docdir, imguri)) node['uri'] = imgpath Modified: doctools/trunk/sphinx/htmlwriter.py ============================================================================== --- doctools/trunk/sphinx/htmlwriter.py (original) +++ doctools/trunk/sphinx/htmlwriter.py Fri Jul 4 20:49:39 2008 @@ -285,18 +285,55 @@ def depart_module(self, node): pass - # docutils 0.5 compatibility + # these are all for docutils 0.5 compatibility + def visit_note(self, node): self.visit_admonition(node, 'note') def depart_note(self, node): self.depart_admonition(node) - # docutils 0.5 compatibility def visit_warning(self, node): self.visit_admonition(node, 'warning') def depart_warning(self, node): self.depart_admonition(node) + def visit_attention(self, node): + self.visit_admonition(node, 'attention') + + def depart_attention(self, node): + self.depart_admonition() + + def visit_caution(self, node): + self.visit_admonition(node, 'caution') + def depart_caution(self, node): + self.depart_admonition() + + def visit_danger(self, node): + self.visit_admonition(node, 'danger') + def depart_danger(self, node): + self.depart_admonition() + + def visit_error(self, node): + self.visit_admonition(node, 'error') + def depart_error(self, node): + self.depart_admonition() + + def visit_hint(self, node): + self.visit_admonition(node, 'hint') + def depart_hint(self, node): + self.depart_admonition() + + def visit_important(self, node): + self.visit_admonition(node, 'important') + def depart_important(self, node): + self.depart_admonition() + + def visit_tip(self, node): + self.visit_admonition(node, 'tip') + def depart_tip(self, node): + self.depart_admonition() + + # these are only handled specially in the SmartyPantsHTMLTranslator def visit_literal_emphasis(self, node): return self.visit_emphasis(node) Modified: doctools/trunk/sphinx/latexwriter.py ============================================================================== --- doctools/trunk/sphinx/latexwriter.py (original) +++ doctools/trunk/sphinx/latexwriter.py Fri Jul 4 20:49:39 2008 @@ -419,8 +419,10 @@ def visit_rubric(self, node): if len(node.children) == 1 and node.children[0].astext() == 'Footnotes': raise nodes.SkipNode - self.builder.warn('encountered rubric node not used for footnotes, ' - 'content will be lost') + self.body.append('\\paragraph{') + self.context.append('}\n') + def depart_rubric(self, node): + self.body.append(self.context.pop()) def visit_footnote(self, node): # XXX not optimal, footnotes are at section end Modified: doctools/trunk/sphinx/linkcheck.py ============================================================================== --- doctools/trunk/sphinx/linkcheck.py (original) +++ doctools/trunk/sphinx/linkcheck.py Fri Jul 4 20:49:39 2008 @@ -64,12 +64,13 @@ if uri in self.good: return + lineno = None + while lineno is None and node: + node = node.parent + lineno = node.line + if uri[0:5] == 'http:' or uri[0:6] == 'https:': self.info(uri, nonl=1) - lineno = None - while lineno is None and node: - node = node.parent - lineno = node.line if uri in self.broken: (r, s) = self.broken[uri] Modified: doctools/trunk/sphinx/texinputs/sphinx.sty ============================================================================== --- doctools/trunk/sphinx/texinputs/sphinx.sty (original) +++ doctools/trunk/sphinx/texinputs/sphinx.sty Fri Jul 4 20:49:39 2008 @@ -261,7 +261,7 @@ \@ifundefined{py at modplat@\py at thismodulekey}{ \write\modindexfile{\protect\indexentry{#1@{\texttt{#1}}|hyperpage}{\thepage}}% }{\write\modindexfile{\protect\indexentry{#1@{\texttt{#1 }% - \emph{(\platformof{#1})}}|hyperpage}{\thepage}}% + \emph{(\platformof{\py at thismodulekey})}}|hyperpage}{\thepage}}% } \fi% } From python-checkins at python.org Fri Jul 4 21:19:03 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 21:19:03 +0200 (CEST) Subject: [Python-checkins] r64714 - in doctools/branches/0.4.x: CHANGES sphinx/directives/other.py sphinx/ext/autodoc.py Message-ID: <20080704191903.6499A1E4004@bag.python.org> Author: georg.brandl Date: Fri Jul 4 21:19:02 2008 New Revision: 64714 Log: Allow the usage of :noindex: in "automodule" directives, as documented. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/directives/other.py doctools/branches/0.4.x/sphinx/ext/autodoc.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Fri Jul 4 21:19:02 2008 @@ -20,6 +20,9 @@ * Fix a crash with nonlocal image URIs. +* Allow the usage of :noindex: in "automodule" directives, as + documented. + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/sphinx/directives/other.py ============================================================================== --- doctools/branches/0.4.x/sphinx/directives/other.py (original) +++ doctools/branches/0.4.x/sphinx/directives/other.py Fri Jul 4 21:19:02 2008 @@ -83,6 +83,7 @@ content_offset, block_text, state, state_machine): env = state.document.settings.env modname = arguments[0].strip() + noindex = 'noindex' in options env.currmodule = modname env.note_module(modname, options.get('synopsis', ''), options.get('platform', ''), @@ -100,13 +101,15 @@ node += nodes.Text(options['platform'], options['platform']) ret.append(node) # the synopsis isn't printed; in fact, it is only used in the modindex currently - env.note_index_entry('single', '%s (module)' % modname, 'module-' + modname, - modname) + if not noindex: + env.note_index_entry('single', '%s (module)' % modname, + 'module-' + modname, modname) return ret module_directive.arguments = (1, 0, 0) module_directive.options = {'platform': lambda x: x, 'synopsis': lambda x: x, + 'noindex': directives.flag, 'deprecated': directives.flag} directives.register_directive('module', module_directive) Modified: doctools/branches/0.4.x/sphinx/ext/autodoc.py ============================================================================== --- doctools/branches/0.4.x/sphinx/ext/autodoc.py (original) +++ doctools/branches/0.4.x/sphinx/ext/autodoc.py Fri Jul 4 21:19:02 2008 @@ -525,7 +525,10 @@ def auto_directive(*args, **kwds): return _auto_directive(*args, **kwds) -def auto_directive_withmembers(*args, **kwds): +def automodule_directive(*args, **kwds): + return _auto_directive(*args, **kwds) + +def autoclass_directive(*args, **kwds): return _auto_directive(*args, **kwds) @@ -541,11 +544,11 @@ cls_options = {'members': members_option, 'undoc-members': directives.flag, 'noindex': directives.flag, 'inherited-members': directives.flag, 'show-inheritance': directives.flag} - app.add_directive('automodule', auto_directive_withmembers, + app.add_directive('automodule', automodule_directive, 1, (1, 0, 1), **mod_options) - app.add_directive('autoclass', auto_directive_withmembers, + app.add_directive('autoclass', autoclass_directive, 1, (1, 0, 1), **cls_options) - app.add_directive('autoexception', auto_directive_withmembers, + app.add_directive('autoexception', autoclass_directive, 1, (1, 0, 1), **cls_options) app.add_directive('autofunction', auto_directive, 1, (1, 0, 1), noindex=directives.flag) From python-checkins at python.org Fri Jul 4 21:30:22 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 4 Jul 2008 21:30:22 +0200 (CEST) Subject: [Python-checkins] r64715 - in doctools/branches/0.4.x: CHANGES sphinx/ext/autodoc.py Message-ID: <20080704193022.AD7891E4004@bag.python.org> Author: georg.brandl Date: Fri Jul 4 21:30:22 2008 New Revision: 64715 Log: Fix the delete() docstring processor function. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/ext/autodoc.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Fri Jul 4 21:30:22 2008 @@ -14,15 +14,17 @@ can now write arbitrary "rubric" directives, and only those with a title of "Footnotes" will be ignored. -* Copy the HTML logo to the output "_static" directory. +* Copy the HTML logo to the output ``_static`` directory. * Fix LaTeX code for modules with underscores in names and platforms. * Fix a crash with nonlocal image URIs. -* Allow the usage of :noindex: in "automodule" directives, as +* Allow the usage of :noindex: in ``automodule`` directives, as documented. +* Fix the ``delete()`` docstring processor function in autodoc. + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/sphinx/ext/autodoc.py ============================================================================== --- doctools/branches/0.4.x/sphinx/ext/autodoc.py (original) +++ doctools/branches/0.4.x/sphinx/ext/autodoc.py Fri Jul 4 21:30:22 2008 @@ -113,25 +113,33 @@ del lines[-post:] return process -def between(marker, what=None): +def between(marker, what=None, keepempty=False): """ - Return a listener that only keeps lines between the first two lines that - match the *marker* regular expression. If *what* is a sequence of strings, - only docstrings of a type in *what* will be processed. + Return a listener that only keeps lines between lines that match the + *marker* regular expression. If no line matches, the resulting docstring + would be empty, so no change will be made unless *keepempty* is true. + + If *what* is a sequence of strings, only docstrings of a type in *what* will + be processed. """ marker_re = re.compile(marker) def process(app, what_, name, obj, options, lines): if what and what_ not in what: return - seen = 0 - for i, line in enumerate(lines[:]): + deleted = 0 + delete = True + orig_lines = lines[:] + for i, line in enumerate(orig_lines): + if delete: + lines.pop(i - deleted) + deleted += 1 if marker_re.match(line): - if not seen: - del lines[:i+1] - seen = i+1 - else: - del lines[i-seen:] - break + delete = not delete + if delete: + lines.pop(i - deleted) + deleted += 1 + if not lines and not keepempty: + lines[:] = orig_lines return process From buildbot at python.org Fri Jul 4 22:22:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 20:22:36 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080704202236.9896B1E4003@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1215 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 23:18:59 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 21:18:59 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080704211859.D5CEA1E4003@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/338 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_compile make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 23:19:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 21:19:35 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080704211935.51D7B1E4003@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/413 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 23:32:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 21:32:43 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080704213244.05A061E4003@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/140 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 23:32:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 21:32:47 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080704213247.81AA71E4003@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/733 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 23:32:58 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 21:32:58 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080704213258.A5AB41E4003@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/238 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 23:33:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 21:33:36 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080704213336.294FD1E4003@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/580 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Fri Jul 4 23:33:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 04 Jul 2008 21:33:43 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080704213343.612211E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1084 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From collinw at gmail.com Sat Jul 5 03:22:52 2008 From: collinw at gmail.com (Collin Winter) Date: Fri, 4 Jul 2008 18:22:52 -0700 Subject: [Python-checkins] r64651 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py In-Reply-To: <20080702020011.EE4671E4015@bag.python.org> References: <20080702020011.EE4671E4015@bag.python.org> Message-ID: <43aa6ff70807041822w51c1a93fu3867b1c7a87a9f5e@mail.gmail.com> On Tue, Jul 1, 2008 at 7:00 PM, brett.cannon wrote: > Author: brett.cannon > Date: Wed Jul 2 04:00:11 2008 > New Revision: 64651 > > Log: > Update fix_imports for urllib. Had to change the fixer itself to handle modules > that are split across several renames in 3.0. So I realize that you already reverted this, but I thought to comment anyway: this implementation is almost certainly wrong. Any fixer for this particular PEP 3108 change will need to possibly insert extra imports to handle the new urllib.request/error/etc modules. I think this kind of thing should be broken into its own fixer, or at least its own distinct functionality inside of fix_imports. Nick Edds is working to speed up fix_imports by stripping out the member matching stuff, which we don't believe to be actually useful in the majority of module renamings. IMHO there should be two different mappings: one for bare-bones module renames (StringIO -> io), and a separate one for more complex renames, like urllib/urllib2. That will allow optimizing the former larger pattern while preserving flexibility for the rare cases in the latter. Collin > Modified: > sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py > > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py > ============================================================================== > --- sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py (original) > +++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Wed Jul 2 04:00:11 2008 > @@ -272,6 +272,35 @@ > 'commands': ('subprocess', ['getstatusoutput', 'getoutput']), > 'UserString' : ('collections', ['UserString']), > 'UserList' : ('collections', ['UserList']), > + 'urllib' : ( > + 'urllib.request', > + ['URLOpener', 'FancyURLOpener', 'urlretrieve', > + '_urlopener', 'urlcleanup'], > + 'urllib.parse', > + ['quote', 'quote_plus', 'unquote', 'unquote_plus', > + 'urlencode', 'pathname2url', 'url2pathname'], > + 'urllib.error', ['ContentTooShortError'],), > + 'urllib2' : ( > + 'urllib.request', > + ['urlopen', 'install_opener', 'build_opener', > + 'Request', 'OpenerDirector', 'BaseHandler', > + 'HTTPDefaultErrorHandler', 'HTTPRedirectHandler', > + 'HTTPCookieProcessor', 'ProxyHandler', > + 'HTTPPasswordMgr', > + 'HTTPPasswordMgrWithDefaultRealm', > + 'AbstractBasicAuthHandler', > + 'HTTPBasicAuthHandler', 'ProxyBasicAuthHandler', > + 'AbstractDigestAuthHandler', > + 'HTTPDigestAuthHander', 'ProxyDigestAuthHandler', > + 'HTTPHandler', 'HTTPSHandler', 'FileHandler', > + 'FTPHandler', 'CacheFTPHandler', > + 'UnknownHandler'], > + 'urllib.error', ['URLError', 'HTTPError'],), > + 'urlparse' : ('urllib.parse', > + ['urlparse', 'urlunparse', 'urlsplit', > + 'urlunsplit', 'urljoin', 'urldefrag', > + 'ParseResult', 'SplitResult']), > + 'robotparser' : ('urllib.robotparser', ['RobotFileParser']), > } > > > @@ -281,24 +310,26 @@ > > def build_pattern(): > bare = set() > - for old_module, (new_module, members) in MAPPING.items(): > - bare.add(old_module) > - bare.update(members) > - members = alternates(members) > - yield """import_name< 'import' (module=%r > - | dotted_as_names< any* module=%r any* >) > > - """ % (old_module, old_module) > - yield """import_from< 'from' module_name=%r 'import' > - ( %s | import_as_name< %s 'as' any > | > - import_as_names< any* >) > > - """ % (old_module, members, members) > - yield """import_from< 'from' module_name=%r 'import' star='*' > > - """ % old_module > - yield """import_name< 'import' > - dotted_as_name< module_name=%r 'as' any > > > - """ % old_module > - yield """power< module_name=%r trailer< '.' %s > any* > > - """ % (old_module, members) > + for old_module, changes in MAPPING.items(): > + changes_iter = iter(changes) > + for new_module, members in zip(changes_iter, changes_iter): > + bare.add(old_module) > + bare.update(members) > + members = alternates(members) > + yield """import_name< 'import' (module=%r > + | dotted_as_names< any* module=%r any* >) > > + """ % (old_module, old_module) > + yield """import_from< 'from' module_name=%r 'import' > + ( %s | import_as_name< %s 'as' any > | > + import_as_names< any* >) > > + """ % (old_module, members, members) > + yield """import_from< 'from' module_name=%r 'import' star='*' > > + """ % old_module > + yield """import_name< 'import' > + dotted_as_name< module_name=%r 'as' any > > > + """ % old_module > + yield """power< module_name=%r trailer< '.' %s > any* > > + """ % (old_module, members) > yield """bare_name=%s""" % alternates(bare) > > > @@ -328,16 +359,19 @@ > star = results.get("star") > > if import_mod or mod_name: > - new_name, members = MAPPING[(import_mod or mod_name).value] > - > - if import_mod: > - self.replace[import_mod.value] = new_name > - import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) > - elif mod_name: > - if star: > - self.cannot_convert(node, "Cannot handle star imports.") > - else: > - mod_name.replace(Name(new_name, prefix=mod_name.get_prefix())) > + changes = MAPPING[(import_mod or mod_name).value] > + changes_iter = iter(changes) > + for new_name, members in zip(changes_iter, changes_iter): > + if import_mod: > + self.replace[import_mod.value] = new_name > + import_mod.replace(Name(new_name, > + prefix=import_mod.get_prefix())) > + elif mod_name: > + if star: > + self.cannot_convert(node, "Cannot handle star imports.") > + else: > + mod_name.replace(Name(new_name, > + prefix=mod_name.get_prefix())) > elif bare_name: > bare_name = bare_name[0] > new_name = self.replace.get(bare_name.value) > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > From python-checkins at python.org Sat Jul 5 04:11:55 2008 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 5 Jul 2008 04:11:55 +0200 (CEST) Subject: [Python-checkins] r64719 - python/trunk/Python/ceval.c Message-ID: <20080705021155.C88BB1E400F@bag.python.org> Author: raymond.hettinger Date: Sat Jul 5 04:11:55 2008 New Revision: 64719 Log: Update comment on prediction macros. Modified: python/trunk/Python/ceval.c Modified: python/trunk/Python/ceval.c ============================================================================== --- python/trunk/Python/ceval.c (original) +++ python/trunk/Python/ceval.c Sat Jul 5 04:11:55 2008 @@ -615,18 +615,20 @@ COMPARE_OP is often followed by JUMP_IF_FALSE or JUMP_IF_TRUE. And, those opcodes are often followed by a POP_TOP. - Verifying the prediction costs a single high-speed test of register + Verifying the prediction costs a single high-speed test of a register variable against a constant. If the pairing was good, then the - processor has a high likelihood of making its own successful branch - prediction which results in a nearly zero overhead transition to the - next opcode. - - A successful prediction saves a trip through the eval-loop including - its two unpredictable branches, the HAS_ARG test and the switch-case. - - If collecting opcode statistics, turn off prediction so that - statistics are accurately maintained (the predictions bypass - the opcode frequency counter updates). + processor's own internal branch predication has a high likelihood of + success, resulting in a nearly zero-overhead transition to the + next opcode. A successful prediction saves a trip through the eval-loop + including its two unpredictable branches, the HAS_ARG test and the + switch-case. Combined with the processor's internal branch prediction, + a successful PREDICT has the effect of making the two opcodes run as if + they were a single new opcode with the bodies combined. + + If collecting opcode statistics, your choices are to either keep the + predictions turned-on and interpret the results as if some opcodes + had been combined or turn-off predictions so that the opcode frequency + counter updates for both opcodes. */ #ifdef DYNAMIC_EXECUTION_PROFILE From buildbot at python.org Sat Jul 5 11:01:23 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 09:01:23 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080705090123.5E64D1E4003@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%20trunk/builds/1697 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,georg.brandl,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From nnorwitz at gmail.com Sat Jul 5 11:16:35 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 5 Jul 2008 05:16:35 -0400 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20080705091635.GA30965@python.psfb.org> More important issues: ---------------------- test_ssl leaked [131, 0, 0] references, sum=131 Less important issues: ---------------------- test_cmd_line leaked [25, -25, 25] references, sum=25 test_smtplib leaked [-3, 0, -5] references, sum=-8 test_socketserver leaked [-84, 0, 0] references, sum=-84 test_sys leaked [2, 2, 2] references, sum=6 test_threading leaked [0, 2, 0] references, sum=2 test_urllib2_localnet leaked [146, -140, 146] references, sum=152 From python-checkins at python.org Sat Jul 5 12:04:42 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 12:04:42 +0200 (CEST) Subject: [Python-checkins] r64720 - in doctools/branches/0.4.x: CHANGES sphinx/builder.py Message-ID: <20080705100442.4DD871E4003@bag.python.org> Author: georg.brandl Date: Sat Jul 5 12:04:41 2008 New Revision: 64720 Log: Fix warning for nonexisting images. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/builder.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Sat Jul 5 12:04:41 2008 @@ -25,6 +25,8 @@ * Fix the ``delete()`` docstring processor function in autodoc. +* Fix warning message for nonexisting images. + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/sphinx/builder.py ============================================================================== --- doctools/branches/0.4.x/sphinx/builder.py (original) +++ doctools/branches/0.4.x/sphinx/builder.py Sat Jul 5 12:04:41 2008 @@ -138,7 +138,7 @@ break else: self.warn('%s:%s: no matching candidate for image URI %r' % - (node.source, node.lineno, node['uri'])) + (node.source, getattr(node, 'lineno', ''), node['uri'])) continue node['uri'] = candidate else: From python-checkins at python.org Sat Jul 5 12:07:18 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 12:07:18 +0200 (CEST) Subject: [Python-checkins] r64721 - python/trunk/Python/pythonrun.c Message-ID: <20080705100718.A7A011E4003@bag.python.org> Author: georg.brandl Date: Sat Jul 5 12:07:18 2008 New Revision: 64721 Log: Fix tabs. Modified: python/trunk/Python/pythonrun.c Modified: python/trunk/Python/pythonrun.c ============================================================================== --- python/trunk/Python/pythonrun.c (original) +++ python/trunk/Python/pythonrun.c Sat Jul 5 12:07:18 2008 @@ -229,14 +229,14 @@ if (install_sigs) initsigs(); /* Signal handling stuff, including initintr() */ - /* Initialize warnings. */ - _PyWarnings_Init(); - if (PySys_HasWarnOptions()) { - PyObject *warnings_module = PyImport_ImportModule("warnings"); - if (!warnings_module) - PyErr_Clear(); - Py_XDECREF(warnings_module); - } + /* Initialize warnings. */ + _PyWarnings_Init(); + if (PySys_HasWarnOptions()) { + PyObject *warnings_module = PyImport_ImportModule("warnings"); + if (!warnings_module) + PyErr_Clear(); + Py_XDECREF(warnings_module); + } initmain(); /* Module __main__ */ if (!Py_NoSiteFlag) @@ -1126,7 +1126,7 @@ PyErr_NormalizeException(&exception, &v, &tb); if (exception == NULL) return; - /* Now we know v != NULL too */ + /* Now we know v != NULL too */ if (set_sys_last_vars) { PySys_SetObject("last_type", exception); PySys_SetObject("last_value", v); @@ -1861,14 +1861,14 @@ PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l) { - return PyRun_FileExFlags(fp, p, s, g, l, 0, NULL); + return PyRun_FileExFlags(fp, p, s, g, l, 0, NULL); } #undef PyRun_FileEx PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c) { - return PyRun_FileExFlags(fp, p, s, g, l, c, NULL); + return PyRun_FileExFlags(fp, p, s, g, l, c, NULL); } #undef PyRun_FileFlags @@ -1876,7 +1876,7 @@ PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags) { - return PyRun_FileExFlags(fp, p, s, g, l, 0, flags); + return PyRun_FileExFlags(fp, p, s, g, l, 0, flags); } #undef PyRun_SimpleFile From python-checkins at python.org Sat Jul 5 12:13:37 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 12:13:37 +0200 (CEST) Subject: [Python-checkins] r64722 - in python/trunk: Doc/library/shutil.rst Lib/shutil.py Lib/test/test_shutil.py Misc/NEWS Message-ID: <20080705101337.4319B1E4003@bag.python.org> Author: georg.brandl Date: Sat Jul 5 12:13:36 2008 New Revision: 64722 Log: #2663: support an *ignore* argument to shutil.copytree(). Patch by Tarek Ziade. This is a new feature, but Barry authorized adding it in the beta period. Modified: python/trunk/Doc/library/shutil.rst python/trunk/Lib/shutil.py python/trunk/Lib/test/test_shutil.py python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/shutil.rst ============================================================================== --- python/trunk/Doc/library/shutil.rst (original) +++ python/trunk/Doc/library/shutil.rst Sat Jul 5 12:13:36 2008 @@ -78,18 +78,41 @@ Unix command :program:`cp -p`. -.. function:: copytree(src, dst[, symlinks]) +.. function:: ignore_patterns(\*patterns) + + This factory function creates a function that can be used as a callable for + :func:`copytree`\'s *ignore* argument, ignoring files and directories that + match one the glob-style *patterns* provided. See the example below. + + .. versionadded:: 2.6 + + +.. function:: copytree(src, dst[, symlinks=False[, ignore=None]]) Recursively copy an entire directory tree rooted at *src*. The destination - directory, named by *dst*, must not already exist; it will be created as well as - missing parent directories. Permissions and times of directories are copied with - :func:`copystat`, individual files are copied using :func:`copy2`. If - *symlinks* is true, symbolic links in the source tree are represented as - symbolic links in the new tree; if false or omitted, the contents of the linked - files are copied to the new tree. If exception(s) occur, an :exc:`Error` is - raised with a list of reasons. + directory, named by *dst*, must not already exist; it will be created as well + as missing parent directories. Permissions and times of directories are + copied with :func:`copystat`, individual files are copied using + :func:`copy2`. + + If *symlinks* is true, symbolic links in the source tree are represented as + symbolic links in the new tree; if false or omitted, the contents of the + linked files are copied to the new tree. + + If *ignore* is given, it must be a callable that will receive as its + arguments the directory being visited by :func:`copytree`, and a list of its + contents, as returned by :func:`os.listdir`. Since :func:`copytree` is + called recursively, the *ignore* callable will be called once for each + directory that is copied. The callable must return a sequence of directory + and file names relative to the current directory (i.e. a subset of the items + in its second argument); these names will then be ignored in the copy + process. :func:`ignore_patterns` can be used to create such a callable that + ignores names based on glob-style patterns. - The source code for this should be considered an example rather than a tool. + If exception(s) occur, an :exc:`Error` is raised with a list of reasons. + + The source code for this should be considered an example rather than the + ultimate tool. .. versionchanged:: 2.3 :exc:`Error` is raised if any exceptions occur during copying, rather than @@ -99,6 +122,9 @@ Create intermediate directories needed to create *dst*, rather than raising an error. Copy permissions and times of directories using :func:`copystat`. + .. versionchanged:: 2.6 + Added the *ignore* argument to be able to influence what is being copied. + .. function:: rmtree(path[, ignore_errors[, onerror]]) @@ -152,11 +178,18 @@ above, with the docstring omitted. It demonstrates many of the other functions provided by this module. :: - def copytree(src, dst, symlinks=False): + def copytree(src, dst, symlinks=False, ignore=None): names = os.listdir(src) + if ignore is not None: + ignored_names = ignore(src, names) + else: + ignored_names = set() + os.makedirs(dst) errors = [] for name in names: + if name in ignored_names: + continue srcname = os.path.join(src, name) dstname = os.path.join(dst, name) try: @@ -164,7 +197,7 @@ linkto = os.readlink(srcname) os.symlink(linkto, dstname) elif os.path.isdir(srcname): - copytree(srcname, dstname, symlinks) + copytree(srcname, dstname, symlinks, ignore) else: copy2(srcname, dstname) # XXX What about devices, sockets etc.? @@ -183,3 +216,24 @@ errors.extend((src, dst, str(why))) if errors: raise Error, errors + +Another example that uses the :func:`ignore_patterns` helper:: + + from shutil import copytree, ignore_patterns + + copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*')) + +This will copy everything except ``.pyc`` files and files or directories whose +name starts with ``tmp``. + +Another example that uses the *ignore* argument to add a logging call:: + + from shutil import copytree + import logging + + def _logpath(path, names): + logging.info('Working in %s' % path) + return [] # nothing will be ignored + + copytree(source, destination, ignore=_logpath) + Modified: python/trunk/Lib/shutil.py ============================================================================== --- python/trunk/Lib/shutil.py (original) +++ python/trunk/Lib/shutil.py Sat Jul 5 12:13:36 2008 @@ -8,6 +8,7 @@ import sys import stat from os.path import abspath +import fnmatch __all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2", "copytree","move","rmtree","Error"] @@ -93,8 +94,19 @@ copyfile(src, dst) copystat(src, dst) +def ignore_patterns(*patterns): + """Function that can be used as copytree() ignore parameter. -def copytree(src, dst, symlinks=False): + Patterns is a sequence of glob-style patterns + that are used to exclude files""" + def _ignore_patterns(path, names): + ignored_names = [] + for pattern in patterns: + ignored_names.extend(fnmatch.filter(names, pattern)) + return set(ignored_names) + return _ignore_patterns + +def copytree(src, dst, symlinks=False, ignore=None): """Recursively copy a directory tree using copy2(). The destination directory must not already exist. @@ -105,13 +117,32 @@ it is false, the contents of the files pointed to by symbolic links are copied. + The optional ignore argument is a callable. If given, it + is called with the `src` parameter, which is the directory + being visited by copytree(), and `names` which is the list of + `src` contents, as returned by os.listdir(): + + callable(src, names) -> ignored_names + + Since copytree() is called recursively, the callable will be + called once for each directory that is copied. It returns a + list of names relative to the `src` directory that should + not be copied. + XXX Consider this example code rather than the ultimate tool. """ names = os.listdir(src) + if ignore is not None: + ignored_names = ignore(src, names) + else: + ignored_names = set() + os.makedirs(dst) errors = [] for name in names: + if name in ignored_names: + continue srcname = os.path.join(src, name) dstname = os.path.join(dst, name) try: @@ -119,7 +150,7 @@ linkto = os.readlink(srcname) os.symlink(linkto, dstname) elif os.path.isdir(srcname): - copytree(srcname, dstname, symlinks) + copytree(srcname, dstname, symlinks, ignore) else: copy2(srcname, dstname) # XXX What about devices, sockets etc.? Modified: python/trunk/Lib/test/test_shutil.py ============================================================================== --- python/trunk/Lib/test/test_shutil.py (original) +++ python/trunk/Lib/test/test_shutil.py Sat Jul 5 12:13:36 2008 @@ -108,6 +108,82 @@ if os.path.exists(path): shutil.rmtree(path) + def test_copytree_with_exclude(self): + + def write_data(path, data): + f = open(path, "w") + f.write(data) + f.close() + + def read_data(path): + f = open(path) + data = f.read() + f.close() + return data + + # creating data + join = os.path.join + exists = os.path.exists + src_dir = tempfile.mkdtemp() + dst_dir = join(tempfile.mkdtemp(), 'destination') + write_data(join(src_dir, 'test.txt'), '123') + write_data(join(src_dir, 'test.tmp'), '123') + os.mkdir(join(src_dir, 'test_dir')) + write_data(join(src_dir, 'test_dir', 'test.txt'), '456') + os.mkdir(join(src_dir, 'test_dir2')) + write_data(join(src_dir, 'test_dir2', 'test.txt'), '456') + os.mkdir(join(src_dir, 'test_dir2', 'subdir')) + os.mkdir(join(src_dir, 'test_dir2', 'subdir2')) + write_data(join(src_dir, 'test_dir2', 'subdir', 'test.txt'), '456') + write_data(join(src_dir, 'test_dir2', 'subdir2', 'test.py'), '456') + + + # testing glob-like patterns + try: + patterns = shutil.ignore_patterns('*.tmp', 'test_dir2') + shutil.copytree(src_dir, dst_dir, ignore=patterns) + # checking the result: some elements should not be copied + self.assert_(exists(join(dst_dir, 'test.txt'))) + self.assert_(not exists(join(dst_dir, 'test.tmp'))) + self.assert_(not exists(join(dst_dir, 'test_dir2'))) + finally: + if os.path.exists(dst_dir): + shutil.rmtree(dst_dir) + try: + patterns = shutil.ignore_patterns('*.tmp', 'subdir*') + shutil.copytree(src_dir, dst_dir, ignore=patterns) + # checking the result: some elements should not be copied + self.assert_(not exists(join(dst_dir, 'test.tmp'))) + self.assert_(not exists(join(dst_dir, 'test_dir2', 'subdir2'))) + self.assert_(not exists(join(dst_dir, 'test_dir2', 'subdir'))) + finally: + if os.path.exists(dst_dir): + shutil.rmtree(dst_dir) + + # testing callable-style + try: + def _filter(src, names): + res = [] + for name in names: + path = os.path.join(src, name) + + if (os.path.isdir(path) and + path.split()[-1] == 'subdir'): + res.append(name) + elif os.path.splitext(path)[-1] in ('.py'): + res.append(name) + return res + + shutil.copytree(src_dir, dst_dir, ignore=_filter) + + # checking the result: some elements should not be copied + self.assert_(not exists(join(dst_dir, 'test_dir2', 'subdir2', + 'test.py'))) + self.assert_(not exists(join(dst_dir, 'test_dir2', 'subdir'))) + + finally: + if os.path.exists(dst_dir): + shutil.rmtree(dst_dir) if hasattr(os, "symlink"): def test_dont_copy_file_onto_link_to_itself(self): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Jul 5 12:13:36 2008 @@ -29,10 +29,11 @@ would not cause a syntax error. This was regression from 2.4 caused by the switch to the new compiler. - Library ------- +- Issue #2663: add filtering capability to shutil.copytree(). + - Issue #1622: Correct interpretation of various ZIP header fields. - Issue #1526: Allow more than 64k files to be added to Zip64 file. @@ -54,7 +55,6 @@ urllib module in Python 3.0 to urllib.request, urllib.parse, and urllib.error. - Build ----- From python-checkins at python.org Sat Jul 5 12:21:42 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 12:21:42 +0200 (CEST) Subject: [Python-checkins] r64723 - in doctools/branches/0.4.x: CHANGES sphinx/templates/layout.html Message-ID: <20080705102142.C67991E4003@bag.python.org> Author: georg.brandl Date: Sat Jul 5 12:21:42 2008 New Revision: 64723 Log: Fix JS search in IE. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/templates/layout.html Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Sat Jul 5 12:21:42 2008 @@ -27,6 +27,8 @@ * Fix warning message for nonexisting images. +* Fix JavaScript search in Internet Explorer. + Release 0.4 (Jun 23, 2008) ========================== Modified: doctools/branches/0.4.x/sphinx/templates/layout.html ============================================================================== --- doctools/branches/0.4.x/sphinx/templates/layout.html (original) +++ doctools/branches/0.4.x/sphinx/templates/layout.html Sat Jul 5 12:21:42 2008 @@ -104,7 +104,7 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: '{{ pathto("", 1) }}', VERSION: '{{ release }}', - COLLAPSE_MODINDEX: false, + COLLAPSE_MODINDEX: false }; From python-checkins at python.org Sat Jul 5 12:24:06 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 12:24:06 +0200 (CEST) Subject: [Python-checkins] r64724 - in doctools/trunk: sphinx/builder.py sphinx/directives/other.py sphinx/ext/autodoc.py sphinx/templates/layout.html Message-ID: <20080705102406.D9E6C1E4003@bag.python.org> Author: georg.brandl Date: Sat Jul 5 12:24:06 2008 New Revision: 64724 Log: Merged revisions 64714-64715,64720,64723 via svnmerge from svn+ssh://pythondev at svn.python.org/doctools/branches/0.4.x ........ r64714 | georg.brandl | 2008-07-04 21:19:02 +0200 (Fri, 04 Jul 2008) | 3 lines Allow the usage of :noindex: in "automodule" directives, as documented. ........ r64715 | georg.brandl | 2008-07-04 21:30:22 +0200 (Fri, 04 Jul 2008) | 2 lines Fix the delete() docstring processor function. ........ r64720 | georg.brandl | 2008-07-05 12:04:41 +0200 (Sat, 05 Jul 2008) | 2 lines Fix warning for nonexisting images. ........ r64723 | georg.brandl | 2008-07-05 12:21:42 +0200 (Sat, 05 Jul 2008) | 2 lines Fix JS search in IE. ........ Modified: doctools/trunk/ (props changed) doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/directives/other.py doctools/trunk/sphinx/ext/autodoc.py doctools/trunk/sphinx/templates/layout.html Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Sat Jul 5 12:24:06 2008 @@ -138,7 +138,7 @@ break else: self.warn('%s:%s: no matching candidate for image URI %r' % - (node.source, node.lineno, node['uri'])) + (node.source, getattr(node, 'lineno', ''), node['uri'])) continue node['uri'] = candidate else: Modified: doctools/trunk/sphinx/directives/other.py ============================================================================== --- doctools/trunk/sphinx/directives/other.py (original) +++ doctools/trunk/sphinx/directives/other.py Sat Jul 5 12:24:06 2008 @@ -83,6 +83,7 @@ content_offset, block_text, state, state_machine): env = state.document.settings.env modname = arguments[0].strip() + noindex = 'noindex' in options env.currmodule = modname env.note_module(modname, options.get('synopsis', ''), options.get('platform', ''), @@ -100,13 +101,15 @@ node += nodes.Text(options['platform'], options['platform']) ret.append(node) # the synopsis isn't printed; in fact, it is only used in the modindex currently - env.note_index_entry('single', '%s (module)' % modname, 'module-' + modname, - modname) + if not noindex: + env.note_index_entry('single', '%s (module)' % modname, + 'module-' + modname, modname) return ret module_directive.arguments = (1, 0, 0) module_directive.options = {'platform': lambda x: x, 'synopsis': lambda x: x, + 'noindex': directives.flag, 'deprecated': directives.flag} directives.register_directive('module', module_directive) Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Sat Jul 5 12:24:06 2008 @@ -113,25 +113,33 @@ del lines[-post:] return process -def between(marker, what=None): +def between(marker, what=None, keepempty=False): """ - Return a listener that only keeps lines between the first two lines that - match the *marker* regular expression. If *what* is a sequence of strings, - only docstrings of a type in *what* will be processed. + Return a listener that only keeps lines between lines that match the + *marker* regular expression. If no line matches, the resulting docstring + would be empty, so no change will be made unless *keepempty* is true. + + If *what* is a sequence of strings, only docstrings of a type in *what* will + be processed. """ marker_re = re.compile(marker) def process(app, what_, name, obj, options, lines): if what and what_ not in what: return - seen = 0 - for i, line in enumerate(lines[:]): + deleted = 0 + delete = True + orig_lines = lines[:] + for i, line in enumerate(orig_lines): + if delete: + lines.pop(i - deleted) + deleted += 1 if marker_re.match(line): - if not seen: - del lines[:i+1] - seen = i+1 - else: - del lines[i-seen:] - break + delete = not delete + if delete: + lines.pop(i - deleted) + deleted += 1 + if not lines and not keepempty: + lines[:] = orig_lines return process @@ -526,7 +534,10 @@ def auto_directive(*args, **kwds): return _auto_directive(*args, **kwds) -def auto_directive_withmembers(*args, **kwds): +def automodule_directive(*args, **kwds): + return _auto_directive(*args, **kwds) + +def autoclass_directive(*args, **kwds): return _auto_directive(*args, **kwds) @@ -542,11 +553,11 @@ cls_options = {'members': members_option, 'undoc-members': directives.flag, 'noindex': directives.flag, 'inherited-members': directives.flag, 'show-inheritance': directives.flag} - app.add_directive('automodule', auto_directive_withmembers, + app.add_directive('automodule', automodule_directive, 1, (1, 0, 1), **mod_options) - app.add_directive('autoclass', auto_directive_withmembers, + app.add_directive('autoclass', autoclass_directive, 1, (1, 0, 1), **cls_options) - app.add_directive('autoexception', auto_directive_withmembers, + app.add_directive('autoexception', autoclass_directive, 1, (1, 0, 1), **cls_options) app.add_directive('autofunction', auto_directive, 1, (1, 0, 1), noindex=directives.flag) Modified: doctools/trunk/sphinx/templates/layout.html ============================================================================== --- doctools/trunk/sphinx/templates/layout.html (original) +++ doctools/trunk/sphinx/templates/layout.html Sat Jul 5 12:24:06 2008 @@ -104,7 +104,7 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: '{{ pathto("", 1) }}', VERSION: '{{ release }}', - COLLAPSE_MODINDEX: false, + COLLAPSE_MODINDEX: false }; From python-checkins at python.org Sat Jul 5 12:31:43 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 12:31:43 +0200 (CEST) Subject: [Python-checkins] r64725 - in doctools/branches/0.4.x: doc/concepts.rst sphinx/texinputs/howto.cls sphinx/texinputs/manual.cls Message-ID: <20080705103143.8CC101E4003@bag.python.org> Author: georg.brandl Date: Sat Jul 5 12:31:43 2008 New Revision: 64725 Log: Add note about :maxdepth: in toctrees and latex. Modified: doctools/branches/0.4.x/doc/concepts.rst doctools/branches/0.4.x/sphinx/texinputs/howto.cls doctools/branches/0.4.x/sphinx/texinputs/manual.cls Modified: doctools/branches/0.4.x/doc/concepts.rst ============================================================================== --- doctools/branches/0.4.x/doc/concepts.rst (original) +++ doctools/branches/0.4.x/doc/concepts.rst Sat Jul 5 12:31:43 2008 @@ -33,7 +33,7 @@ individual TOCs (including "sub-TOC trees") of the documents given in the directive body (whose path is relative to the document the directive occurs in). A numeric ``maxdepth`` option may be given to indicate the depth of the - tree; by default, all levels are included. + tree; by default, all levels are included. [#]_ Consider this example (taken from the Python docs' library reference index):: @@ -132,6 +132,12 @@ .. rubric:: Footnotes +.. [#] The ``maxdepth`` option does not apply to the LaTeX writer, where the + whole table of contents will always be presented at the begin of the + document, and its depth is controlled by the ``tocdepth`` counter, which + you can reset in your :confval:`latex_preamble` config value using + e.g. ``\setcounter{tocdepth}{2}``. + .. [#] A note on available globbing syntax: you can use the standard shell constructs ``*``, ``?``, ``[...]`` and ``[!...]`` with the feature that these all don't match slashes. A double star ``**`` can be used to match Modified: doctools/branches/0.4.x/sphinx/texinputs/howto.cls ============================================================================== --- doctools/branches/0.4.x/sphinx/texinputs/howto.cls (original) +++ doctools/branches/0.4.x/sphinx/texinputs/howto.cls Sat Jul 5 12:31:43 2008 @@ -14,7 +14,7 @@ % Set some sane defaults for section numbering depth and TOC depth. You can -% reset these counter in your preamble. +% reset these counters in your preamble. % \setcounter{secnumdepth}{2} Modified: doctools/branches/0.4.x/sphinx/texinputs/manual.cls ============================================================================== --- doctools/branches/0.4.x/sphinx/texinputs/manual.cls (original) +++ doctools/branches/0.4.x/sphinx/texinputs/manual.cls Sat Jul 5 12:31:43 2008 @@ -14,7 +14,7 @@ % Set some sane defaults for section numbering depth and TOC depth. You can -% reset these counter in your preamble. +% reset these counters in your preamble. % \setcounter{secnumdepth}{2} \setcounter{tocdepth}{1} From buildbot at python.org Sat Jul 5 12:41:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 10:41:32 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080705104132.692901E400F@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/722 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sat Jul 5 12:55:07 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 12:55:07 +0200 (CEST) Subject: [Python-checkins] r64726 - doctools/branches/0.4.x/sphinx/directives/desc.py Message-ID: <20080705105507.5BC1E1E4004@bag.python.org> Author: georg.brandl Date: Sat Jul 5 12:55:07 2008 New Revision: 64726 Log: Add object names for e.g. :ivar:. Modified: doctools/branches/0.4.x/sphinx/directives/desc.py Modified: doctools/branches/0.4.x/sphinx/directives/desc.py ============================================================================== --- doctools/branches/0.4.x/sphinx/directives/desc.py (original) +++ doctools/branches/0.4.x/sphinx/directives/desc.py Sat Jul 5 12:55:07 2008 @@ -151,8 +151,9 @@ elif typ == 'type': param_types[obj] = fbody.astext() else: + fieldname = typ + ' ' + obj nfield = nodes.field() - nfield += nodes.field_name(typ, typ) + nfield += nodes.field_name(fieldname, fieldname) nfield += nodes.field_body() nfield[1] += fbody.children new_list += nfield From python-checkins at python.org Sat Jul 5 13:12:43 2008 From: python-checkins at python.org (thomas.lee) Date: Sat, 5 Jul 2008 13:12:43 +0200 (CEST) Subject: [Python-checkins] r64727 - in python/branches/tlee-ast-optimize: Doc/glossary.rst Doc/library/abc.rst Doc/library/pickle.rst Doc/library/rlcompleter.rst Doc/library/shutil.rst Doc/library/stdtypes.rst Doc/library/zipfile.rst Lib/decimal.py Lib/pydoc.py Lib/rlcompleter.py Lib/shutil.py Lib/test/test_cookielib.py Lib/test/test_decimal.py Lib/test/test_multiprocessing.py Lib/test/test_pydoc.py Lib/test/test_shutil.py Lib/test/test_zipfile.py Lib/test/test_zipfile64.py Lib/zipfile.py Misc/NEWS Modules/nismodule.c Python/ceval.c Python/pythonrun.c Message-ID: <20080705111243.919BC1E4003@bag.python.org> Author: thomas.lee Date: Sat Jul 5 13:12:42 2008 New Revision: 64727 Log: Merged revisions 64654-64726 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r64655 | mark.dickinson | 2008-07-02 19:37:01 +1000 (Wed, 02 Jul 2008) | 7 lines Replace occurrences of '\d' with '[0-9]' in Decimal regex, to make sure that the behaviour of Decimal doesn't change if/when re.UNICODE becomes assumed in Python 3.0. Also add a check that alternative Unicode digits (e.g. u'\N{FULLWIDTH DIGIT ONE}') are *not* accepted in a numeric string. ........ r64656 | nick.coghlan | 2008-07-02 23:09:19 +1000 (Wed, 02 Jul 2008) | 1 line Issue 3190: pydoc now hides module __package__ attributes ........ r64663 | jesse.noller | 2008-07-03 02:44:09 +1000 (Thu, 03 Jul 2008) | 1 line Reenable the manager tests with Amaury's threading fix ........ r64664 | facundo.batista | 2008-07-03 02:52:55 +1000 (Thu, 03 Jul 2008) | 4 lines Issue #449227: Now with the rlcompleter module, callable objects are added a '(' when completed. ........ r64665 | jesse.noller | 2008-07-03 02:56:51 +1000 (Thu, 03 Jul 2008) | 1 line Add #!/usr/bin/env python for ben ........ r64673 | brett.cannon | 2008-07-03 07:40:11 +1000 (Thu, 03 Jul 2008) | 4 lines FIx some Latin-1 characters to be UTF-8 as the file encoding specifies. Closes issue #3261. THankjs Leo Soto for the bug report. ........ r64677 | brett.cannon | 2008-07-03 07:52:42 +1000 (Thu, 03 Jul 2008) | 2 lines Revert r64673 and instead just change the file encoding. ........ r64685 | amaury.forgeotdarc | 2008-07-03 09:40:28 +1000 (Thu, 03 Jul 2008) | 3 lines Try a blind fix to nismodule which fails on the solaris10 3.0 buildbot: the GIL must be re-acquired in the callback function ........ r64687 | andrew.kuchling | 2008-07-03 22:50:03 +1000 (Thu, 03 Jul 2008) | 1 line Tweak wording ........ r64688 | martin.v.loewis | 2008-07-03 22:51:14 +1000 (Thu, 03 Jul 2008) | 9 lines Patch #1622: Correct interpretation of various ZIP header fields. Also fixes - Issue #1526: Allow more than 64k files to be added to Zip64 file. - Issue #1746: Correct handling of zipfile archive comments (previously archives with comments over 4k were flagged as invalid). Allow writing Zip files with archives by setting the 'comment' attribute of a ZipFile. ........ r64689 | benjamin.peterson | 2008-07-03 22:57:35 +1000 (Thu, 03 Jul 2008) | 1 line lowercase glossary term ........ r64690 | benjamin.peterson | 2008-07-03 23:01:17 +1000 (Thu, 03 Jul 2008) | 1 line let the term be linked ........ r64702 | georg.brandl | 2008-07-05 03:22:53 +1000 (Sat, 05 Jul 2008) | 2 lines Give the pickle special methods a signature. ........ r64719 | raymond.hettinger | 2008-07-05 12:11:55 +1000 (Sat, 05 Jul 2008) | 1 line Update comment on prediction macros. ........ r64721 | georg.brandl | 2008-07-05 20:07:18 +1000 (Sat, 05 Jul 2008) | 2 lines Fix tabs. ........ r64722 | georg.brandl | 2008-07-05 20:13:36 +1000 (Sat, 05 Jul 2008) | 4 lines #2663: support an *ignore* argument to shutil.copytree(). Patch by Tarek Ziade. This is a new feature, but Barry authorized adding it in the beta period. ........ Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/glossary.rst python/branches/tlee-ast-optimize/Doc/library/abc.rst python/branches/tlee-ast-optimize/Doc/library/pickle.rst python/branches/tlee-ast-optimize/Doc/library/rlcompleter.rst python/branches/tlee-ast-optimize/Doc/library/shutil.rst python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst python/branches/tlee-ast-optimize/Doc/library/zipfile.rst python/branches/tlee-ast-optimize/Lib/decimal.py python/branches/tlee-ast-optimize/Lib/pydoc.py python/branches/tlee-ast-optimize/Lib/rlcompleter.py python/branches/tlee-ast-optimize/Lib/shutil.py python/branches/tlee-ast-optimize/Lib/test/test_cookielib.py python/branches/tlee-ast-optimize/Lib/test/test_decimal.py python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py python/branches/tlee-ast-optimize/Lib/test/test_pydoc.py python/branches/tlee-ast-optimize/Lib/test/test_shutil.py python/branches/tlee-ast-optimize/Lib/test/test_zipfile.py python/branches/tlee-ast-optimize/Lib/test/test_zipfile64.py python/branches/tlee-ast-optimize/Lib/zipfile.py python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/nismodule.c python/branches/tlee-ast-optimize/Python/ceval.c python/branches/tlee-ast-optimize/Python/pythonrun.c Modified: python/branches/tlee-ast-optimize/Doc/glossary.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/glossary.rst (original) +++ python/branches/tlee-ast-optimize/Doc/glossary.rst Sat Jul 5 13:12:42 2008 @@ -24,7 +24,7 @@ 2to3 is available in the standard library as :mod:`lib2to3`; a standalone entry point is provided as :file:`Tools/scripts/2to3`. - Abstract Base Class + abstract base class Abstract Base Classes (abbreviated ABCs) complement :term:`duck-typing` by providing a way to define interfaces when other techniques like :func:`hasattr` would be clumsy. Python comes with many builtin ABCs for data structures Modified: python/branches/tlee-ast-optimize/Doc/library/abc.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/abc.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/abc.rst Sat Jul 5 13:12:42 2008 @@ -9,8 +9,8 @@ .. versionadded:: 2.6 -This module provides the infrastructure for defining :term:`abstract base -classes` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this +This module provides the infrastructure for defining an :term:`abstract base +class` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this was added to Python. (See also :pep:`3141` and the :mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.) Modified: python/branches/tlee-ast-optimize/Doc/library/pickle.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/pickle.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/pickle.rst Sat Jul 5 13:12:42 2008 @@ -396,6 +396,8 @@ The pickle protocol ------------------- +.. currentmodule:: None + This section describes the "pickling protocol" that defines the interface between the pickler/unpickler and the objects that are being serialized. This protocol provides a standard way for you to define, customize, and control how @@ -410,129 +412,126 @@ Pickling and unpickling normal class instances ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. index:: - single: __getinitargs__() (copy protocol) - single: __init__() (instance constructor) - -When a pickled class instance is unpickled, its :meth:`__init__` method is -normally *not* invoked. If it is desirable that the :meth:`__init__` method be -called on unpickling, an old-style class can define a method -:meth:`__getinitargs__`, which should return a *tuple* containing the arguments -to be passed to the class constructor (:meth:`__init__` for example). The -:meth:`__getinitargs__` method is called at pickle time; the tuple it returns is -incorporated in the pickle for the instance. - -.. index:: single: __getnewargs__() (copy protocol) - -New-style types can provide a :meth:`__getnewargs__` method that is used for -protocol 2. Implementing this method is needed if the type establishes some -internal invariants when the instance is created, or if the memory allocation is -affected by the values passed to the :meth:`__new__` method for the type (as it -is for tuples and strings). Instances of a :term:`new-style class` :class:`C` -are created using :: - - obj = C.__new__(C, *args) - - -where *args* is the result of calling :meth:`__getnewargs__` on the original -object; if there is no :meth:`__getnewargs__`, an empty tuple is assumed. - -.. index:: - single: __getstate__() (copy protocol) - single: __setstate__() (copy protocol) - single: __dict__ (instance attribute) - -Classes can further influence how their instances are pickled; if the class -defines the method :meth:`__getstate__`, it is called and the return state is -pickled as the contents for the instance, instead of the contents of the -instance's dictionary. If there is no :meth:`__getstate__` method, the -instance's :attr:`__dict__` is pickled. - -Upon unpickling, if the class also defines the method :meth:`__setstate__`, it -is called with the unpickled state. [#]_ If there is no :meth:`__setstate__` -method, the pickled state must be a dictionary and its items are assigned to the -new instance's dictionary. If a class defines both :meth:`__getstate__` and -:meth:`__setstate__`, the state object needn't be a dictionary and these methods -can do what they want. [#]_ - -.. warning:: - - For :term:`new-style class`\es, if :meth:`__getstate__` returns a false - value, the :meth:`__setstate__` method will not be called. +.. method:: object.__getinitargs__() + + When a pickled class instance is unpickled, its :meth:`__init__` method is + normally *not* invoked. If it is desirable that the :meth:`__init__` method + be called on unpickling, an old-style class can define a method + :meth:`__getinitargs__`, which should return a *tuple* containing the + arguments to be passed to the class constructor (:meth:`__init__` for + example). The :meth:`__getinitargs__` method is called at pickle time; the + tuple it returns is incorporated in the pickle for the instance. + +.. method:: object.__getnewargs__() + + New-style types can provide a :meth:`__getnewargs__` method that is used for + protocol 2. Implementing this method is needed if the type establishes some + internal invariants when the instance is created, or if the memory allocation + is affected by the values passed to the :meth:`__new__` method for the type + (as it is for tuples and strings). Instances of a :term:`new-style class` + ``C`` are created using :: + + obj = C.__new__(C, *args) + + where *args* is the result of calling :meth:`__getnewargs__` on the original + object; if there is no :meth:`__getnewargs__`, an empty tuple is assumed. + +.. method:: object.__getstate__() + + Classes can further influence how their instances are pickled; if the class + defines the method :meth:`__getstate__`, it is called and the return state is + pickled as the contents for the instance, instead of the contents of the + instance's dictionary. If there is no :meth:`__getstate__` method, the + instance's :attr:`__dict__` is pickled. + +.. method:: object.__setstate__() + + Upon unpickling, if the class also defines the method :meth:`__setstate__`, + it is called with the unpickled state. [#]_ If there is no + :meth:`__setstate__` method, the pickled state must be a dictionary and its + items are assigned to the new instance's dictionary. If a class defines both + :meth:`__getstate__` and :meth:`__setstate__`, the state object needn't be a + dictionary and these methods can do what they want. [#]_ + + .. warning:: + + For :term:`new-style class`\es, if :meth:`__getstate__` returns a false + value, the :meth:`__setstate__` method will not be called. Pickling and unpickling extension types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. index:: - single: __reduce__() (pickle protocol) - single: __reduce_ex__() (pickle protocol) - single: __safe_for_unpickling__ (pickle protocol) - -When the :class:`Pickler` encounters an object of a type it knows nothing about ---- such as an extension type --- it looks in two places for a hint of how to -pickle it. One alternative is for the object to implement a :meth:`__reduce__` -method. If provided, at pickling time :meth:`__reduce__` will be called with no -arguments, and it must return either a string or a tuple. - -If a string is returned, it names a global variable whose contents are pickled -as normal. The string returned by :meth:`__reduce__` should be the object's -local name relative to its module; the pickle module searches the module -namespace to determine the object's module. - -When a tuple is returned, it must be between two and five elements long. -Optional elements can either be omitted, or ``None`` can be provided as their -value. The contents of this tuple are pickled as normal and used to -reconstruct the object at unpickling time. The semantics of each element are: - -* A callable object that will be called to create the initial version of the - object. The next element of the tuple will provide arguments for this callable, - and later elements provide additional state information that will subsequently - be used to fully reconstruct the pickled data. - - In the unpickling environment this object must be either a class, a callable - registered as a "safe constructor" (see below), or it must have an attribute - :attr:`__safe_for_unpickling__` with a true value. Otherwise, an - :exc:`UnpicklingError` will be raised in the unpickling environment. Note that - as usual, the callable itself is pickled by name. - -* A tuple of arguments for the callable object. - - .. versionchanged:: 2.5 - Formerly, this argument could also be ``None``. - -* Optionally, the object's state, which will be passed to the object's - :meth:`__setstate__` method as described in section :ref:`pickle-inst`. If the - object has no :meth:`__setstate__` method, then, as above, the value must be a - dictionary and it will be added to the object's :attr:`__dict__`. - -* Optionally, an iterator (and not a sequence) yielding successive list items. - These list items will be pickled, and appended to the object using either - ``obj.append(item)`` or ``obj.extend(list_of_items)``. This is primarily used - for list subclasses, but may be used by other classes as long as they have - :meth:`append` and :meth:`extend` methods with the appropriate signature. - (Whether :meth:`append` or :meth:`extend` is used depends on which pickle - protocol version is used as well as the number of items to append, so both must - be supported.) - -* Optionally, an iterator (not a sequence) yielding successive dictionary items, - which should be tuples of the form ``(key, value)``. These items will be - pickled and stored to the object using ``obj[key] = value``. This is primarily - used for dictionary subclasses, but may be used by other classes as long as they - implement :meth:`__setitem__`. - -It is sometimes useful to know the protocol version when implementing -:meth:`__reduce__`. This can be done by implementing a method named -:meth:`__reduce_ex__` instead of :meth:`__reduce__`. :meth:`__reduce_ex__`, when -it exists, is called in preference over :meth:`__reduce__` (you may still -provide :meth:`__reduce__` for backwards compatibility). The -:meth:`__reduce_ex__` method will be called with a single integer argument, the -protocol version. - -The :class:`object` class implements both :meth:`__reduce__` and -:meth:`__reduce_ex__`; however, if a subclass overrides :meth:`__reduce__` but -not :meth:`__reduce_ex__`, the :meth:`__reduce_ex__` implementation detects this -and calls :meth:`__reduce__`. +.. method:: object.__reduce__() + + When the :class:`Pickler` encounters an object of a type it knows nothing + about --- such as an extension type --- it looks in two places for a hint of + how to pickle it. One alternative is for the object to implement a + :meth:`__reduce__` method. If provided, at pickling time :meth:`__reduce__` + will be called with no arguments, and it must return either a string or a + tuple. + + If a string is returned, it names a global variable whose contents are + pickled as normal. The string returned by :meth:`__reduce__` should be the + object's local name relative to its module; the pickle module searches the + module namespace to determine the object's module. + + When a tuple is returned, it must be between two and five elements long. + Optional elements can either be omitted, or ``None`` can be provided as their + value. The contents of this tuple are pickled as normal and used to + reconstruct the object at unpickling time. The semantics of each element + are: + + * A callable object that will be called to create the initial version of the + object. The next element of the tuple will provide arguments for this + callable, and later elements provide additional state information that will + subsequently be used to fully reconstruct the pickled data. + + In the unpickling environment this object must be either a class, a + callable registered as a "safe constructor" (see below), or it must have an + attribute :attr:`__safe_for_unpickling__` with a true value. Otherwise, an + :exc:`UnpicklingError` will be raised in the unpickling environment. Note + that as usual, the callable itself is pickled by name. + + * A tuple of arguments for the callable object. + + .. versionchanged:: 2.5 + Formerly, this argument could also be ``None``. + + * Optionally, the object's state, which will be passed to the object's + :meth:`__setstate__` method as described in section :ref:`pickle-inst`. If + the object has no :meth:`__setstate__` method, then, as above, the value + must be a dictionary and it will be added to the object's :attr:`__dict__`. + + * Optionally, an iterator (and not a sequence) yielding successive list + items. These list items will be pickled, and appended to the object using + either ``obj.append(item)`` or ``obj.extend(list_of_items)``. This is + primarily used for list subclasses, but may be used by other classes as + long as they have :meth:`append` and :meth:`extend` methods with the + appropriate signature. (Whether :meth:`append` or :meth:`extend` is used + depends on which pickle protocol version is used as well as the number of + items to append, so both must be supported.) + + * Optionally, an iterator (not a sequence) yielding successive dictionary + items, which should be tuples of the form ``(key, value)``. These items + will be pickled and stored to the object using ``obj[key] = value``. This + is primarily used for dictionary subclasses, but may be used by other + classes as long as they implement :meth:`__setitem__`. + +.. method:: object.__reduce_ex__(protocol) + + It is sometimes useful to know the protocol version when implementing + :meth:`__reduce__`. This can be done by implementing a method named + :meth:`__reduce_ex__` instead of :meth:`__reduce__`. :meth:`__reduce_ex__`, + when it exists, is called in preference over :meth:`__reduce__` (you may + still provide :meth:`__reduce__` for backwards compatibility). The + :meth:`__reduce_ex__` method will be called with a single integer argument, + the protocol version. + + The :class:`object` class implements both :meth:`__reduce__` and + :meth:`__reduce_ex__`; however, if a subclass overrides :meth:`__reduce__` + but not :meth:`__reduce_ex__`, the :meth:`__reduce_ex__` implementation + detects this and calls :meth:`__reduce__`. An alternative to implementing a :meth:`__reduce__` method on the object to be pickled, is to register the callable with the :mod:`copy_reg` module. This Modified: python/branches/tlee-ast-optimize/Doc/library/rlcompleter.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/rlcompleter.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/rlcompleter.rst Sat Jul 5 13:12:42 2008 @@ -20,9 +20,9 @@ >>> import readline >>> readline.parse_and_bind("tab: complete") >>> readline. - readline.__doc__ readline.get_line_buffer readline.read_init_file - readline.__file__ readline.insert_text readline.set_completer - readline.__name__ readline.parse_and_bind + readline.__doc__ readline.get_line_buffer( readline.read_init_file( + readline.__file__ readline.insert_text( readline.set_completer( + readline.__name__ readline.parse_and_bind( >>> readline. The :mod:`rlcompleter` module is designed for use with Python's interactive Modified: python/branches/tlee-ast-optimize/Doc/library/shutil.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/shutil.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/shutil.rst Sat Jul 5 13:12:42 2008 @@ -78,18 +78,41 @@ Unix command :program:`cp -p`. -.. function:: copytree(src, dst[, symlinks]) +.. function:: ignore_patterns(\*patterns) + + This factory function creates a function that can be used as a callable for + :func:`copytree`\'s *ignore* argument, ignoring files and directories that + match one the glob-style *patterns* provided. See the example below. + + .. versionadded:: 2.6 + + +.. function:: copytree(src, dst[, symlinks=False[, ignore=None]]) Recursively copy an entire directory tree rooted at *src*. The destination - directory, named by *dst*, must not already exist; it will be created as well as - missing parent directories. Permissions and times of directories are copied with - :func:`copystat`, individual files are copied using :func:`copy2`. If - *symlinks* is true, symbolic links in the source tree are represented as - symbolic links in the new tree; if false or omitted, the contents of the linked - files are copied to the new tree. If exception(s) occur, an :exc:`Error` is - raised with a list of reasons. + directory, named by *dst*, must not already exist; it will be created as well + as missing parent directories. Permissions and times of directories are + copied with :func:`copystat`, individual files are copied using + :func:`copy2`. + + If *symlinks* is true, symbolic links in the source tree are represented as + symbolic links in the new tree; if false or omitted, the contents of the + linked files are copied to the new tree. + + If *ignore* is given, it must be a callable that will receive as its + arguments the directory being visited by :func:`copytree`, and a list of its + contents, as returned by :func:`os.listdir`. Since :func:`copytree` is + called recursively, the *ignore* callable will be called once for each + directory that is copied. The callable must return a sequence of directory + and file names relative to the current directory (i.e. a subset of the items + in its second argument); these names will then be ignored in the copy + process. :func:`ignore_patterns` can be used to create such a callable that + ignores names based on glob-style patterns. - The source code for this should be considered an example rather than a tool. + If exception(s) occur, an :exc:`Error` is raised with a list of reasons. + + The source code for this should be considered an example rather than the + ultimate tool. .. versionchanged:: 2.3 :exc:`Error` is raised if any exceptions occur during copying, rather than @@ -99,6 +122,9 @@ Create intermediate directories needed to create *dst*, rather than raising an error. Copy permissions and times of directories using :func:`copystat`. + .. versionchanged:: 2.6 + Added the *ignore* argument to be able to influence what is being copied. + .. function:: rmtree(path[, ignore_errors[, onerror]]) @@ -152,11 +178,18 @@ above, with the docstring omitted. It demonstrates many of the other functions provided by this module. :: - def copytree(src, dst, symlinks=False): + def copytree(src, dst, symlinks=False, ignore=None): names = os.listdir(src) + if ignore is not None: + ignored_names = ignore(src, names) + else: + ignored_names = set() + os.makedirs(dst) errors = [] for name in names: + if name in ignored_names: + continue srcname = os.path.join(src, name) dstname = os.path.join(dst, name) try: @@ -164,7 +197,7 @@ linkto = os.readlink(srcname) os.symlink(linkto, dstname) elif os.path.isdir(srcname): - copytree(srcname, dstname, symlinks) + copytree(srcname, dstname, symlinks, ignore) else: copy2(srcname, dstname) # XXX What about devices, sockets etc.? @@ -183,3 +216,24 @@ errors.extend((src, dst, str(why))) if errors: raise Error, errors + +Another example that uses the :func:`ignore_patterns` helper:: + + from shutil import copytree, ignore_patterns + + copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*')) + +This will copy everything except ``.pyc`` files and files or directories whose +name starts with ``tmp``. + +Another example that uses the *ignore* argument to add a logging call:: + + from shutil import copytree + import logging + + def _logpath(path, names): + logging.info('Working in %s' % path) + return [] # nothing will be ignored + + copytree(source, destination, ignore=_logpath) + Modified: python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst Sat Jul 5 13:12:42 2008 @@ -2055,12 +2055,12 @@ files, like ttys, it makes sense to continue reading after an EOF is hit.) Note that this method may call the underlying C function :cfunc:`fread` more than once in an effort to acquire as close to *size* bytes as possible. Also note - that when in non-blocking mode, less data than what was requested may be + that when in non-blocking mode, less data than was requested may be returned, even if no *size* parameter was given. .. note:: - As this function depends of the underlying C function :cfunc:`fread`, - it resembles its behaviour in details like caching EOF and others. + As this function depends on the underlying :cfunc:`fread` C function, + it will behave the same in details such as caching EOF. .. method:: file.readline([size]) Modified: python/branches/tlee-ast-optimize/Doc/library/zipfile.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/zipfile.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/zipfile.rst Sat Jul 5 13:12:42 2008 @@ -285,7 +285,7 @@ member of the given :class:`ZipInfo` instance. By default, the :class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`. -The following data attribute is also available: +The following data attributes are also available: .. attribute:: ZipFile.debug @@ -294,6 +294,12 @@ output) to ``3`` (the most output). Debugging information is written to ``sys.stdout``. +.. attribute:: ZipFile.comment + + The comment text associated with the ZIP file. If assigning a comment to a + :class:`ZipFile` instance created with mode 'a' or 'w', this should be a + string no longer than 65535 bytes. Comments longer than this will be + truncated in the written archive when :meth:`ZipFile.close` is called. .. _pyzipfile-objects: Modified: python/branches/tlee-ast-optimize/Lib/decimal.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/decimal.py (original) +++ python/branches/tlee-ast-optimize/Lib/decimal.py Sat Jul 5 13:12:42 2008 @@ -5337,20 +5337,20 @@ # other meaning for \d than the numbers [0-9]. import re -_parser = re.compile(r""" # A numeric string consists of: +_parser = re.compile(r""" # A numeric string consists of: # \s* - (?P[-+])? # an optional sign, followed by either... + (?P[-+])? # an optional sign, followed by either... ( - (?=\d|\.\d) # ...a number (with at least one digit) - (?P\d*) # consisting of a (possibly empty) integer part - (\.(?P\d*))? # followed by an optional fractional part - (E(?P[-+]?\d+))? # followed by an optional exponent, or... + (?=[0-9]|\.[0-9]) # ...a number (with at least one digit) + (?P[0-9]*) # having a (possibly empty) integer part + (\.(?P[0-9]*))? # followed by an optional fractional part + (E(?P[-+]?[0-9]+))? # followed by an optional exponent, or... | - Inf(inity)? # ...an infinity, or... + Inf(inity)? # ...an infinity, or... | - (?Ps)? # ...an (optionally signaling) - NaN # NaN - (?P\d*) # with (possibly empty) diagnostic information. + (?Ps)? # ...an (optionally signaling) + NaN # NaN + (?P[0-9]*) # with (possibly empty) diagnostic info. ) # \s* \Z Modified: python/branches/tlee-ast-optimize/Lib/pydoc.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/pydoc.py (original) +++ python/branches/tlee-ast-optimize/Lib/pydoc.py Sat Jul 5 13:12:42 2008 @@ -160,8 +160,9 @@ def visiblename(name, all=None): """Decide whether to show documentation on a variable.""" # Certain special names are redundant. - if name in ('__builtins__', '__doc__', '__file__', '__path__', - '__module__', '__name__', '__slots__'): return 0 + _hidden_names = ('__builtins__', '__doc__', '__file__', '__path__', + '__module__', '__name__', '__slots__', '__package__') + if name in _hidden_names: return 0 # Private names are hidden, but special names are displayed. if name.startswith('__') and name.endswith('__'): return 1 if all is not None: Modified: python/branches/tlee-ast-optimize/Lib/rlcompleter.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/rlcompleter.py (original) +++ python/branches/tlee-ast-optimize/Lib/rlcompleter.py Sat Jul 5 13:12:42 2008 @@ -92,6 +92,11 @@ except IndexError: return None + def _callable_postfix(self, val, word): + if callable(val): + word = word + "(" + return word + def global_matches(self, text): """Compute matches when text is a simple name. @@ -102,12 +107,13 @@ import keyword matches = [] n = len(text) - for list in [keyword.kwlist, - __builtin__.__dict__, - self.namespace]: - for word in list: + for word in keyword.kwlist: + if word[:n] == text: + matches.append(word) + for nspace in [__builtin__.__dict__, self.namespace]: + for word, val in nspace.items(): if word[:n] == text and word != "__builtins__": - matches.append(word) + matches.append(self._callable_postfix(val, word)) return matches def attr_matches(self, text): @@ -139,7 +145,9 @@ n = len(attr) for word in words: if word[:n] == attr and word != "__builtins__": - matches.append("%s.%s" % (expr, word)) + val = getattr(object, word) + word = self._callable_postfix(val, "%s.%s" % (expr, word)) + matches.append(word) return matches def get_class_members(klass): Modified: python/branches/tlee-ast-optimize/Lib/shutil.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/shutil.py (original) +++ python/branches/tlee-ast-optimize/Lib/shutil.py Sat Jul 5 13:12:42 2008 @@ -8,6 +8,7 @@ import sys import stat from os.path import abspath +import fnmatch __all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2", "copytree","move","rmtree","Error"] @@ -93,8 +94,19 @@ copyfile(src, dst) copystat(src, dst) +def ignore_patterns(*patterns): + """Function that can be used as copytree() ignore parameter. -def copytree(src, dst, symlinks=False): + Patterns is a sequence of glob-style patterns + that are used to exclude files""" + def _ignore_patterns(path, names): + ignored_names = [] + for pattern in patterns: + ignored_names.extend(fnmatch.filter(names, pattern)) + return set(ignored_names) + return _ignore_patterns + +def copytree(src, dst, symlinks=False, ignore=None): """Recursively copy a directory tree using copy2(). The destination directory must not already exist. @@ -105,13 +117,32 @@ it is false, the contents of the files pointed to by symbolic links are copied. + The optional ignore argument is a callable. If given, it + is called with the `src` parameter, which is the directory + being visited by copytree(), and `names` which is the list of + `src` contents, as returned by os.listdir(): + + callable(src, names) -> ignored_names + + Since copytree() is called recursively, the callable will be + called once for each directory that is copied. It returns a + list of names relative to the `src` directory that should + not be copied. + XXX Consider this example code rather than the ultimate tool. """ names = os.listdir(src) + if ignore is not None: + ignored_names = ignore(src, names) + else: + ignored_names = set() + os.makedirs(dst) errors = [] for name in names: + if name in ignored_names: + continue srcname = os.path.join(src, name) dstname = os.path.join(dst, name) try: @@ -119,7 +150,7 @@ linkto = os.readlink(srcname) os.symlink(linkto, dstname) elif os.path.isdir(srcname): - copytree(srcname, dstname, symlinks) + copytree(srcname, dstname, symlinks, ignore) else: copy2(srcname, dstname) # XXX What about devices, sockets etc.? Modified: python/branches/tlee-ast-optimize/Lib/test/test_cookielib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_cookielib.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_cookielib.py Sat Jul 5 13:12:42 2008 @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: latin-1 -*- """Tests for cookielib.py.""" import re, os, time Modified: python/branches/tlee-ast-optimize/Lib/test/test_decimal.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_decimal.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_decimal.py Sat Jul 5 13:12:42 2008 @@ -432,6 +432,9 @@ self.assertEqual(str(Decimal(u'-Inf')), '-Infinity') self.assertEqual(str(Decimal(u'NaN123')), 'NaN123') + #but alternate unicode digits should not + self.assertEqual(str(Decimal(u'\uff11')), 'NaN') + def test_explicit_from_tuples(self): #zero Modified: python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_multiprocessing.py Sat Jul 5 13:12:42 2008 @@ -1,3 +1,5 @@ +#!/usr/bin/env python + # # Unit tests for the multiprocessing package # @@ -960,7 +962,6 @@ def sqr(x, wait=0.0): time.sleep(wait) return x*x -""" class _TestPool(BaseTestCase): def test_apply(self): @@ -1030,7 +1031,6 @@ join = TimingWrapper(self.pool.join) join() self.assertTrue(join.elapsed < 0.2) -""" # # Test that manager has expected number of shared objects left # @@ -1333,7 +1333,6 @@ self.assertRaises(ValueError, a.send_bytes, msg, 4, -1) -""" class _TestListenerClient(BaseTestCase): ALLOWED_TYPES = ('processes', 'threads') @@ -1353,7 +1352,6 @@ self.assertEqual(conn.recv(), 'hello') p.join() l.close() -""" # # Test of sending connection and socket objects between processes # @@ -1769,28 +1767,28 @@ multiprocessing.get_logger().setLevel(LOG_LEVEL) - #ProcessesMixin.pool = multiprocessing.Pool(4) - #ThreadsMixin.pool = multiprocessing.dummy.Pool(4) - #ManagerMixin.manager.__init__() - #ManagerMixin.manager.start() - #ManagerMixin.pool = ManagerMixin.manager.Pool(4) + ProcessesMixin.pool = multiprocessing.Pool(4) + ThreadsMixin.pool = multiprocessing.dummy.Pool(4) + ManagerMixin.manager.__init__() + ManagerMixin.manager.start() + ManagerMixin.pool = ManagerMixin.manager.Pool(4) testcases = ( - sorted(testcases_processes.values(), key=lambda tc:tc.__name__) #+ - #sorted(testcases_threads.values(), key=lambda tc:tc.__name__) + - #sorted(testcases_manager.values(), key=lambda tc:tc.__name__) + sorted(testcases_processes.values(), key=lambda tc:tc.__name__) + + sorted(testcases_threads.values(), key=lambda tc:tc.__name__) + + sorted(testcases_manager.values(), key=lambda tc:tc.__name__) ) loadTestsFromTestCase = unittest.defaultTestLoader.loadTestsFromTestCase suite = unittest.TestSuite(loadTestsFromTestCase(tc) for tc in testcases) run(suite) - #ThreadsMixin.pool.terminate() - #ProcessesMixin.pool.terminate() - #ManagerMixin.pool.terminate() - #ManagerMixin.manager.shutdown() + ThreadsMixin.pool.terminate() + ProcessesMixin.pool.terminate() + ManagerMixin.pool.terminate() + ManagerMixin.manager.shutdown() - #del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool + del ProcessesMixin.pool, ThreadsMixin.pool, ManagerMixin.pool def main(): test_main(unittest.TextTestRunner(verbosity=2).run) Modified: python/branches/tlee-ast-optimize/Lib/test/test_pydoc.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_pydoc.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_pydoc.py Sat Jul 5 13:12:42 2008 @@ -57,7 +57,6 @@ DATA __author__ = 'Benjamin Peterson' __credits__ = 'Nobody' - __package__ = None __version__ = '1.2.3.4' VERSION @@ -146,7 +145,6 @@         __author__ = 'Benjamin Peterson'
__credits__ = 'Nobody'
-__package__ = None
__version__ = '1.2.3.4'

Modified: python/branches/tlee-ast-optimize/Lib/test/test_shutil.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_shutil.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_shutil.py Sat Jul 5 13:12:42 2008 @@ -108,6 +108,82 @@ if os.path.exists(path): shutil.rmtree(path) + def test_copytree_with_exclude(self): + + def write_data(path, data): + f = open(path, "w") + f.write(data) + f.close() + + def read_data(path): + f = open(path) + data = f.read() + f.close() + return data + + # creating data + join = os.path.join + exists = os.path.exists + src_dir = tempfile.mkdtemp() + dst_dir = join(tempfile.mkdtemp(), 'destination') + write_data(join(src_dir, 'test.txt'), '123') + write_data(join(src_dir, 'test.tmp'), '123') + os.mkdir(join(src_dir, 'test_dir')) + write_data(join(src_dir, 'test_dir', 'test.txt'), '456') + os.mkdir(join(src_dir, 'test_dir2')) + write_data(join(src_dir, 'test_dir2', 'test.txt'), '456') + os.mkdir(join(src_dir, 'test_dir2', 'subdir')) + os.mkdir(join(src_dir, 'test_dir2', 'subdir2')) + write_data(join(src_dir, 'test_dir2', 'subdir', 'test.txt'), '456') + write_data(join(src_dir, 'test_dir2', 'subdir2', 'test.py'), '456') + + + # testing glob-like patterns + try: + patterns = shutil.ignore_patterns('*.tmp', 'test_dir2') + shutil.copytree(src_dir, dst_dir, ignore=patterns) + # checking the result: some elements should not be copied + self.assert_(exists(join(dst_dir, 'test.txt'))) + self.assert_(not exists(join(dst_dir, 'test.tmp'))) + self.assert_(not exists(join(dst_dir, 'test_dir2'))) + finally: + if os.path.exists(dst_dir): + shutil.rmtree(dst_dir) + try: + patterns = shutil.ignore_patterns('*.tmp', 'subdir*') + shutil.copytree(src_dir, dst_dir, ignore=patterns) + # checking the result: some elements should not be copied + self.assert_(not exists(join(dst_dir, 'test.tmp'))) + self.assert_(not exists(join(dst_dir, 'test_dir2', 'subdir2'))) + self.assert_(not exists(join(dst_dir, 'test_dir2', 'subdir'))) + finally: + if os.path.exists(dst_dir): + shutil.rmtree(dst_dir) + + # testing callable-style + try: + def _filter(src, names): + res = [] + for name in names: + path = os.path.join(src, name) + + if (os.path.isdir(path) and + path.split()[-1] == 'subdir'): + res.append(name) + elif os.path.splitext(path)[-1] in ('.py'): + res.append(name) + return res + + shutil.copytree(src_dir, dst_dir, ignore=_filter) + + # checking the result: some elements should not be copied + self.assert_(not exists(join(dst_dir, 'test_dir2', 'subdir2', + 'test.py'))) + self.assert_(not exists(join(dst_dir, 'test_dir2', 'subdir'))) + + finally: + if os.path.exists(dst_dir): + shutil.rmtree(dst_dir) if hasattr(os, "symlink"): def test_dont_copy_file_onto_link_to_itself(self): Modified: python/branches/tlee-ast-optimize/Lib/test/test_zipfile.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_zipfile.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_zipfile.py Sat Jul 5 13:12:42 2008 @@ -712,6 +712,54 @@ zipf.writestr("foo.txt\x00qqq", "O, for a Muse of Fire!") self.assertEqual(zipf.namelist(), ['foo.txt']) + def test_StructSizes(self): + # check that ZIP internal structure sizes are calculated correctly + self.assertEqual(zipfile.sizeEndCentDir, 22) + self.assertEqual(zipfile.sizeCentralDir, 46) + self.assertEqual(zipfile.sizeEndCentDir64, 56) + self.assertEqual(zipfile.sizeEndCentDir64Locator, 20) + + def testComments(self): + # This test checks that comments on the archive are handled properly + + # check default comment is empty + zipf = zipfile.ZipFile(TESTFN, mode="w") + self.assertEqual(zipf.comment, '') + zipf.writestr("foo.txt", "O, for a Muse of Fire!") + zipf.close() + zipfr = zipfile.ZipFile(TESTFN, mode="r") + self.assertEqual(zipfr.comment, '') + zipfr.close() + + # check a simple short comment + comment = 'Bravely taking to his feet, he beat a very brave retreat.' + zipf = zipfile.ZipFile(TESTFN, mode="w") + zipf.comment = comment + zipf.writestr("foo.txt", "O, for a Muse of Fire!") + zipf.close() + zipfr = zipfile.ZipFile(TESTFN, mode="r") + self.assertEqual(zipfr.comment, comment) + zipfr.close() + + # check a comment of max length + comment2 = ''.join(['%d' % (i**3 % 10) for i in xrange((1 << 16)-1)]) + zipf = zipfile.ZipFile(TESTFN, mode="w") + zipf.comment = comment2 + zipf.writestr("foo.txt", "O, for a Muse of Fire!") + zipf.close() + zipfr = zipfile.ZipFile(TESTFN, mode="r") + self.assertEqual(zipfr.comment, comment2) + zipfr.close() + + # check a comment that is too long is truncated + zipf = zipfile.ZipFile(TESTFN, mode="w") + zipf.comment = comment2 + 'oops' + zipf.writestr("foo.txt", "O, for a Muse of Fire!") + zipf.close() + zipfr = zipfile.ZipFile(TESTFN, mode="r") + self.assertEqual(zipfr.comment, comment2) + zipfr.close() + def tearDown(self): support.unlink(TESTFN) support.unlink(TESTFN2) Modified: python/branches/tlee-ast-optimize/Lib/test/test_zipfile64.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_zipfile64.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_zipfile64.py Sat Jul 5 13:12:42 2008 @@ -2,6 +2,7 @@ # The test_support.requires call is the only reason for keeping this separate # from test_zipfile from test import test_support + # XXX(nnorwitz): disable this test by looking for extra largfile resource # which doesn't exist. This test takes over 30 minutes to run in general # and requires more disk space than most of the buildbots. @@ -93,8 +94,31 @@ if os.path.exists(fname): os.remove(fname) + +class OtherTests(unittest.TestCase): + def testMoreThan64kFiles(self): + # This test checks that more than 64k files can be added to an archive, + # and that the resulting archive can be read properly by ZipFile + zipf = zipfile.ZipFile(TESTFN, mode="w") + zipf.debug = 100 + numfiles = (1 << 16) * 3/2 + for i in xrange(numfiles): + zipf.writestr("foo%08d" % i, "%d" % (i**3 % 57)) + self.assertEqual(len(zipf.namelist()), numfiles) + zipf.close() + + zipf2 = zipfile.ZipFile(TESTFN, mode="r") + self.assertEqual(len(zipf2.namelist()), numfiles) + for i in xrange(numfiles): + self.assertEqual(zipf2.read("foo%08d" % i), "%d" % (i**3 % 57)) + zipf.close() + + def tearDown(self): + test_support.unlink(TESTFN) + test_support.unlink(TESTFN2) + def test_main(): - run_unittest(TestsWithSourceFile) + run_unittest(TestsWithSourceFile, OtherTests) if __name__ == "__main__": test_main() Modified: python/branches/tlee-ast-optimize/Lib/zipfile.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/zipfile.py (original) +++ python/branches/tlee-ast-optimize/Lib/zipfile.py Sat Jul 5 13:12:42 2008 @@ -27,31 +27,79 @@ error = BadZipfile # The exception raised by this module ZIP64_LIMIT= (1 << 31) - 1 +ZIP_FILECOUNT_LIMIT = 1 << 16 +ZIP_MAX_COMMENT = (1 << 16) - 1 # constants for Zip file compression methods ZIP_STORED = 0 ZIP_DEFLATED = 8 # Other ZIP compression methods not supported -# Here are some struct module formats for reading headers -structEndArchive = "<4s4H2LH" # 9 items, end of archive, 22 bytes -stringEndArchive = "PK\005\006" # magic number for end of archive record -structCentralDir = "<4s4B4HLLL5HLL"# 19 items, central directory, 46 bytes -stringCentralDir = "PK\001\002" # magic number for central directory -structFileHeader = "<4s2B4HLLL2H" # 12 items, file header record, 30 bytes -stringFileHeader = "PK\003\004" # magic number for file header -structEndArchive64Locator = "<4sLQL" # 4 items, locate Zip64 header, 20 bytes -stringEndArchive64Locator = "PK\x06\x07" # magic token for locator header -structEndArchive64 = "<4sQHHLLQQQQ" # 10 items, end of archive (Zip64), 56 bytes -stringEndArchive64 = "PK\x06\x06" # magic token for Zip64 header - +# Below are some formats and associated data for reading/writing headers using +# the struct module. The names and structures of headers/records are those used +# in the PKWARE description of the ZIP file format: +# http://www.pkware.com/documents/casestudies/APPNOTE.TXT +# (URL valid as of January 2008) + +# The "end of central directory" structure, magic number, size, and indices +# (section V.I in the format document) +structEndCentDir = "<4s4H2LH" +magicEndCentDir = "PK\005\006" +sizeEndCentDir = struct.calcsize(structEndCentDir) + +_ECD_SIGNATURE = 0 +_ECD_DISK_NUMBER = 1 +_ECD_DISK_START = 2 +_ECD_ENTRIES_THIS_DISK = 3 +_ECD_ENTRIES_TOTAL = 4 +_ECD_SIZE = 5 +_ECD_OFFSET = 6 +_ECD_COMMENT_SIZE = 7 +# These last two indices are not part of the structure as defined in the +# spec, but they are used internally by this module as a convenience +_ECD_COMMENT = 8 +_ECD_LOCATION = 9 + +# The "central directory" structure, magic number, size, and indices +# of entries in the structure (section V.F in the format document) +structCentralDir = "<4s4B4HL2L5H2L" +magicCentralDir = "PK\001\002" +sizeCentralDir = struct.calcsize(structCentralDir) + +# The "local file header" structure, magic number, size, and indices +# (section V.A in the format document) +structFileHeader = "<4s2B4HL2L2H" +magicFileHeader = "PK\003\004" +sizeFileHeader = struct.calcsize(structFileHeader) + +# The "Zip64 end of central directory locator" structure, magic number, and size +structEndCentDir64Locator = "<4sLQL" +magicEndCentDir64Locator = "PK\x06\x07" +sizeEndCentDir64Locator = struct.calcsize(structEndCentDir64Locator) + +# The "Zip64 end of central directory" record, magic number, size, and indices +# (section V.G in the format document) +structEndCentDir64 = "<4sQ2H2L4Q" +magicEndCentDir64 = "PK\x06\x06" +sizeEndCentDir64 = struct.calcsize(structEndCentDir64) + +_CD64_SIGNATURE = 0 +_CD64_DIRECTORY_RECSIZE = 1 +_CD64_CREATE_VERSION = 2 +_CD64_EXTRACT_VERSION = 3 +_CD64_DISK_NUMBER = 4 +_CD64_DISK_NUMBER_START = 5 +_CD64_NUMBER_ENTRIES_THIS_DISK = 6 +_CD64_NUMBER_ENTRIES_TOTAL = 7 +_CD64_DIRECTORY_SIZE = 8 +_CD64_OFFSET_START_CENTDIR = 9 # indexes of entries in the central directory structure _CD_SIGNATURE = 0 _CD_CREATE_VERSION = 1 _CD_CREATE_SYSTEM = 2 _CD_EXTRACT_VERSION = 3 -_CD_EXTRACT_SYSTEM = 4 # is this meaningful? +_CD_EXTRACT_SYSTEM = 4 _CD_FLAG_BITS = 5 _CD_COMPRESS_TYPE = 6 _CD_TIME = 7 @@ -67,10 +115,15 @@ _CD_EXTERNAL_FILE_ATTRIBUTES = 17 _CD_LOCAL_HEADER_OFFSET = 18 -# indexes of entries in the local file header structure +# The "local file header" structure, magic number, size, and indices +# (section V.A in the format document) +structFileHeader = "<4s2B4HL2L2H" +magicFileHeader = "PK\003\004" +sizeFileHeader = struct.calcsize(structFileHeader) + _FH_SIGNATURE = 0 _FH_EXTRACT_VERSION = 1 -_FH_EXTRACT_SYSTEM = 2 # is this meaningful? +_FH_EXTRACT_SYSTEM = 2 _FH_GENERAL_PURPOSE_FLAG_BITS = 3 _FH_COMPRESSION_METHOD = 4 _FH_LAST_MOD_TIME = 5 @@ -81,6 +134,28 @@ _FH_FILENAME_LENGTH = 10 _FH_EXTRA_FIELD_LENGTH = 11 +# The "Zip64 end of central directory locator" structure, magic number, and size +structEndCentDir64Locator = "<4sLQL" +magicEndCentDir64Locator = "PK\x06\x07" +sizeEndCentDir64Locator = struct.calcsize(structEndCentDir64Locator) + +# The "Zip64 end of central directory" record, magic number, size, and indices +# (section V.G in the format document) +structEndCentDir64 = "<4sQ2H2L4Q" +magicEndCentDir64 = "PK\x06\x06" +sizeEndCentDir64 = struct.calcsize(structEndCentDir64) + +_CD64_SIGNATURE = 0 +_CD64_DIRECTORY_RECSIZE = 1 +_CD64_CREATE_VERSION = 2 +_CD64_EXTRACT_VERSION = 3 +_CD64_DISK_NUMBER = 4 +_CD64_DISK_NUMBER_START = 5 +_CD64_NUMBER_ENTRIES_THIS_DISK = 6 +_CD64_NUMBER_ENTRIES_TOTAL = 7 +_CD64_DIRECTORY_SIZE = 8 +_CD64_OFFSET_START_CENTDIR = 9 + def is_zipfile(filename): """Quickly see if file is a ZIP file by checking the magic number.""" try: @@ -97,33 +172,31 @@ """ Read the ZIP64 end-of-archive records and use that to update endrec """ - locatorSize = struct.calcsize(structEndArchive64Locator) - fpin.seek(offset - locatorSize, 2) - data = fpin.read(locatorSize) - sig, diskno, reloff, disks = struct.unpack(structEndArchive64Locator, data) - if sig != stringEndArchive64Locator: + fpin.seek(offset - sizeEndCentDir64Locator, 2) + data = fpin.read(sizeEndCentDir64Locator) + sig, diskno, reloff, disks = struct.unpack(structEndCentDir64Locator, data) + if sig != magicEndCentDir64Locator: return endrec if diskno != 0 or disks != 1: raise BadZipfile("zipfiles that span multiple disks are not supported") # Assume no 'zip64 extensible data' - endArchiveSize = struct.calcsize(structEndArchive64) - fpin.seek(offset - locatorSize - endArchiveSize, 2) - data = fpin.read(endArchiveSize) + fpin.seek(offset - sizeEndCentDir64Locator - sizeEndCentDir64, 2) + data = fpin.read(sizeEndCentDir64) sig, sz, create_version, read_version, disk_num, disk_dir, \ dircount, dircount2, dirsize, diroffset = \ - struct.unpack(structEndArchive64, data) - if sig != stringEndArchive64: + struct.unpack(structEndCentDir64, data) + if sig != magicEndCentDir64: return endrec # Update the original endrec using data from the ZIP64 record - endrec[1] = disk_num - endrec[2] = disk_dir - endrec[3] = dircount - endrec[4] = dircount2 - endrec[5] = dirsize - endrec[6] = diroffset + endrec[_ECD_DISK_NUMBER] = disk_num + endrec[_ECD_DISK_START] = disk_dir + endrec[_ECD_ENTRIES_THIS_DISK] = dircount + endrec[_ECD_ENTRIES_TOTAL] = dircount2 + endrec[_ECD_SIZE] = dirsize + endrec[_ECD_OFFSET] = diroffset return endrec @@ -132,38 +205,59 @@ The data is a list of the nine items in the ZIP "End of central dir" record followed by a tenth item, the file seek offset of this record.""" - fpin.seek(-22, 2) # Assume no archive comment. - filesize = fpin.tell() + 22 # Get file size + + # Determine file size + fpin.seek(0, 2) + filesize = fpin.tell() + + # Check to see if this is ZIP file with no archive comment (the + # "end of central directory" structure should be the last item in the + # file if this is the case). + fpin.seek(-sizeEndCentDir, 2) data = fpin.read() - if data[0:4] == stringEndArchive and data[-2:] == "\000\000": - endrec = struct.unpack(structEndArchive, data) - endrec = list(endrec) - endrec.append("") # Append the archive comment - endrec.append(filesize - 22) # Append the record start offset - if endrec[-4] == 0xffffffff: - return _EndRecData64(fpin, -22, endrec) + if data[0:4] == magicEndCentDir and data[-2:] == "\000\000": + # the signature is correct and there's no comment, unpack structure + endrec = struct.unpack(structEndCentDir, data) + endrec=list(endrec) + + # Append a blank comment and record start offset + endrec.append("") + endrec.append(filesize - sizeEndCentDir) + if endrec[_ECD_OFFSET] == 0xffffffff: + # the value for the "offset of the start of the central directory" + # indicates that there is a "Zip64 end of central directory" + # structure present, so go look for it + return _EndRecData64(fpin, -sizeEndCentDir, endrec) + return endrec - # Search the last END_BLOCK bytes of the file for the record signature. - # The comment is appended to the ZIP file and has a 16 bit length. - # So the comment may be up to 64K long. We limit the search for the - # signature to a few Kbytes at the end of the file for efficiency. - # also, the signature must not appear in the comment. - END_BLOCK = min(filesize, 1024 * 4) - fpin.seek(filesize - END_BLOCK, 0) + + # Either this is not a ZIP file, or it is a ZIP file with an archive + # comment. Search the end of the file for the "end of central directory" + # record signature. The comment is the last item in the ZIP file and may be + # up to 64K long. It is assumed that the "end of central directory" magic + # number does not appear in the comment. + maxCommentStart = max(filesize - (1 << 16) - sizeEndCentDir, 0) + fpin.seek(maxCommentStart, 0) data = fpin.read() - start = data.rfind(stringEndArchive) - if start >= 0: # Correct signature string was found - endrec = struct.unpack(structEndArchive, data[start:start+22]) - endrec = list(endrec) - comment = data[start+22:] - if endrec[7] == len(comment): # Comment length checks out + start = data.rfind(magicEndCentDir) + if start >= 0: + # found the magic number; attempt to unpack and interpret + recData = data[start:start+sizeEndCentDir] + endrec = list(struct.unpack(structEndCentDir, recData)) + comment = data[start+sizeEndCentDir:] + # check that comment length is correct + if endrec[_ECD_COMMENT_SIZE] == len(comment): # Append the archive comment and start offset endrec.append(comment) - endrec.append(filesize - END_BLOCK + start) - if endrec[-4] == 0xffffffff: - return _EndRecData64(fpin, - END_BLOCK + start, endrec) + endrec.append(maxCommentStart + start) + if endrec[_ECD_OFFSET] == 0xffffffff: + # There is apparently a "Zip64 end of central directory" + # structure present, so go look for it + return _EndRecData64(fpin, start - filesize, endrec) return endrec - return # Error, return None + + # Unable to find a valid end of central directory structure + return class ZipInfo (object): @@ -250,13 +344,13 @@ fmt = ' 1: print endrec - size_cd = endrec[5] # bytes in central directory - offset_cd = endrec[6] # offset of central directory - self.comment = endrec[8] # archive comment - # endrec[9] is the offset of the "End of Central Dir" record - if endrec[9] > ZIP64_LIMIT: - x = endrec[9] - size_cd - 56 - 20 - else: - x = endrec[9] - size_cd + size_cd = endrec[_ECD_SIZE] # bytes in central directory + offset_cd = endrec[_ECD_OFFSET] # offset of central directory + self.comment = endrec[_ECD_COMMENT] # archive comment + # "concat" is zero, unless zip was concatenated to another file - concat = x - offset_cd + concat = endrec[_ECD_LOCATION] - size_cd - offset_cd + if endrec[_ECD_LOCATION] > ZIP64_LIMIT: + # If the offset of the "End of Central Dir" record requires Zip64 + # extension structures, account for them + concat -= (sizeEndCentDir64 + sizeEndCentDir64Locator) + if self.debug > 2: - print "given, inferred, offset", offset_cd, x, concat + inferred = concat + offset_cd + print "given, inferred, offset", offset_cd, inferred, concat # self.start_dir: Position of start of central directory self.start_dir = offset_cd + concat fp.seek(self.start_dir, 0) @@ -682,9 +778,8 @@ fp = cStringIO.StringIO(data) total = 0 while total < size_cd: - centdir = fp.read(46) - total = total + 46 - if centdir[0:4] != stringCentralDir: + centdir = fp.read(sizeCentralDir) + if centdir[0:4] != magicCentralDir: raise BadZipfile, "Bad magic number for central directory" centdir = struct.unpack(structCentralDir, centdir) if self.debug > 2: @@ -694,9 +789,6 @@ x = ZipInfo(filename) x.extra = fp.read(centdir[_CD_EXTRA_FIELD_LENGTH]) x.comment = fp.read(centdir[_CD_COMMENT_LENGTH]) - total = (total + centdir[_CD_FILENAME_LENGTH] - + centdir[_CD_EXTRA_FIELD_LENGTH] - + centdir[_CD_COMMENT_LENGTH]) x.header_offset = centdir[_CD_LOCAL_HEADER_OFFSET] (x.create_version, x.create_system, x.extract_version, x.reserved, x.flag_bits, x.compress_type, t, d, @@ -712,6 +804,12 @@ x.filename = x._decodeFilename() self.filelist.append(x) self.NameToInfo[x.filename] = x + + # update total bytes read from central directory + total = (total + sizeCentralDir + centdir[_CD_FILENAME_LENGTH] + + centdir[_CD_EXTRA_FIELD_LENGTH] + + centdir[_CD_COMMENT_LENGTH]) + if self.debug > 2: print "total", total @@ -743,7 +841,6 @@ except BadZipfile: return zinfo.filename - def getinfo(self, name): """Return the instance of ZipInfo given 'name'.""" info = self.NameToInfo.get(name) @@ -787,8 +884,8 @@ zef_file.seek(zinfo.header_offset, 0) # Skip the file header: - fheader = zef_file.read(30) - if fheader[0:4] != stringFileHeader: + fheader = zef_file.read(sizeFileHeader) + if fheader[0:4] != magicFileHeader: raise BadZipfile, "Bad magic number for file header" fheader = struct.unpack(structFileHeader, fheader) @@ -1048,15 +1145,15 @@ or zinfo.compress_size > ZIP64_LIMIT: extra.append(zinfo.file_size) extra.append(zinfo.compress_size) - file_size = 0xffffffff #-1 - compress_size = 0xffffffff #-1 + file_size = 0xffffffff + compress_size = 0xffffffff else: file_size = zinfo.file_size compress_size = zinfo.compress_size if zinfo.header_offset > ZIP64_LIMIT: extra.append(zinfo.header_offset) - header_offset = 0xffffffffL # -1 32 bit + header_offset = 0xffffffffL else: header_offset = zinfo.header_offset @@ -1076,7 +1173,7 @@ try: filename, flag_bits = zinfo._encodeFilenameFlags() centdir = struct.pack(structCentralDir, - stringCentralDir, create_version, + magicCentralDir, create_version, zinfo.create_system, extract_version, zinfo.reserved, flag_bits, zinfo.compress_type, dostime, dosdate, zinfo.CRC, compress_size, file_size, @@ -1100,27 +1197,35 @@ pos2 = self.fp.tell() # Write end-of-zip-archive record + centDirOffset = pos1 if pos1 > ZIP64_LIMIT: # Need to write the ZIP64 end-of-archive records zip64endrec = struct.pack( - structEndArchive64, stringEndArchive64, + structEndCentDir64, magicEndCentDir64, 44, 45, 45, 0, 0, count, count, pos2 - pos1, pos1) self.fp.write(zip64endrec) zip64locrec = struct.pack( - structEndArchive64Locator, - stringEndArchive64Locator, 0, pos2, 1) + structEndCentDir64Locator, + magicEndCentDir64Locator, 0, pos2, 1) self.fp.write(zip64locrec) + centDirOffset = 0xFFFFFFFF - endrec = struct.pack(structEndArchive, stringEndArchive, - 0, 0, count, count, pos2 - pos1, 0xffffffffL, 0) - self.fp.write(endrec) - - else: - endrec = struct.pack(structEndArchive, stringEndArchive, - 0, 0, count, count, pos2 - pos1, pos1, 0) - self.fp.write(endrec) + # check for valid comment length + if len(self.comment) >= ZIP_MAX_COMMENT: + if self.debug > 0: + msg = 'Archive comment is too long; truncating to %d bytes' \ + % ZIP_MAX_COMMENT + self.comment = self.comment[:ZIP_MAX_COMMENT] + + endrec = struct.pack(structEndCentDir, magicEndCentDir, + 0, 0, count % ZIP_FILECOUNT_LIMIT, + count % ZIP_FILECOUNT_LIMIT, pos2 - pos1, + centDirOffset, len(self.comment)) + self.fp.write(endrec) + self.fp.write(self.comment) self.fp.flush() + if not self._filePassed: self.fp.close() self.fp = None Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Sat Jul 5 13:12:42 2008 @@ -29,10 +29,25 @@ would not cause a syntax error. This was regression from 2.4 caused by the switch to the new compiler. - Library ------- +- Issue #2663: add filtering capability to shutil.copytree(). + +- Issue #1622: Correct interpretation of various ZIP header fields. + +- Issue #1526: Allow more than 64k files to be added to Zip64 file. + +- Issue #1746: Correct handling of zipfile archive comments (previously + archives with comments over 4k were flagged as invalid). Allow writing + Zip files with archives by setting the 'comment' attribute of a ZipFile. + +- Issue #449227: Now with the rlcompleter module, callable objects are added + "(" when completed. + +- Issue #3190: Pydoc now hides the automatic module attribute __package__ (the + handling is now the same as that of other special attributes like __name__). + - Issue #2885 (partial): The urllib.urlopen() function has been deprecated for removal in Python 3.0 in favor of urllib2.urlopen(). @@ -40,7 +55,6 @@ urllib module in Python 3.0 to urllib.request, urllib.parse, and urllib.error. - Build ----- Modified: python/branches/tlee-ast-optimize/Modules/nismodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/nismodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/nismodule.c Sat Jul 5 13:12:42 2008 @@ -98,6 +98,7 @@ struct ypcallback_data { PyObject *dict; int fix; + PyThreadState *state; }; static int @@ -109,6 +110,7 @@ PyObject *val; int err; + PyEval_RestoreThread(indata->state); if (indata->fix) { if (inkeylen > 0 && inkey[inkeylen-1] == '\0') inkeylen--; @@ -127,10 +129,11 @@ err = PyDict_SetItem(indata->dict, key, val); Py_DECREF(key); Py_DECREF(val); - if (err != 0) { + if (err != 0) PyErr_Clear(); - return 1; - } + indata->state = PyEval_SaveThread(); + if (err != 0) + return 1; return 0; } return 1; @@ -206,9 +209,9 @@ data.dict = dict; map = nis_mapname (map, &data.fix); cb.data = (char *)&data; - Py_BEGIN_ALLOW_THREADS + data.state = PyEval_SaveThread(); err = yp_all (domain, map, &cb); - Py_END_ALLOW_THREADS + PyEval_RestoreThread(data.state); if (err != 0) { Py_DECREF(dict); return nis_error(err); Modified: python/branches/tlee-ast-optimize/Python/ceval.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/ceval.c (original) +++ python/branches/tlee-ast-optimize/Python/ceval.c Sat Jul 5 13:12:42 2008 @@ -615,18 +615,20 @@ COMPARE_OP is often followed by JUMP_IF_FALSE or JUMP_IF_TRUE. And, those opcodes are often followed by a POP_TOP. - Verifying the prediction costs a single high-speed test of register + Verifying the prediction costs a single high-speed test of a register variable against a constant. If the pairing was good, then the - processor has a high likelihood of making its own successful branch - prediction which results in a nearly zero overhead transition to the - next opcode. - - A successful prediction saves a trip through the eval-loop including - its two unpredictable branches, the HAS_ARG test and the switch-case. - - If collecting opcode statistics, turn off prediction so that - statistics are accurately maintained (the predictions bypass - the opcode frequency counter updates). + processor's own internal branch predication has a high likelihood of + success, resulting in a nearly zero-overhead transition to the + next opcode. A successful prediction saves a trip through the eval-loop + including its two unpredictable branches, the HAS_ARG test and the + switch-case. Combined with the processor's internal branch prediction, + a successful PREDICT has the effect of making the two opcodes run as if + they were a single new opcode with the bodies combined. + + If collecting opcode statistics, your choices are to either keep the + predictions turned-on and interpret the results as if some opcodes + had been combined or turn-off predictions so that the opcode frequency + counter updates for both opcodes. */ #ifdef DYNAMIC_EXECUTION_PROFILE Modified: python/branches/tlee-ast-optimize/Python/pythonrun.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/pythonrun.c (original) +++ python/branches/tlee-ast-optimize/Python/pythonrun.c Sat Jul 5 13:12:42 2008 @@ -231,14 +231,14 @@ if (install_sigs) initsigs(); /* Signal handling stuff, including initintr() */ - /* Initialize warnings. */ - _PyWarnings_Init(); - if (PySys_HasWarnOptions()) { - PyObject *warnings_module = PyImport_ImportModule("warnings"); - if (!warnings_module) - PyErr_Clear(); - Py_XDECREF(warnings_module); - } + /* Initialize warnings. */ + _PyWarnings_Init(); + if (PySys_HasWarnOptions()) { + PyObject *warnings_module = PyImport_ImportModule("warnings"); + if (!warnings_module) + PyErr_Clear(); + Py_XDECREF(warnings_module); + } initmain(); /* Module __main__ */ if (!Py_NoSiteFlag) @@ -1128,7 +1128,7 @@ PyErr_NormalizeException(&exception, &v, &tb); if (exception == NULL) return; - /* Now we know v != NULL too */ + /* Now we know v != NULL too */ if (set_sys_last_vars) { PySys_SetObject("last_type", exception); PySys_SetObject("last_value", v); @@ -1903,14 +1903,14 @@ PyAPI_FUNC(PyObject *) PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l) { - return PyRun_FileExFlags(fp, p, s, g, l, 0, NULL); + return PyRun_FileExFlags(fp, p, s, g, l, 0, NULL); } #undef PyRun_FileEx PyAPI_FUNC(PyObject *) PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c) { - return PyRun_FileExFlags(fp, p, s, g, l, c, NULL); + return PyRun_FileExFlags(fp, p, s, g, l, c, NULL); } #undef PyRun_FileFlags @@ -1918,7 +1918,7 @@ PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags) { - return PyRun_FileExFlags(fp, p, s, g, l, 0, flags); + return PyRun_FileExFlags(fp, p, s, g, l, 0, flags); } #undef PyRun_SimpleFile From buildbot at python.org Sat Jul 5 13:16:28 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 11:16:28 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20080705111628.F3A731E400E@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3322 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/cluster/members/member0/tmp/tmpz477bz/cgi-bin/file2.py", line 2, in import cgi sincerely, -The Buildbot From python-checkins at python.org Sat Jul 5 13:33:52 2008 From: python-checkins at python.org (mark.dickinson) Date: Sat, 5 Jul 2008 13:33:52 +0200 (CEST) Subject: [Python-checkins] r64729 - in python/trunk: Lib/test/test_float.py Objects/floatobject.c Message-ID: <20080705113352.DF4BF1E4003@bag.python.org> Author: mark.dickinson Date: Sat Jul 5 13:33:52 2008 New Revision: 64729 Log: Issue 3188: accept float('infinity') as well as float('inf'). This makes the float constructor behave in the same way as specified by various other language standards, including C99, IEEE 754r, and the IBM Decimal standard. Modified: python/trunk/Lib/test/test_float.py python/trunk/Objects/floatobject.c Modified: python/trunk/Lib/test/test_float.py ============================================================================== --- python/trunk/Lib/test/test_float.py (original) +++ python/trunk/Lib/test/test_float.py Sat Jul 5 13:33:52 2008 @@ -253,24 +253,36 @@ floats_file.close() # Beginning with Python 2.6 float has cross platform compatible -# ways to create and representate inf and nan +# ways to create and represent inf and nan class InfNanTest(unittest.TestCase): def test_inf_from_str(self): self.assert_(isinf(float("inf"))) self.assert_(isinf(float("+inf"))) self.assert_(isinf(float("-inf"))) + self.assert_(isinf(float("infinity"))) + self.assert_(isinf(float("+infinity"))) + self.assert_(isinf(float("-infinity"))) self.assertEqual(repr(float("inf")), "inf") self.assertEqual(repr(float("+inf")), "inf") self.assertEqual(repr(float("-inf")), "-inf") + self.assertEqual(repr(float("infinity")), "inf") + self.assertEqual(repr(float("+infinity")), "inf") + self.assertEqual(repr(float("-infinity")), "-inf") self.assertEqual(repr(float("INF")), "inf") self.assertEqual(repr(float("+Inf")), "inf") self.assertEqual(repr(float("-iNF")), "-inf") + self.assertEqual(repr(float("Infinity")), "inf") + self.assertEqual(repr(float("+iNfInItY")), "inf") + self.assertEqual(repr(float("-INFINITY")), "-inf") self.assertEqual(str(float("inf")), "inf") self.assertEqual(str(float("+inf")), "inf") self.assertEqual(str(float("-inf")), "-inf") + self.assertEqual(str(float("infinity")), "inf") + self.assertEqual(str(float("+infinity")), "inf") + self.assertEqual(str(float("-infinity")), "-inf") self.assertRaises(ValueError, float, "info") self.assertRaises(ValueError, float, "+info") @@ -278,6 +290,10 @@ self.assertRaises(ValueError, float, "in") self.assertRaises(ValueError, float, "+in") self.assertRaises(ValueError, float, "-in") + self.assertRaises(ValueError, float, "infinit") + self.assertRaises(ValueError, float, "+Infin") + self.assertRaises(ValueError, float, "-INFI") + self.assertRaises(ValueError, float, "infinitys") def test_inf_as_str(self): self.assertEqual(repr(1e300 * 1e300), "inf") Modified: python/trunk/Objects/floatobject.c ============================================================================== --- python/trunk/Objects/floatobject.c (original) +++ python/trunk/Objects/floatobject.c Sat Jul 5 13:33:52 2008 @@ -246,6 +246,9 @@ if (PyOS_strnicmp(p, "inf", 4) == 0) { Py_RETURN_INF(sign); } + if (PyOS_strnicmp(p, "infinity", 9) == 0) { + Py_RETURN_INF(sign); + } #ifdef Py_NAN if(PyOS_strnicmp(p, "nan", 4) == 0) { Py_RETURN_NAN; From buildbot at python.org Sat Jul 5 14:09:26 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 12:09:26 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080705120927.3E85D1E4003@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3653 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 523, in __bootstrap_inner self.run() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/threading.py", line 478, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/test/test_smtplib.py", line 108, in debugging_server poll_fun(0.01, asyncore.socket_map) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 183, in poll2 readwrite(obj, flags) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 107, in readwrite obj.handle_error() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 103, in readwrite obj.handle_expt_event() File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/asyncore.py", line 448, in handle_expt_event raise socket.error(err, msg) error: [Errno 54] Connection reset by peer 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jul 5 14:20:26 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 12:20:26 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080705122027.08AA31E4003@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/240 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_xmlrpc_net make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jul 5 14:53:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 12:53:07 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080705125307.DFF191E4003@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/416 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Jul 5 16:34:35 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 16:34:35 +0200 (CEST) Subject: [Python-checkins] r64730 - doctools/branches/0.4.x/sphinx/static/searchtools.js Message-ID: <20080705143435.C6FD01E4003@bag.python.org> Author: georg.brandl Date: Sat Jul 5 16:34:35 2008 New Revision: 64730 Log: Fix another IE problem. Modified: doctools/branches/0.4.x/sphinx/static/searchtools.js Modified: doctools/branches/0.4.x/sphinx/static/searchtools.js ============================================================================== --- doctools/branches/0.4.x/sphinx/static/searchtools.js (original) +++ doctools/branches/0.4.x/sphinx/static/searchtools.js Sat Jul 5 16:34:35 2008 @@ -393,7 +393,7 @@ } displayNextItem(); }); - }, + } } From python-checkins at python.org Sat Jul 5 16:46:51 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 16:46:51 +0200 (CEST) Subject: [Python-checkins] r64731 - doctools/trunk/EXAMPLES Message-ID: <20080705144651.2C74B1E4003@bag.python.org> Author: georg.brandl Date: Sat Jul 5 16:46:50 2008 New Revision: 64731 Log: Add mpmath. Modified: doctools/trunk/EXAMPLES Modified: doctools/trunk/EXAMPLES ============================================================================== --- doctools/trunk/EXAMPLES (original) +++ doctools/trunk/EXAMPLES Sat Jul 5 16:46:50 2008 @@ -18,6 +18,7 @@ * Calibre: http://calibre.kovidgoyal.net/user_manual/ * PyUblas: http://tiker.net/doc/pyublas/ * Py on Windows: http://timgolden.me.uk/python-on-windows/ +* mpmath: http://mpmath.googlecode.com/svn/trunk/doc/build/index.html * Zope 3: e.g. http://docs.carduner.net/z3c-tutorial/ * Grok (upcoming) * Django (upcoming) From python-checkins at python.org Sat Jul 5 16:48:10 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 16:48:10 +0200 (CEST) Subject: [Python-checkins] r64732 - in doctools/trunk: doc/concepts.rst sphinx/directives/desc.py sphinx/static/searchtools.js sphinx/texinputs/howto.cls sphinx/texinputs/manual.cls Message-ID: <20080705144810.9F82C1E4003@bag.python.org> Author: georg.brandl Date: Sat Jul 5 16:48:10 2008 New Revision: 64732 Log: Merged revisions 64725-64726,64730 via svnmerge from svn+ssh://pythondev at svn.python.org/doctools/branches/0.4.x ........ r64725 | georg.brandl | 2008-07-05 12:31:43 +0200 (Sat, 05 Jul 2008) | 2 lines Add note about :maxdepth: in toctrees and latex. ........ r64726 | georg.brandl | 2008-07-05 12:55:07 +0200 (Sat, 05 Jul 2008) | 2 lines Add object names for e.g. :ivar:. ........ r64730 | georg.brandl | 2008-07-05 16:34:35 +0200 (Sat, 05 Jul 2008) | 2 lines Fix another IE problem. ........ Modified: doctools/trunk/ (props changed) doctools/trunk/doc/concepts.rst doctools/trunk/sphinx/directives/desc.py doctools/trunk/sphinx/static/searchtools.js doctools/trunk/sphinx/texinputs/howto.cls doctools/trunk/sphinx/texinputs/manual.cls Modified: doctools/trunk/doc/concepts.rst ============================================================================== --- doctools/trunk/doc/concepts.rst (original) +++ doctools/trunk/doc/concepts.rst Sat Jul 5 16:48:10 2008 @@ -33,7 +33,7 @@ individual TOCs (including "sub-TOC trees") of the documents given in the directive body (whose path is relative to the document the directive occurs in). A numeric ``maxdepth`` option may be given to indicate the depth of the - tree; by default, all levels are included. + tree; by default, all levels are included. [#]_ Consider this example (taken from the Python docs' library reference index):: @@ -132,6 +132,12 @@ .. rubric:: Footnotes +.. [#] The ``maxdepth`` option does not apply to the LaTeX writer, where the + whole table of contents will always be presented at the begin of the + document, and its depth is controlled by the ``tocdepth`` counter, which + you can reset in your :confval:`latex_preamble` config value using + e.g. ``\setcounter{tocdepth}{2}``. + .. [#] A note on available globbing syntax: you can use the standard shell constructs ``*``, ``?``, ``[...]`` and ``[!...]`` with the feature that these all don't match slashes. A double star ``**`` can be used to match Modified: doctools/trunk/sphinx/directives/desc.py ============================================================================== --- doctools/trunk/sphinx/directives/desc.py (original) +++ doctools/trunk/sphinx/directives/desc.py Sat Jul 5 16:48:10 2008 @@ -151,8 +151,9 @@ elif typ == 'type': param_types[obj] = fbody.astext() else: + fieldname = typ + ' ' + obj nfield = nodes.field() - nfield += nodes.field_name(typ, typ) + nfield += nodes.field_name(fieldname, fieldname) nfield += nodes.field_body() nfield[1] += fbody.children new_list += nfield Modified: doctools/trunk/sphinx/static/searchtools.js ============================================================================== --- doctools/trunk/sphinx/static/searchtools.js (original) +++ doctools/trunk/sphinx/static/searchtools.js Sat Jul 5 16:48:10 2008 @@ -393,7 +393,7 @@ } displayNextItem(); }); - }, + } } Modified: doctools/trunk/sphinx/texinputs/howto.cls ============================================================================== --- doctools/trunk/sphinx/texinputs/howto.cls (original) +++ doctools/trunk/sphinx/texinputs/howto.cls Sat Jul 5 16:48:10 2008 @@ -14,7 +14,7 @@ % Set some sane defaults for section numbering depth and TOC depth. You can -% reset these counter in your preamble. +% reset these counters in your preamble. % \setcounter{secnumdepth}{2} Modified: doctools/trunk/sphinx/texinputs/manual.cls ============================================================================== --- doctools/trunk/sphinx/texinputs/manual.cls (original) +++ doctools/trunk/sphinx/texinputs/manual.cls Sat Jul 5 16:48:10 2008 @@ -14,7 +14,7 @@ % Set some sane defaults for section numbering depth and TOC depth. You can -% reset these counter in your preamble. +% reset these counters in your preamble. % \setcounter{secnumdepth}{2} \setcounter{tocdepth}{1} From python-checkins at python.org Sat Jul 5 17:04:12 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 17:04:12 +0200 (CEST) Subject: [Python-checkins] r64733 - doctools/branches/0.4.x/sphinx/quickstart.py Message-ID: <20080705150412.86C5C1E4003@bag.python.org> Author: georg.brandl Date: Sat Jul 5 17:04:12 2008 New Revision: 64733 Log: Ask for common extensions in quickstart. Modified: doctools/branches/0.4.x/sphinx/quickstart.py Modified: doctools/branches/0.4.x/sphinx/quickstart.py ============================================================================== --- doctools/branches/0.4.x/sphinx/quickstart.py (original) +++ doctools/branches/0.4.x/sphinx/quickstart.py Sat Jul 5 17:04:12 2008 @@ -42,7 +42,7 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -#extensions = [] +extensions = [%(extensions)s] # Add any paths that contain templates here, relative to this directory. templates_path = ['%(dot)stemplates'] @@ -392,6 +392,12 @@ do_prompt(d, 'master', 'Name of your master document (without suffix)', 'index') print ''' +Please indicate if you want to use one of the following Sphinx extensions:''' + do_prompt(d, 'ext_autodoc', 'autodoc: automatically insert docstrings ' + 'from modules (y/n)', 'n', boolean) + do_prompt(d, 'ext_doctest', 'doctest: automatically test code snippets ' + 'in doctest blocks (y/n)', 'n', boolean) + print ''' If you are under Unix, a Makefile can be generated for you so that you only have to run e.g. `make html' instead of invoking sphinx-build directly.''' @@ -402,6 +408,9 @@ d['year'] = time.strftime('%Y') d['now'] = time.asctime() d['underline'] = len(d['project']) * '=' + d['extensions'] = ', '.join( + repr('sphinx.ext.' + name) for name in ('autodoc', 'doctest') + if d['ext_' + name].upper() in ('Y', 'YES')) if not path.isdir(d['path']): mkdir_p(d['path']) From python-checkins at python.org Sat Jul 5 17:04:21 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 17:04:21 +0200 (CEST) Subject: [Python-checkins] r64734 - in doctools/branches/0.4.x: CHANGES sphinx/__init__.py Message-ID: <20080705150421.235781E4003@bag.python.org> Author: georg.brandl Date: Sat Jul 5 17:04:20 2008 New Revision: 64734 Log: Release preparations. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/__init__.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Sat Jul 5 17:04:20 2008 @@ -1,5 +1,5 @@ -Release 0.4.1 (in development) -============================== +Release 0.4.1 (Jul 5, 2008) +=========================== * Added sub-/superscript node handling to TextBuilder. Modified: doctools/branches/0.4.x/sphinx/__init__.py ============================================================================== --- doctools/branches/0.4.x/sphinx/__init__.py (original) +++ doctools/branches/0.4.x/sphinx/__init__.py Sat Jul 5 17:04:20 2008 @@ -20,7 +20,7 @@ from sphinx.util.console import darkred, nocolor __revision__ = '$Revision$' -__version__ = '0.4' +__version__ = '0.4.1' def usage(argv, msg=None): From python-checkins at python.org Sat Jul 5 17:25:49 2008 From: python-checkins at python.org (mark.dickinson) Date: Sat, 5 Jul 2008 17:25:49 +0200 (CEST) Subject: [Python-checkins] r64735 - python/trunk/Modules/cmathmodule.c Message-ID: <20080705152549.020281E4003@bag.python.org> Author: mark.dickinson Date: Sat Jul 5 17:25:48 2008 New Revision: 64735 Log: Minor rewrite of cmath_log to work around a Sun compiler bug. See issue #3168. Modified: python/trunk/Modules/cmathmodule.c Modified: python/trunk/Modules/cmathmodule.c ============================================================================== --- python/trunk/Modules/cmathmodule.c (original) +++ python/trunk/Modules/cmathmodule.c Sat Jul 5 17:25:48 2008 @@ -839,8 +839,10 @@ errno = 0; PyFPE_START_PROTECT("complex function", return 0) x = c_log(x); - if (PyTuple_GET_SIZE(args) == 2) - x = c_quot(x, c_log(y)); + if (PyTuple_GET_SIZE(args) == 2) { + y = c_log(y); + x = c_quot(x, y); + } PyFPE_END_PROTECT(x) if (errno != 0) return math_error(); From python-checkins at python.org Sat Jul 5 17:45:46 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 5 Jul 2008 17:45:46 +0200 (CEST) Subject: [Python-checkins] r64736 - in python/trunk/Lib/lib2to3: fixes/fix_imports.py tests/test_fixers.py Message-ID: <20080705154546.061551E4003@bag.python.org> Author: martin.v.loewis Date: Sat Jul 5 17:45:45 2008 New Revision: 64736 Log: Merged revisions 64285-64735 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r64493 | benjamin.peterson | 2008-06-24 04:14:14 +0200 (Di, 24 Jun 2008) | 1 line add a fix_import mapping for cPickle -> pickle ........ r64651 | brett.cannon | 2008-07-02 04:00:11 +0200 (Mi, 02 Jul 2008) | 3 lines Update fix_imports for urllib. Had to change the fixer itself to handle modules that are split across several renames in 3.0. ........ r64669 | brett.cannon | 2008-07-02 21:43:48 +0200 (Mi, 02 Jul 2008) | 4 lines Backing out last change until fix_imports is working again. Also re-enable the testing for fix_imports; if it is deemed that it takes too long to run then a random sample should be taken and used to test it. ........ Modified: python/trunk/Lib/lib2to3/ (props changed) python/trunk/Lib/lib2to3/fixes/fix_imports.py python/trunk/Lib/lib2to3/tests/test_fixers.py Modified: python/trunk/Lib/lib2to3/fixes/fix_imports.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_imports.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_imports.py Sat Jul 5 17:45:45 2008 @@ -19,6 +19,11 @@ # XXX: overhead to the fixer. MAPPING = {"StringIO": ("io", ["StringIO"]), "cStringIO": ("io", ["StringIO"]), + "cPickle": ("pickle", ['BadPickleGet', 'HIGHEST_PROTOCOL', + 'PickleError', 'Pickler', 'PicklingError', + 'UnpickleableError', 'Unpickler', 'UnpicklingError', + 'compatible_formats', 'dump', 'dumps', 'format_version', + 'load', 'loads']), "__builtin__" : ("builtins", builtin_names), 'copy_reg': ('copyreg', ['pickle', 'constructor', Modified: python/trunk/Lib/lib2to3/tests/test_fixers.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/test_fixers.py (original) +++ python/trunk/Lib/lib2to3/tests/test_fixers.py Sat Jul 5 17:45:45 2008 @@ -1405,10 +1405,7 @@ s = "foo(xreadlines)" self.unchanged(s) -# Disable test, as it takes a too long time to run, and also -# fails in 2.6. -#class Test_imports(FixerTestCase): -class Test_imports: +class Test_imports(FixerTestCase): fixer = "imports" from ..fixes.fix_imports import MAPPING as modules From python-checkins at python.org Sat Jul 5 17:48:20 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 5 Jul 2008 17:48:20 +0200 (CEST) Subject: [Python-checkins] r64737 - python/trunk/Lib/test/test_lib2to3.py Message-ID: <20080705154820.5EB991E4003@bag.python.org> Author: martin.v.loewis Date: Sat Jul 5 17:48:20 2008 New Revision: 64737 Log: Disable lib2to3 by default, unless run explicitly. Modified: python/trunk/Lib/test/test_lib2to3.py Modified: python/trunk/Lib/test/test_lib2to3.py ============================================================================== --- python/trunk/Lib/test/test_lib2to3.py (original) +++ python/trunk/Lib/test/test_lib2to3.py Sat Jul 5 17:48:20 2008 @@ -2,7 +2,11 @@ # because of running from lib2to3.tests import test_fixers, test_pytree, test_util import unittest -from test.test_support import run_unittest +from test.test_support import run_unittest, requires + +# Don't run lib2to3 tests by default since they take too long +if __name__ != '__main__': + requires('lib2to3') def suite(): tests = unittest.TestSuite() From python-checkins at python.org Sat Jul 5 18:16:48 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 18:16:48 +0200 (CEST) Subject: [Python-checkins] r64739 - doctools/tags/0.4.1 Message-ID: <20080705161648.947CC1E4004@bag.python.org> Author: georg.brandl Date: Sat Jul 5 18:16:48 2008 New Revision: 64739 Log: Tag 0.4.1. Added: doctools/tags/0.4.1/ - copied from r64738, /doctools/branches/0.4.x/ From python-checkins at python.org Sat Jul 5 18:17:36 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 18:17:36 +0200 (CEST) Subject: [Python-checkins] r64740 - doctools/trunk Message-ID: <20080705161736.E8A361E4004@bag.python.org> Author: georg.brandl Date: Sat Jul 5 18:17:36 2008 New Revision: 64740 Log: Blocked revisions 64734 via svnmerge ........ r64734 | georg.brandl | 2008-07-05 17:04:20 +0200 (Sat, 05 Jul 2008) | 2 lines Release preparations. ........ Modified: doctools/trunk/ (props changed) From python-checkins at python.org Sat Jul 5 18:20:57 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 18:20:57 +0200 (CEST) Subject: [Python-checkins] r64741 - doctools/trunk/CHANGES Message-ID: <20080705162057.D1DBD1E4005@bag.python.org> Author: georg.brandl Date: Sat Jul 5 18:20:57 2008 New Revision: 64741 Log: Merge in 0.4.1 changelog. Modified: doctools/trunk/CHANGES Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Sat Jul 5 18:20:57 2008 @@ -13,6 +13,38 @@ dumps the generated HTML into JSON files for further processing. +Release 0.4.1 (Jul 5, 2008) +=========================== + +* Added sub-/superscript node handling to TextBuilder. + +* Label names in references are now case-insensitive, since reST + label names are always lowercased. + +* Fix linkcheck builder crash for malformed URLs. + +* Add compatibility for admonitions and docutils 0.5. + +* Remove the silly restriction on "rubric" in the LaTeX writer: you + can now write arbitrary "rubric" directives, and only those with + a title of "Footnotes" will be ignored. + +* Copy the HTML logo to the output ``_static`` directory. + +* Fix LaTeX code for modules with underscores in names and platforms. + +* Fix a crash with nonlocal image URIs. + +* Allow the usage of :noindex: in ``automodule`` directives, as + documented. + +* Fix the ``delete()`` docstring processor function in autodoc. + +* Fix warning message for nonexisting images. + +* Fix JavaScript search in Internet Explorer. + + Release 0.4 (Jun 23, 2008) ========================== From python-checkins at python.org Sat Jul 5 18:29:38 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 5 Jul 2008 18:29:38 +0200 (CEST) Subject: [Python-checkins] r64742 - python/trunk/Lib/test/regrtest.py Message-ID: <20080705162938.B02261E4004@bag.python.org> Author: benjamin.peterson Date: Sat Jul 5 18:29:38 2008 New Revision: 64742 Log: make regrtest aware of the lib2to3 resource Modified: python/trunk/Lib/test/regrtest.py Modified: python/trunk/Lib/test/regrtest.py ============================================================================== --- python/trunk/Lib/test/regrtest.py (original) +++ python/trunk/Lib/test/regrtest.py Sat Jul 5 18:29:38 2008 @@ -91,6 +91,8 @@ curses - Tests that use curses and will modify the terminal's state and output modes. + lib2to3 - Run the tests for 2to3 (They take a while.) + largefile - It is okay to run some test that may create huge files. These tests can take a long time and may consume >2GB of disk space temporarily. @@ -165,7 +167,7 @@ from test import test_support -RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb', +RESOURCE_NAMES = ('audio', 'curses', 'lib2to3', 'largefile', 'network', 'bsddb', 'decimal', 'compiler', 'subprocess', 'urlfetch') From python-checkins at python.org Sat Jul 5 18:34:55 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 18:34:55 +0200 (CEST) Subject: [Python-checkins] r64743 - doctools/branches/0.4.x/doc/_templates/index.html Message-ID: <20080705163455.856891E4004@bag.python.org> Author: georg.brandl Date: Sat Jul 5 18:34:55 2008 New Revision: 64743 Log: Add a direct link to the examples page. Modified: doctools/branches/0.4.x/doc/_templates/index.html Modified: doctools/branches/0.4.x/doc/_templates/index.html ============================================================================== --- doctools/branches/0.4.x/doc/_templates/index.html (original) +++ doctools/branches/0.4.x/doc/_templates/index.html Sat Jul 5 18:34:55 2008 @@ -44,6 +44,9 @@ You can also download a PDF version of the Sphinx documentation, generated from the LaTeX Sphinx produces.

+

Links to more documentation generated with Sphinx can be found on the + Projects using Sphinx page. +

Documentation

From python-checkins at python.org Sat Jul 5 18:43:45 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 5 Jul 2008 18:43:45 +0200 (CEST) Subject: [Python-checkins] r64744 - python/trunk/Lib/test/regrtest.py Message-ID: <20080705164345.9BC281E4004@bag.python.org> Author: georg.brandl Date: Sat Jul 5 18:43:45 2008 New Revision: 64744 Log: Keep below 80 chars. Modified: python/trunk/Lib/test/regrtest.py Modified: python/trunk/Lib/test/regrtest.py ============================================================================== --- python/trunk/Lib/test/regrtest.py (original) +++ python/trunk/Lib/test/regrtest.py Sat Jul 5 18:43:45 2008 @@ -167,8 +167,8 @@ from test import test_support -RESOURCE_NAMES = ('audio', 'curses', 'lib2to3', 'largefile', 'network', 'bsddb', - 'decimal', 'compiler', 'subprocess', 'urlfetch') +RESOURCE_NAMES = ('audio', 'curses', 'lib2to3', 'largefile', 'network', + 'bsddb', 'decimal', 'compiler', 'subprocess', 'urlfetch') def usage(code, msg=''): From buildbot at python.org Sat Jul 5 18:55:19 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 16:55:19 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20080705165519.BDE211E4004@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%20trunk/builds/158 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_lib2to3 ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 1427, in test_import_from self.check(b, a) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 1416, in test_import_module self.check(b, a) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From brett at python.org Sat Jul 5 18:58:06 2008 From: brett at python.org (Brett Cannon) Date: Sat, 5 Jul 2008 09:58:06 -0700 Subject: [Python-checkins] r64651 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py In-Reply-To: <43aa6ff70807041822w51c1a93fu3867b1c7a87a9f5e@mail.gmail.com> References: <20080702020011.EE4671E4015@bag.python.org> <43aa6ff70807041822w51c1a93fu3867b1c7a87a9f5e@mail.gmail.com> Message-ID: On Fri, Jul 4, 2008 at 6:22 PM, Collin Winter wrote: > On Tue, Jul 1, 2008 at 7:00 PM, brett.cannon wrote: >> Author: brett.cannon >> Date: Wed Jul 2 04:00:11 2008 >> New Revision: 64651 >> >> Log: >> Update fix_imports for urllib. Had to change the fixer itself to handle modules >> that are split across several renames in 3.0. > > So I realize that you already reverted this, but I thought to comment > anyway: this implementation is almost certainly wrong. Any fixer for > this particular PEP 3108 change will need to possibly insert extra > imports to handle the new urllib.request/error/etc modules. I think > this kind of thing should be broken into its own fixer, or at least > its own distinct functionality inside of fix_imports. > OK. I will see if I can figure out how this works at some point. > Nick Edds is working to speed up fix_imports by stripping out the > member matching stuff, which we don't believe to be actually useful in > the majority of module renamings. IMHO there should be two different > mappings: one for bare-bones module renames (StringIO -> io), and a > separate one for more complex renames, like urllib/urllib2. That will > allow optimizing the former larger pattern while preserving > flexibility for the rare cases in the latter. > Makes sense. -Brett From buildbot at python.org Sat Jul 5 19:06:02 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 17:06:02 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20080705170602.DBF971E4004@bag.python.org> The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20gentoo%20trunk/builds/3875 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_lib2to3 ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 1427, in test_import_from self.check(b, a) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 1416, in test_import_module self.check(b, a) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nedds at uchicago.edu Sat Jul 5 19:16:54 2008 From: nedds at uchicago.edu (Nick Edds) Date: Sat, 5 Jul 2008 12:16:54 -0500 Subject: [Python-checkins] r64651 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py In-Reply-To: References: <20080702020011.EE4671E4015@bag.python.org> <43aa6ff70807041822w51c1a93fu3867b1c7a87a9f5e@mail.gmail.com> Message-ID: <1aff528e0807051016l738ece23k198de8024983a03b@mail.gmail.com> Brett, If you want me to try and make this a fixer, I can give it a shot over the next few days because I'm already fairly comfortable with fixers in 2to3. I think based on the revision that was attempted and what I've read online, I have a pretty good idea of what needs to be done with this fixer. Hopefully I'll have the time to get this done by Monday or Tuesday if you'd like me to do it. Regards, Nick On Sat, Jul 5, 2008 at 11:58 AM, Brett Cannon wrote: > On Fri, Jul 4, 2008 at 6:22 PM, Collin Winter wrote: > > On Tue, Jul 1, 2008 at 7:00 PM, brett.cannon > wrote: > >> Author: brett.cannon > >> Date: Wed Jul 2 04:00:11 2008 > >> New Revision: 64651 > >> > >> Log: > >> Update fix_imports for urllib. Had to change the fixer itself to handle > modules > >> that are split across several renames in 3.0. > > > > So I realize that you already reverted this, but I thought to comment > > anyway: this implementation is almost certainly wrong. Any fixer for > > this particular PEP 3108 change will need to possibly insert extra > > imports to handle the new urllib.request/error/etc modules. I think > > this kind of thing should be broken into its own fixer, or at least > > its own distinct functionality inside of fix_imports. > > > > OK. I will see if I can figure out how this works at some point. > > > Nick Edds is working to speed up fix_imports by stripping out the > > member matching stuff, which we don't believe to be actually useful in > > the majority of module renamings. IMHO there should be two different > > mappings: one for bare-bones module renames (StringIO -> io), and a > > separate one for more complex renames, like urllib/urllib2. That will > > allow optimizing the former larger pattern while preserving > > flexibility for the rare cases in the latter. > > > > Makes sense. > > -Brett > -------------- next part -------------- An HTML attachment was scrubbed... URL: From buildbot at python.org Sat Jul 5 19:28:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 17:28:43 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20080705172843.DCB8D1E4004@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%20trunk/builds/1110 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_lib2to3 ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1427, in test_import_from self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1416, in test_import_module self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jul 5 21:02:01 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 19:02:01 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk Message-ID: <20080705190201.8BB801E4005@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%20trunk/builds/284 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_lib2to3 ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 1427, in test_import_from self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 1416, in test_import_module self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jul 5 21:05:37 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 19:05:37 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20080705190537.B80FA1E4013@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3326 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/cluster/members/member0/tmp/tmpznF7FN/cgi-bin/file2.py", line 2, in import cgi Traceback (most recent call last): Fatal Python error: UNREF invalid object sincerely, -The Buildbot From python-checkins at python.org Sat Jul 5 21:19:50 2008 From: python-checkins at python.org (facundo.batista) Date: Sat, 5 Jul 2008 21:19:50 +0200 (CEST) Subject: [Python-checkins] r64745 - python/trunk/Modules/timemodule.c Message-ID: <20080705191950.864481E4004@bag.python.org> Author: facundo.batista Date: Sat Jul 5 21:19:50 2008 New Revision: 64745 Log: Issue 3289. Removed two lines that ended doing nothing. Modified: python/trunk/Modules/timemodule.c Modified: python/trunk/Modules/timemodule.c ============================================================================== --- python/trunk/Modules/timemodule.c (original) +++ python/trunk/Modules/timemodule.c Sat Jul 5 21:19:50 2008 @@ -600,8 +600,6 @@ { struct tm buf; time_t tt; - tt = time(&tt); - buf = *localtime(&tt); if (!gettmarg(tup, &buf)) return NULL; tt = mktime(&buf); From buildbot at python.org Sat Jul 5 21:28:13 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 19:28:13 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian trunk Message-ID: <20080705192813.678051E4004@bag.python.org> The Buildbot has detected a new failure of S-390 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%20trunk/builds/825 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/threading.py", line 523, in __bootstrap_inner self.run() File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/threading.py", line 478, in run self.__target(*self.__args, **self.__kwargs) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/test/test_thread.py", line 289, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30994, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_lib2to3 ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 1427, in test_import_from self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 1416, in test_import_module self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-s390/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jul 5 21:34:16 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 19:34:16 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 trunk Message-ID: <20080705193416.847171E4004@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%20trunk/builds/3657 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_lib2to3 ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 1427, in test_import_from self.check(b, a) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 1416, in test_import_module self.check(b, a) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/Users/buildslave/bb/trunk.psf-g4/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jul 5 21:56:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 19:56:10 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080705195611.164711E4004@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/729 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sat Jul 5 22:40:00 2008 From: python-checkins at python.org (facundo.batista) Date: Sat, 5 Jul 2008 22:40:00 +0200 (CEST) Subject: [Python-checkins] r64746 - python/trunk/Lib/curses/textpad.py Message-ID: <20080705204000.449151E4004@bag.python.org> Author: facundo.batista Date: Sat Jul 5 22:39:59 2008 New Revision: 64746 Log: Issue #3239. Differentiate the ascii call from the curses one and the builtin one. Modified: python/trunk/Lib/curses/textpad.py Modified: python/trunk/Lib/curses/textpad.py ============================================================================== --- python/trunk/Lib/curses/textpad.py (original) +++ python/trunk/Lib/curses/textpad.py Sat Jul 5 22:39:59 2008 @@ -1,6 +1,7 @@ """Simple textbox editing widget with Emacs-like keybindings.""" -import curses, ascii +import curses +import curses.ascii def rectangle(win, uly, ulx, lry, lrx): """Draw a rectangle with corners at the provided upper-left @@ -54,7 +55,7 @@ returning the index of the last non-blank character.""" last = self.maxx while True: - if ascii.ascii(self.win.inch(y, last)) != ascii.SP: + if curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP: last = min(self.maxx, last+1) break elif last == 0: @@ -76,7 +77,7 @@ pass if self.insert_mode: (backy, backx) = self.win.getyx() - if ascii.isprint(oldch): + if curses.ascii.isprint(oldch): self._insert_printable_char(oldch) self.win.move(backy, backx) @@ -84,12 +85,12 @@ "Process a single editing command." (y, x) = self.win.getyx() self.lastcmd = ch - if ascii.isprint(ch): + if curses.ascii.isprint(ch): if y < self.maxy or x < self.maxx: self._insert_printable_char(ch) - elif ch == ascii.SOH: # ^a + elif ch == curses.ascii.SOH: # ^a self.win.move(y, 0) - elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE): + elif ch in (curses.ascii.STX,curses.KEY_LEFT, curses.ascii.BS,curses.KEY_BACKSPACE): if x > 0: self.win.move(y, x-1) elif y == 0: @@ -98,46 +99,46 @@ self.win.move(y-1, self._end_of_line(y-1)) else: self.win.move(y-1, self.maxx) - if ch in (ascii.BS, curses.KEY_BACKSPACE): + if ch in (curses.ascii.BS, curses.KEY_BACKSPACE): self.win.delch() - elif ch == ascii.EOT: # ^d + elif ch == curses.ascii.EOT: # ^d self.win.delch() - elif ch == ascii.ENQ: # ^e + elif ch == curses.ascii.ENQ: # ^e if self.stripspaces: self.win.move(y, self._end_of_line(y)) else: self.win.move(y, self.maxx) - elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f + elif ch in (curses.ascii.ACK, curses.KEY_RIGHT): # ^f if x < self.maxx: self.win.move(y, x+1) elif y == self.maxy: pass else: self.win.move(y+1, 0) - elif ch == ascii.BEL: # ^g + elif ch == curses.ascii.BEL: # ^g return 0 - elif ch == ascii.NL: # ^j + elif ch == curses.ascii.NL: # ^j if self.maxy == 0: return 0 elif y < self.maxy: self.win.move(y+1, 0) - elif ch == ascii.VT: # ^k + elif ch == curses.ascii.VT: # ^k if x == 0 and self._end_of_line(y) == 0: self.win.deleteln() else: # first undo the effect of self._end_of_line self.win.move(y, x) self.win.clrtoeol() - elif ch == ascii.FF: # ^l + elif ch == curses.ascii.FF: # ^l self.win.refresh() - elif ch in (ascii.SO, curses.KEY_DOWN): # ^n + elif ch in (curses.ascii.SO, curses.KEY_DOWN): # ^n if y < self.maxy: self.win.move(y+1, x) if x > self._end_of_line(y+1): self.win.move(y+1, self._end_of_line(y+1)) - elif ch == ascii.SI: # ^o + elif ch == curses.ascii.SI: # ^o self.win.insertln() - elif ch in (ascii.DLE, curses.KEY_UP): # ^p + elif ch in (curses.ascii.DLE, curses.KEY_UP): # ^p if y > 0: self.win.move(y-1, x) if x > self._end_of_line(y-1): @@ -155,7 +156,7 @@ for x in range(self.maxx+1): if self.stripspaces and x > stop: break - result = result + chr(ascii.ascii(self.win.inch(y, x))) + result = result + chr(curses.ascii.ascii(self.win.inch(y, x))) if self.maxy > 0: result = result + "\n" return result From nnorwitz at gmail.com Sat Jul 5 23:29:34 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 5 Jul 2008 17:29:34 -0400 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20080705212934.GA19369@python.psfb.org> More important issues: ---------------------- test_ssl leaked [131, 0, -379] references, sum=-248 Less important issues: ---------------------- test_cmd_line leaked [-50, 50, 0] references, sum=0 test_popen2 leaked [-25, 0, 25] references, sum=0 test_smtplib leaked [113, -111, 83] references, sum=85 test_sys leaked [2, 2, 2] references, sum=6 test_threading leaked [0, 2, -2] references, sum=0 test_threadsignals leaked [0, -8, 0] references, sum=-8 test_urllib2_localnet leaked [425, -419, 428] references, sum=434 From buildbot at python.org Sat Jul 5 23:42:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 21:42:36 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20080705214236.7CA691E4004@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%20trunk/builds/1700 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,facundo.batista,georg.brandl,mark.dickinson,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_lib2to3 ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 1427, in test_import_from self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 1416, in test_import_module self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Sun Jul 6 00:05:32 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 5 Jul 2008 18:05:32 -0400 Subject: [Python-checkins] Python Regression Test Failures all (1) Message-ID: <20080705220532.GA14364@python.psfb.org> 330 tests OK. 1 test failed: test_lib2to3 25 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_multiprocessing test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ test__locale test_abc test_abstract_numbers test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat test_asyncore test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 Sleepycat Software: Berkeley DB 4.1.25: (December 19, 2002) Test path prefix: /tmp/z-test_bsddb3-19378 test_buffer test_bufio test_bytes test_bz2 test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd test_cmd_line test_cmd_line_script test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler testCompileLibrary still working, be patient... testCompileLibrary still working, be patient... test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_cprofile test_crypt test_csv test_ctypes test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils test_dl test_docxmlrpc test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_epoll test_epoll skipped -- kernel doesn't support epoll() test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_fractions test_frozen test_ftplib test_funcattrs test_functools test_future test_future3 test_future4 test_future_builtins test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_httpservers [12417 refs] [12417 refs] [20808 refs] test_imageop test_imageop skipped -- No module named imgfile test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_int test_int_literal test_io test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_json test_kqueue test_kqueue skipped -- test works only on BSD test_largefile test_lib2to3 No handlers could be found for logger "RefactoringTool" test test_lib2to3 failed -- errors occurred; run in verbose mode for details test_list test_locale test_logging test_long test_long_future test_longexp test_macos test_macos skipped -- No module named MacOS test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_memoryio test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_multiprocessing test_multiprocessing skipped -- OSError raises on RLock creation, see issue 3111! test_mutants test_mutex test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_parser Expecting 's_push: parser stack overflow' in next line s_push: parser stack overflow test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pipes test_pkg test_pkgimport test_pkgutil test_platform test_plistlib test_poll test_popen [12422 refs] [12422 refs] [12422 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_print test_profile test_profilehooks test_property test_pstats test_pty test_pwd test_py3kwarn test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag test_pyclbr test_pydoc [17300 refs] test_pyexpat test_queue test_quopri [14936 refs] [14936 refs] test_random test_re test_repr test_resource test_rfc822 test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site [12417 refs] [12417 refs] [12420 refs] [12417 refs] test_slice test_smtplib test_socket test_socketserver test_softspace test_sort test_sqlite test_ssl test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [12417 refs] [12417 refs] [12417 refs] [12417 refs] [12417 refs] [12417 refs] [12417 refs] [12417 refs] [12417 refs] [12417 refs] [12417 refs] [12417 refs] [14321 refs] [12635 refs] [12417 refs] [12417 refs] [12417 refs] [12417 refs] [12417 refs] [12417 refs] . [12417 refs] [12417 refs] this bit of output is from a test of stdout in a different process ... [12417 refs] [12417 refs] [12635 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [12417 refs] [12417 refs] [12646 refs] [12440 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12420 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [15647 refs] [15503 refs] test_threading_local test_threadsignals test_time test_timeout test_tokenize test_trace test_traceback test_transformer test_tuple test_typechecks test_ucn test_unary test_undocumented_details test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllibnet test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 330 tests OK. 1 test failed: test_lib2to3 25 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_multiprocessing test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl [669413 refs] From buildbot at python.org Sun Jul 6 00:10:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 22:10:46 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080705221046.39FD91E400C@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1190 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jul 6 00:20:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 22:20:47 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080705222047.C6C311E4004@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/343 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jul 6 00:57:08 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 22:57:08 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080705225708.220B41E4004@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/243 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jul 6 01:35:45 2008 From: python-checkins at python.org (armin.ronacher) Date: Sun, 6 Jul 2008 01:35:45 +0200 (CEST) Subject: [Python-checkins] r64750 - doctools/trunk/EXAMPLES Message-ID: <20080705233545.529AD1E4004@bag.python.org> Author: armin.ronacher Date: Sun Jul 6 01:35:45 2008 New Revision: 64750 Log: Added sympy Modified: doctools/trunk/EXAMPLES Modified: doctools/trunk/EXAMPLES ============================================================================== --- doctools/trunk/EXAMPLES (original) +++ doctools/trunk/EXAMPLES Sun Jul 6 01:35:45 2008 @@ -20,8 +20,8 @@ * Py on Windows: http://timgolden.me.uk/python-on-windows/ * mpmath: http://mpmath.googlecode.com/svn/trunk/doc/build/index.html * Zope 3: e.g. http://docs.carduner.net/z3c-tutorial/ +* SymPy: http://docs.sympy.org/ * Grok (upcoming) * Django (upcoming) * Matplotlib (upcoming) * TurboGears (upcoming) - From buildbot at python.org Sun Jul 6 01:56:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 05 Jul 2008 23:56:43 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080705235644.1A2B81E4004@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1089 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jul 6 02:01:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 00:01:51 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080706000151.4C5381E4004@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/740 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: ======= Backtrace: ========= /lib/libc.so.6[0x2b102f216733] /lib/libc.so.6(__libc_free+0x84)[0x2b102f2168b4] ./python(PyObject_Free+0x672)[0x4187af] ./python(_PyObject_DebugFree+0x57)[0x418b4c] ./python[0x438be6] ./python(_Py_Dealloc+0x2f)[0x41713f] ./python(PyUnicodeUCS2_FromFormatV+0x16dd)[0x43aaf6] ./python(PyErr_Format+0xdc)[0x486e3d] ./python[0x42b908] ./python(PyObject_GetAttr+0x8a)[0x4153dd] ./python(PyObject_IsInstance+0x72)[0x4e4a33] ./python[0x506928] ./python(PyObject_Call+0x7a)[0x4e3495] ./python[0x476685] ./python[0x475c30] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ./python[0x475f09] ./python[0x475c17] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ./python[0x475f09] ./python[0x475c17] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ./python[0x475f09] ./python[0x475c17] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ./python[0x475f09] ./python[0x475c17] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ./python[0x475f09] ./python[0x475c17] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ./python(PyEval_EvalCodeEx+0x111c)[0x473ce1] ./python[0x51a131] ./python(PyObject_Call+0x7a)[0x4e3495] ./python[0x476af7] ./python(PyEval_EvalFrameEx+0x87bc)[0x4708e4] ./python[0x475f09] ./python[0x475c17] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ./python[0x475f09] ./python[0x475c17] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ./python(PyEval_EvalCodeEx+0x111c)[0x473ce1] ./python[0x51a131] ./python(PyObject_Call+0x7a)[0x4e3495] ./python[0x50052f] ./python(PyObject_Call+0x7a)[0x4e3495] ./python[0x436949] ./python[0x426844] ./python(PyObject_Call+0x7a)[0x4e3495] ./python[0x476685] ./python[0x475c30] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ./python[0x475f09] ./python[0x475c17] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ./python[0x475f09] ./python[0x475c17] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ./python(PyEval_EvalCodeEx+0x111c)[0x473ce1] ./python[0x47602c] ./python[0x475c17] ./python(PyEval_EvalFrameEx+0x84d3)[0x4705fb] ======= Memory map: ======== 00400000-005af000 r-xp 00000000 08:11 120470 /home/buildbot/slave/py-build/3.0.norwitz-amd64/build/python 006ae000-006eb000 rw-p 001ae000 08:11 120470 /home/buildbot/slave/py-build/3.0.norwitz-amd64/build/python 006eb000-0128b000 rw-p 006eb000 00:00 0 [heap] 40000000-40001000 ---p 40000000 00:00 0 40001000-40201000 rw-p 40001000 00:00 0 40201000-40202000 ---p 40201000 00:00 0 40202000-40402000 rw-p 40202000 00:00 0 40402000-40403000 ---p 40402000 00:00 0 40403000-40603000 rw-p 40403000 00:00 0 40603000-40604000 ---p 40603000 00:00 0 40604000-40804000 rw-p 40604000 00:00 0 40804000-40805000 ---p 40804000 00:00 0 40805000-40a05000 rw-p 40805000 00:00 0 40a05000-40a06000 ---p 40a05000 00:00 0 40a06000-40c06000 rw-p 40a06000 00:00 0 40c06000-40c07000 ---p 40c06000 00:00 0 40c07000-40e07000 rw-p 40c07000 00:00 0 40e07000-40e08000 ---p 40e07000 00:00 0 40e08000-41008000 rw-p 40e08000 00:00 0 41008000-41009000 ---p 41008000 00:00 0 41009000-41209000 rw-p 41009000 00:00 0 41209000-4120a000 ---p 41209000 00:00 0 4120a000-4140a000 rw-p 4120a000 00:00 0 4140a000-4140b000 ---p 4140a000 00:00 0 4140b000-4160b000 rw-p 4140b000 00:00 0 4160b000-4160c000 ---p 4160b000 00:00 0 4160c000-4180c000 rw-p 4160c000 00:00 0 2aaaaaab5000-2aaaaaaf6000 rw-p 2aaaaaab5000 00:00 0 2aaaaaaf7000-2aaaaab38000 rw-p 2aaaaaaf7000 00:00 0 2aaaaab38000-2aaaaab3b000 r-xp 00000000 08:11 2899988 /home/buildbot/slave/py-build/3.0.norwitz-amd64/build/build/lib.linux-x86_64-3.0-pydebug/fcntl.so 2aaaaab3b000-2aaaaac3a000 ---p 00003000 08:11 2899988 /home/buildbot/slave/py-build/3.0.norwitz-amd64/build/build/lib.linux-x86_64-3.0-pydebug/fcntl.so 2aaaaac3a000-2aaaaac3c000 rw-p 00002000 08:11 2899988 /home/buildbot/slave/py-build/3.0.norwitz-amd64/build/build/lib.linux-x86_64-3.0-pydebug/fcntl.so 2aaaaac3d000-2aaaaac3f000 r-xp 00000000 08:11 6570042 /home/buildtest test_multiprocessing failed -- errors occurred; run in verbose mode for details test_importhooks test_math test_runpy test_mimetypes test_strlit test_enumerate test_format test_ioctl test_contains test_io test_threaded_import test_atexit test_thread test_posixpath test_unicode_file test_xdrlib test_pep263 test_cmd_line test_pep3131 test_winsound test_winsound skipped -- No module named winsound test_charmapcodec test_sundry test_uu test_descrtut test_fileinput test_global test_syslog test_codecencodings_kr test_dictviews test_cProfile test_cProfile skipped -- test_cProfile test is current broken test_binascii test_super test_glob test_wait4 test_tarfile test_print test_dbm_ndbm test_csv test_dbm_gnu test_bisect test_dummy_thread test_asyncore test_warnings test_codecencodings_cn test_codecmaps_tw test_optparse test_peepholer test_imp test_cmd_line_script test_htmlparser test_cfgparser test_compile test_hashlib test_ftplib test_file test_module test_ntpath test_codecs test_codeccallbacks test_pickletools test_property test_cgi test_pwd test_sax test_userlist test_deque test_shlex test_augassign test_marshal test_tcl test_pkgimport test_stringprep test_tokenize test_tuple test_richcmp test_mailbox test_asynchat test_int_literal test_poplib test_errno test_decimal test_crypt test_genexps test_fractions test_pyexpat test_plistlib test_colorsys test_threadedtempfile test_contextlib test_int test_userstring test_smtplib test_trace test_setcomps test_float test_compare test_dis test_copy test_robotparser test_nis test_codeop test_hash test_json test_xmlrpc_net test_codecencodings_tw test_cmd test_doctest test_pkg test_docxmlrpc test_codecmaps_kr test_complex test_coding test_ossaudiodev test_ossaudiodev skipped -- [Errno 13] Permission denied: '/dev/dsp' test_dict test_iterlen test_httpservers [31775 refs] [31775 refs] [47100 refs] test_xml_etree test_listcomps test_textwrap test_doctest2 test_bsddb3 test_bz2 test_exception_variations test_grp test_list test_strptime test_codecmaps_hk test_generators test_heapq test_memoryview test_xmlrpc test_collections test_sys [30280 refs] [30537 refs] [30501 refs] test_urlparse test_minidom test_index test_parser Expecting 's_push: parser stack overflow' in next line s_push: parser stack overflow test_set test_fcntl test_weakset test_eof test_abc test_posix test_threading [34287 refs] [36859 refs] test_ctypes test_inspect test_import test_xml_etree_c test_range test_future test_pep247 test_defaultdict test_code test_quopri [35321 refs] [35321 refs] test_socketserver test_future4 test_gc test_netrc test_http_cookies test_capi test_http_cookiejar test_tempfile [30283 refs] test_genericpath test_metaclass test_binhex test_unpack test_dictcomps test_zipfile test_email test_bool test_audioop test__locale test_scope test_shutil test_descr test_operator test_httplib test_epoll test_frozen test_fileio test_builtin test_pep277 test_pep277 skipped -- test works only on NT+ test_codecencodings_jp test_structmembers test_class test_bytes test_time test_imaplib test_weakref test_signal test_traceback test_getopt test_mmap test___future__ test_getargs2 test_pep3120 test_dbm test_zipimport test_struct test_future3 test_unary test_bsddb test_queue test_gettext test_pkgutil test_filecmp test_openpty test_profile test_codecmaps_cn test_pep352 test_pow test_wave test_ast test_modulefinder test_strftime test_codecmaps_jp test_with test_syntax test_datetime test_itertools test_winreg test_winreg skipped -- No module named winreg test_shelve test_base64 test_dbm_dumb test_pyclbr test_call test_logging test_extcall test_types test_gzip test_long_future test_normalization test_zlib test_random test_userdict test_ucn test_poll test_socket test_curses [?1049h(B[?7h[?5h[?5l[?12l[?25habc[?1000h(B(B123123     123  123a                   [?7l [?7h(B(Ba(B (Bc(B---------- (B(B (B(Babc (B(Babc(Babc (B(Babc23(B(Babc(Babc23(B(Bdef(Babc(Babc23(B(Bdef(Bdef(Babc(Babc23(B(Bdef(Bdef(Bdef(Babc(Babc23(B(Bdef(Bdef(Bdef(Bdef(Babc(Babc23(B[?1h= (B (Babc(Babc c(B-----(B  [?7l [?7h(B (B  [?7l [?7h(B(B   (B(Ba a a(B(Ba a a(B(B 1(Bdef(Bdefdefdefabcabc23(B (Ba a a(B(Ba a a(B[?1000l[?1049l [?1l>test_isinstance test_os test_kqueue test_kqueue skipped -- test works only on BSD test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_codecencodings_hk test_bigaddrspace test_startfile test_startfile skipped -- cannot import name startfile test_pep292 test_binop test_long test_pydoc [44373 refs] test_locale test_ssl test_timeout test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_macpath test_memoryio test_symtable test_funcattrs test_re test_cmath test_difflib test_urllib2 test test_urllib2 failed -- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: test_array test_profilehooks test_resource test_unicode test_functools test_sort test_dummy_threading test_SimpleHTTPServer test_unittest test_abstract_numbers test_slice test_unicodedata test_calendar test_fork1 312 tests OK. 2 tests failed: test_multiprocessing test_urllib2 9 tests skipped: test_cProfile test_kqueue test_lib2to3 test_ossaudiodev test_pep277 test_startfile test_winreg test_winsound test_zipfile64 Those skips are all expected on linux2. Re-running failed tests in verbose mode Re-running test 'test_multiprocessing' in verbose mode test_array (test.test_multiprocessing.WithProcessesTestArray) ... ok test_getobj_getlock_obj (test.test_multiprocessing.WithProcessesTestArray) ... ok test_rawarray (test.test_multiprocessing.WithProcessesTestArray) ... ok test_notify (test.test_multiprocessing.WithProcessesTestCondition) ... ok test_notify_all (test.test_multiprocessing.WithProcessesTestCondition) ... ok test_timeout (test.test_multiprocessing.WithProcessesTestCondition) ... ok test_connection (test.test_multiprocessing.WithProcessesTestConnection) ... ok test_duplex_false (test.test_multiprocessing.WithProcessesTestConnection) ... ok test_sendbytes (test.test_multiprocessing.WithProcessesTestConnection) ... ok test_spawn_close (test.test_multiprocessing.WithProcessesTestConnection) ... ok test_event (test.test_multiprocessing.WithProcessesTestEvent) ... ok test_finalize (test.test_multiprocessing.WithProcessesTestFinalize) ... ok test_heap (test.test_multiprocessing.WithProcessesTestHeap) ... ok test_import (test.test_multiprocessing.WithProcessesTestImportStar) ... ok test_listener_client (test.test_multiprocessing.WithProcessesTestListenerClient) ... ok test_lock (test.test_multiprocessing.WithProcessesTestLock) ... ok test_rlock (test.test_multiprocessing.WithProcessesTestLock) ... ok test_enable_logging (test.test_multiprocessing.WithProcessesTestLogging) ... ok test_level (test.test_multiprocessing.WithProcessesTestLogging) ... ok test_apply (test.test_multiprocessing.WithProcessesTestPool) ... ok test_async (test.test_multiprocessing.WithProcessesTestPool) ... ok test_async_timeout (test.test_multiprocessing.WithProcessesTestPool) ... ok test_imap (test.test_multiprocessing.WithProcessesTestPool) ... ok test_imap_unordered (test.test_multiprocessing.WithProcessesTestPool) ... ok test_make_pool (test.test_multiprocessing.WithProcessesTestPool) ... ok test_map (test.test_multiprocessing.WithProcessesTestPool) ... ok test_terminate (test.test_multiprocessing.WithProcessesTestPool) ... ok test_active_children (test.test_multiprocessing.WithProcessesTestProcess) ... ok test_cpu_count (test.test_multiprocessing.WithProcessesTestProcess) ... ok test_current (test.test_multiprocessing.WithProcessesTestProcess) ... ok test_process (test.test_multiprocessing.WithProcessesTestProcess) ... ok test_recursion (test.test_multiprocessing.WithProcessesTestProcess) ... ok test_terminate (test.test_multiprocessing.WithProcessesTestProcess) ... ok test_fork (test.test_multiprocessing.WithProcessesTestQueue) ... ok test_get (test.test_multiprocessing.WithProcessesTestQueue) ... ok test_put (test.test_multiprocessing.WithProcessesTestQueue) ... ok test_qsize (test.test_multiprocessing.WithProcessesTestQueue) ... ok test_task_done (test.test_multiprocessing.WithProcessesTestQueue) ... ok test_bounded_semaphore (test.test_multiprocessing.WithProcessesTestSemaphore) ... ok test_semaphore (test.test_multiprocessing.WithProcessesTestSemaphore) ... ok test_timeout (test.test_multiprocessing.WithProcessesTestSemaphore) ... ok test_copy (test.test_multiprocessing.WithProcessesTestSharedCTypes) ... ok test_sharedctypes (test.test_multiprocessing.WithProcessesTestSharedCTypes) ... ok test_synchronize (test.test_multiprocessing.WithProcessesTestSharedCTypes) ... ok test_subclassing (test.test_multiprocessing.WithProcessesTestSubclassingProcess) ... ok test_getobj_getlock (test.test_multiprocessing.WithProcessesTestValue) ... ok test_rawvalue (test.test_multiprocessing.WithProcessesTestValue) ... ok test_value (test.test_multiprocessing.WithProcessesTestValue) ... ok test_array (test.test_multiprocessing.WithThreadsTestArray) ... ok test_getobj_getlock_obj (test.test_multiprocessing.WithThreadsTestArray) ... ok test_rawarray (test.test_multiprocessing.WithThreadsTestArray) ... ok test_notify (test.test_multiprocessing.WithThreadsTestCondition) ... ok test_notify_all (test.test_multiprocessing.WithThreadsTestCondition) ... ok test_timeout (test.test_multiprocessing.WithThreadsTestCondition) ... ok test_connection (test.test_multiprocessing.WithThreadsTestConnection) ... ok test_duplex_false (test.test_multiprocessing.WithThreadsTestConnection) ... ok test_sendbytes (test.test_multiprocessing.WithThreadsTestConnection) ... ok test_spawn_close (test.test_multiprocessing.WithThreadsTestConnection) ... ok test_event (test.test_multiprocessing.WithThreadsTestEvent) ... ok test_listener_client (test.test_multiprocessing.WithThreadsTestListenerClient) ... ok test_lock (test.test_multiprocessing.WithThreadsTestLock) ... ok test_rlock (test.test_multiprocessing.WithThreadsTestLock) ... ok test_apply (test.test_multiprocessing.WithThreadsTestPool) ... ok test_async (test.test_multiprocessing.WithThreadsTestPool) ... ok test_async_timeout (test.test_multiprocessing.WithThreadsTestPool) ... ok test_imap (test.test_multiprocessing.WithThreadsTestPool) ... ok test_imap_unordered (test.test_multiprocessing.WithThreadsTestPool) ... ok test_make_pool (test.test_multiprocessing.WithThreadsTestPool) ... ok test_map (test.test_multiprocessing.WithThreadsTestPool) ... ok test_terminate (test.test_multiprocessing.WithThreadsTestPool) ... ok test_active_children (test.test_multiprocessing.WithThreadsTestProcess) ... ok test_cpu_count (test.test_multiprocessing.WithThreadsTestProcess) ... ok test_current (test.test_multiprocessing.WithThreadsTestProcess) ... ok test_process (test.test_multiprocessing.WithThreadsTestProcess) ... ok test_recursion (test.test_multiprocessing.WithThreadsTestProcess) ... ok test_terminate (test.test_multiprocessing.WithThreadsTestProcess) ... ok test_fork (test.test_multiprocessing.WithThreadsTestQueue) ... ok test_get (test.test_multiprocessing.WithThreadsTestQueue) ... ok test_put (test.test_multiprocessing.WithThreadsTestQueue) ... ok test_qsize (test.test_multiprocessing.WithThreadsTestQueue) ... ok test_task_done (test.test_multiprocessing.WithThreadsTestQueue) ... ok test_bounded_semaphore (test.test_multiprocessing.WithThreadsTestSemaphore) ... ok test_semaphore (test.test_multiprocessing.WithThreadsTestSemaphore) ... ok test_timeout (test.test_multiprocessing.WithThreadsTestSemaphore) ... ok test_getobj_getlock (test.test_multiprocessing.WithThreadsTestValue) ... ok test_rawvalue (test.test_multiprocessing.WithThreadsTestValue) ... ok test_value (test.test_multiprocessing.WithThreadsTestValue) ... ok test_array (test.test_multiprocessing.WithManagerTestArray) ... ok test_getobj_getlock_obj (test.test_multiprocessing.WithManagerTestArray) ... ok test_rawarray (test.test_multiprocessing.WithManagerTestArray) ... ok test_notify (test.test_multiprocessing.WithManagerTestCondition) ... ok test_notify_all (test.test_multiprocessing.WithManagerTestCondition) ... ok test_timeout (test.test_multiprocessing.WithManagerTestCondition) ... ok test_dict (test.test_multiprocessing.WithManagerTestContainers) ... ok test_list (test.test_multiprocessing.WithManagerTestContainers) ... ok test_namespace (test.test_multiprocessing.WithManagerTestContainers) ... ok test_event (test.test_multiprocessing.WithManagerTestEvent) ... ok test_lock (test.test_multiprocessing.WithManagerTestLock) ... ok test_rlock (test.test_multiprocessing.WithManagerTestLock) ... ok test_mymanager (test.test_multiprocessing.WithManagerTestMyManager) ... ok test_apply (test.test_multiprocessing.WithManagerTestPool) ... ok test_async (test.test_multiprocessing.WithManagerTestPool) ... ok test_async_timeout (test.test_multiprocessing.WithManagerTestPool) ... ok test_imap (test.test_multiprocessing.WithManagerTestPool) ... ok test_imap_unordered (test.test_multiprocessing.WithManagerTestPool) ... ok test_make_pool (test.test_multiprocessing.WithManagerTestPool) ... ok test_map (test.test_multiprocessing.WithManagerTestPool) ... ok test_terminate (test.test_multiprocessing.WithManagerTestPool) ... ok test_fork (test.test_multiprocessing.WithManagerTestQueue) ... ok test_get (test.test_multiprocessing.WithManagerTestQueue) ... ok test_put (test.test_multiprocessing.WithManagerTestQueue) ... ok test_qsize (test.test_multiprocessing.WithManagerTestQueue) ... ok test_task_done (test.test_multiprocessing.WithManagerTestQueue) ... ok test_remote (test.test_multiprocessing.WithManagerTestRemoteManager) ... ok test_bounded_semaphore (test.test_multiprocessing.WithManagerTestSemaphore) ... ok test_semaphore (test.test_multiprocessing.WithManagerTestSemaphore) ... ok test_timeout (test.test_multiprocessing.WithManagerTestSemaphore) ... ok test_getobj_getlock (test.test_multiprocessing.WithManagerTestValue) ... ok test_rawvalue (test.test_multiprocessing.WithManagerTestValue) ... ok test_value (test.test_multiprocessing.WithManagerTestValue) ... ok test_number_of_objects (test.test_multiprocessing.WithManagerTestZZZNumberOfObjects) ... ok ---------------------------------------------------------------------- ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jul 6 02:02:14 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 00:02:14 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080706000214.DB89B1E4004@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/147 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jul 6 04:14:31 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 02:14:31 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080706021431.62E611E4004@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/346 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jul 6 04:16:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 02:16:15 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080706021615.9A61B1E4004@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/421 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From brett at python.org Sun Jul 6 04:37:10 2008 From: brett at python.org (Brett Cannon) Date: Sat, 5 Jul 2008 19:37:10 -0700 Subject: [Python-checkins] r64651 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py In-Reply-To: <1aff528e0807051016l738ece23k198de8024983a03b@mail.gmail.com> References: <20080702020011.EE4671E4015@bag.python.org> <43aa6ff70807041822w51c1a93fu3867b1c7a87a9f5e@mail.gmail.com> <1aff528e0807051016l738ece23k198de8024983a03b@mail.gmail.com> Message-ID: On Sat, Jul 5, 2008 at 10:16 AM, Nick Edds wrote: > Brett, > > If you want me to try and make this a fixer, I can give it a shot over the > next few days because I'm already fairly comfortable with fixers in 2to3. I > think based on the revision that was attempted and what I've read online, I > have a pretty good idea of what needs to be done with this fixer. Hopefully > I'll have the time to get this done by Monday or Tuesday if you'd like me to > do it. > Go for it! Basically the fixer needs to deal with the fact that urllib and urllib2 now span multiple modules. So as Collin mentioned, you probably should import all the modules they span across and then update the references in the code appropriately. Trick is going to be situations where the modules are imported as something else, e.g., ``import urllib as spam`` since that won't work when the modules have multiple names. But since I suspect that is a rare case it might just have to be a warning or something. -Brett > Regards, > Nick > > On Sat, Jul 5, 2008 at 11:58 AM, Brett Cannon wrote: >> >> On Fri, Jul 4, 2008 at 6:22 PM, Collin Winter wrote: >> > On Tue, Jul 1, 2008 at 7:00 PM, brett.cannon >> > wrote: >> >> Author: brett.cannon >> >> Date: Wed Jul 2 04:00:11 2008 >> >> New Revision: 64651 >> >> >> >> Log: >> >> Update fix_imports for urllib. Had to change the fixer itself to handle >> >> modules >> >> that are split across several renames in 3.0. >> > >> > So I realize that you already reverted this, but I thought to comment >> > anyway: this implementation is almost certainly wrong. Any fixer for >> > this particular PEP 3108 change will need to possibly insert extra >> > imports to handle the new urllib.request/error/etc modules. I think >> > this kind of thing should be broken into its own fixer, or at least >> > its own distinct functionality inside of fix_imports. >> > >> >> OK. I will see if I can figure out how this works at some point. >> >> > Nick Edds is working to speed up fix_imports by stripping out the >> > member matching stuff, which we don't believe to be actually useful in >> > the majority of module renamings. IMHO there should be two different >> > mappings: one for bare-bones module renames (StringIO -> io), and a >> > separate one for more complex renames, like urllib/urllib2. That will >> > allow optimizing the former larger pattern while preserving >> > flexibility for the rare cases in the latter. >> > >> >> Makes sense. >> >> -Brett > > From collinw at gmail.com Sun Jul 6 05:01:20 2008 From: collinw at gmail.com (Collin Winter) Date: Sat, 5 Jul 2008 20:01:20 -0700 Subject: [Python-checkins] r64651 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py In-Reply-To: References: <20080702020011.EE4671E4015@bag.python.org> <43aa6ff70807041822w51c1a93fu3867b1c7a87a9f5e@mail.gmail.com> <1aff528e0807051016l738ece23k198de8024983a03b@mail.gmail.com> Message-ID: <43aa6ff70807052001w6f5414c4ib4974771a708efe7@mail.gmail.com> On Sat, Jul 5, 2008 at 7:37 PM, Brett Cannon wrote: > On Sat, Jul 5, 2008 at 10:16 AM, Nick Edds wrote: >> Brett, >> >> If you want me to try and make this a fixer, I can give it a shot over the >> next few days because I'm already fairly comfortable with fixers in 2to3. I >> think based on the revision that was attempted and what I've read online, I >> have a pretty good idea of what needs to be done with this fixer. Hopefully >> I'll have the time to get this done by Monday or Tuesday if you'd like me to >> do it. >> > > Go for it! Basically the fixer needs to deal with the fact that urllib > and urllib2 now span multiple modules. So as Collin mentioned, you > probably should import all the modules they span across and then > update the references in the code appropriately. Trick is going to be > situations where the modules are imported as something else, e.g., > ``import urllib as spam`` since that won't work when the modules have > multiple names. But since I suspect that is a rare case it might just > have to be a warning or something. Agreed. I think we can just warn in this case, rather than wasting time catering to rarities like this. >> On Sat, Jul 5, 2008 at 11:58 AM, Brett Cannon wrote: >>> >>> On Fri, Jul 4, 2008 at 6:22 PM, Collin Winter wrote: >>> > On Tue, Jul 1, 2008 at 7:00 PM, brett.cannon >>> > wrote: >>> >> Author: brett.cannon >>> >> Date: Wed Jul 2 04:00:11 2008 >>> >> New Revision: 64651 >>> >> >>> >> Log: >>> >> Update fix_imports for urllib. Had to change the fixer itself to handle >>> >> modules >>> >> that are split across several renames in 3.0. >>> > >>> > So I realize that you already reverted this, but I thought to comment >>> > anyway: this implementation is almost certainly wrong. Any fixer for >>> > this particular PEP 3108 change will need to possibly insert extra >>> > imports to handle the new urllib.request/error/etc modules. I think >>> > this kind of thing should be broken into its own fixer, or at least >>> > its own distinct functionality inside of fix_imports. >>> > >>> >>> OK. I will see if I can figure out how this works at some point. >>> >>> > Nick Edds is working to speed up fix_imports by stripping out the >>> > member matching stuff, which we don't believe to be actually useful in >>> > the majority of module renamings. IMHO there should be two different >>> > mappings: one for bare-bones module renames (StringIO -> io), and a >>> > separate one for more complex renames, like urllib/urllib2. That will >>> > allow optimizing the former larger pattern while preserving >>> > flexibility for the rare cases in the latter. >>> > >>> >>> Makes sense. >>> >>> -Brett >> >> > From python-checkins at python.org Sun Jul 6 05:35:59 2008 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 6 Jul 2008 05:35:59 +0200 (CEST) Subject: [Python-checkins] r64753 - in python/trunk: Doc/c-api/float.rst Doc/c-api/int.rst Doc/library/gc.rst Doc/library/sys.rst Include/floatobject.h Include/intobject.h Misc/NEWS Modules/gcmodule.c Objects/floatobject.c Objects/intobject.c Python/sysmodule.c Message-ID: <20080706033559.226D11E4004@bag.python.org> Author: gregory.p.smith Date: Sun Jul 6 05:35:58 2008 New Revision: 64753 Log: - Issue #2862: Make int and float freelist management consistent with other freelists. Changes their CompactFreeList apis into ClearFreeList apis and calls them via gc.collect(). Modified: python/trunk/Doc/c-api/float.rst python/trunk/Doc/c-api/int.rst python/trunk/Doc/library/gc.rst python/trunk/Doc/library/sys.rst python/trunk/Include/floatobject.h python/trunk/Include/intobject.h python/trunk/Misc/NEWS python/trunk/Modules/gcmodule.c python/trunk/Objects/floatobject.c python/trunk/Objects/intobject.c python/trunk/Python/sysmodule.c Modified: python/trunk/Doc/c-api/float.rst ============================================================================== --- python/trunk/Doc/c-api/float.rst (original) +++ python/trunk/Doc/c-api/float.rst Sun Jul 6 05:35:58 2008 @@ -86,10 +86,9 @@ .. versionadded:: 2.6 -.. cfunction:: void PyFloat_CompactFreeList(size_t *bc, size_t *bf, size_t *sum) +.. cfunction:: int PyFloat_ClearFreeList(void) - Compact the float free list. *bc* is the number of allocated blocks before - blocks are freed, *bf* is the number of freed blocks and *sum* is the number - of remaining objects in the blocks. + Clear the float free list. Return the number of items that could not + be freed. .. versionadded:: 2.6 Modified: python/trunk/Doc/c-api/int.rst ============================================================================== --- python/trunk/Doc/c-api/int.rst (original) +++ python/trunk/Doc/c-api/int.rst Sun Jul 6 05:35:58 2008 @@ -122,10 +122,9 @@ (:const:`LONG_MAX`, as defined in the system header files). -.. cfunction:: void PyInt_CompactFreeList(size_t *bc, size_t *bf, size_t *sum) +.. cfunction:: int PyInt_ClearFreeList(void) - Compact the integer free list. *bc* is the number of allocated blocks before - blocks are freed, *bf* is the number of freed blocks and *sum* is the number - of remaining objects in the blocks. + Clear the integer free list. Return the number of items that could not + be freed. .. versionadded:: 2.6 Modified: python/trunk/Doc/library/gc.rst ============================================================================== --- python/trunk/Doc/library/gc.rst (original) +++ python/trunk/Doc/library/gc.rst Sun Jul 6 05:35:58 2008 @@ -47,6 +47,12 @@ .. versionchanged:: 2.5 The optional *generation* argument was added. + .. versionchanged:: 2.6 + The free lists maintained for a number of builtin types are cleared + whenever a full collection or collection of the highest generation (2) + is run. Not all items in some free lists may be freed due to the + particular implementation, in particular :class:`int` and :class:`float`. + .. function:: set_debug(flags) Modified: python/trunk/Doc/library/sys.rst ============================================================================== --- python/trunk/Doc/library/sys.rst (original) +++ python/trunk/Doc/library/sys.rst Sun Jul 6 05:35:58 2008 @@ -58,22 +58,6 @@ A string containing the copyright pertaining to the Python interpreter. -.. function:: _compact_freelists() - - Compact the free lists of integers and floats by deallocating unused blocks. - It can reduce the memory usage of the Python process several tenth of - thousands of integers or floats have been allocated at once. - - The return value is a tuple of tuples each containing three elements, - amount of used objects, total block count before the blocks are deallocated - and amount of freed blocks. The first tuple refers to ints, the second to - floats. - - This function should be used for specialized purposes only. - - .. versionadded:: 2.6 - - .. function:: _clear_type_cache() Clear the internal type cache. The type cache is used to speed up attribute Modified: python/trunk/Include/floatobject.h ============================================================================== --- python/trunk/Include/floatobject.h (original) +++ python/trunk/Include/floatobject.h Sun Jul 6 05:35:58 2008 @@ -113,7 +113,7 @@ PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le); /* free list api */ -PyAPI_FUNC(void) PyFloat_CompactFreeList(size_t *, size_t *, size_t *); +PyAPI_FUNC(int) PyFloat_ClearFreeList(void); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ Modified: python/trunk/Include/intobject.h ============================================================================== --- python/trunk/Include/intobject.h (original) +++ python/trunk/Include/intobject.h Sun Jul 6 05:35:58 2008 @@ -60,7 +60,7 @@ PyAPI_FUNC(long) PyOS_strtol(char *, char **, int); /* free list api */ -PyAPI_FUNC(void) PyInt_CompactFreeList(size_t *, size_t *, size_t *); +PyAPI_FUNC(int) PyInt_ClearFreeList(void); /* Convert an integer to the given base. Returns a string. If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jul 6 05:35:58 2008 @@ -29,6 +29,10 @@ would not cause a syntax error. This was regression from 2.4 caused by the switch to the new compiler. +- Issue #2862: Make int and float freelist management consistent with other + freelists. Changes their CompactFreeList apis into ClearFreeList apis and + calls them via gc.collect(). + Library ------- Modified: python/trunk/Modules/gcmodule.c ============================================================================== --- python/trunk/Modules/gcmodule.c (original) +++ python/trunk/Modules/gcmodule.c Sun Jul 6 05:35:58 2008 @@ -736,6 +736,8 @@ (void)PyCFunction_ClearFreeList(); (void)PyTuple_ClearFreeList(); (void)PyUnicode_ClearFreeList(); + (void)PyInt_ClearFreeList(); + (void)PyFloat_ClearFreeList(); } /* This is the main function. Read this to understand how the Modified: python/trunk/Objects/floatobject.c ============================================================================== --- python/trunk/Objects/floatobject.c (original) +++ python/trunk/Objects/floatobject.c Sun Jul 6 05:35:58 2008 @@ -1608,30 +1608,28 @@ PyStructSequence_InitType(&FloatInfoType, &floatinfo_desc); } -void -PyFloat_CompactFreeList(size_t *pbc, size_t *pbf, size_t *bsum) +int +PyFloat_ClearFreeList(void) { PyFloatObject *p; PyFloatBlock *list, *next; - unsigned i; - size_t bc = 0, bf = 0; /* block count, number of freed blocks */ - size_t fsum = 0; /* total unfreed ints */ - int frem; /* remaining unfreed ints per block */ + int i; + int u; /* remaining unfreed ints per block */ + int freelist_size = 0; list = block_list; block_list = NULL; free_list = NULL; while (list != NULL) { - bc++; - frem = 0; + u = 0; for (i = 0, p = &list->objects[0]; i < N_FLOATOBJECTS; i++, p++) { if (PyFloat_CheckExact(p) && Py_REFCNT(p) != 0) - frem++; + u++; } next = list->next; - if (frem) { + if (u) { list->next = block_list; block_list = list; for (i = 0, p = &list->objects[0]; @@ -1646,15 +1644,12 @@ } } else { - PyMem_FREE(list); /* XXX PyObject_FREE ??? */ - bf++; + PyMem_FREE(list); } - fsum += frem; + freelist_size += u; list = next; } - *pbc = bc; - *pbf = bf; - *bsum = fsum; + return freelist_size; } void @@ -1662,25 +1657,21 @@ { PyFloatObject *p; PyFloatBlock *list; - unsigned i; - size_t bc, bf; /* block count, number of freed blocks */ - size_t fsum; /* total unfreed floats per block */ + int i; + int u; /* total unfreed floats per block */ - PyFloat_CompactFreeList(&bc, &bf, &fsum); + u = PyFloat_ClearFreeList(); if (!Py_VerboseFlag) return; fprintf(stderr, "# cleanup floats"); - if (!fsum) { + if (!u) { fprintf(stderr, "\n"); } else { fprintf(stderr, - ": %" PY_FORMAT_SIZE_T "d unfreed float%s in %" - PY_FORMAT_SIZE_T "d out of %" - PY_FORMAT_SIZE_T "d block%s\n", - fsum, fsum == 1 ? "" : "s", - bc - bf, bc, bc == 1 ? "" : "s"); + ": %d unfreed float%s\n", + u, u == 1 ? "" : "s"); } if (Py_VerboseFlag > 1) { list = block_list; Modified: python/trunk/Objects/intobject.c ============================================================================== --- python/trunk/Objects/intobject.c (original) +++ python/trunk/Objects/intobject.c Sun Jul 6 05:35:58 2008 @@ -1296,35 +1296,33 @@ return 1; } -void -PyInt_CompactFreeList(size_t *pbc, size_t *pbf, size_t *bsum) +int +PyInt_ClearFreeList(void) { PyIntObject *p; PyIntBlock *list, *next; - unsigned int ctr; - size_t bc = 0, bf = 0; /* block count, number of freed blocks */ - size_t isum = 0; /* total unfreed ints */ - int irem; /* remaining unfreed ints per block */ + int i; + int u; /* remaining unfreed ints per block */ + int freelist_size = 0; list = block_list; block_list = NULL; free_list = NULL; while (list != NULL) { - bc++; - irem = 0; - for (ctr = 0, p = &list->objects[0]; - ctr < N_INTOBJECTS; - ctr++, p++) { + u = 0; + for (i = 0, p = &list->objects[0]; + i < N_INTOBJECTS; + i++, p++) { if (PyInt_CheckExact(p) && p->ob_refcnt != 0) - irem++; + u++; } next = list->next; - if (irem) { + if (u) { list->next = block_list; block_list = list; - for (ctr = 0, p = &list->objects[0]; - ctr < N_INTOBJECTS; - ctr++, p++) { + for (i = 0, p = &list->objects[0]; + i < N_INTOBJECTS; + i++, p++) { if (!PyInt_CheckExact(p) || p->ob_refcnt == 0) { Py_TYPE(p) = (struct _typeobject *) @@ -1345,15 +1343,12 @@ } else { PyMem_FREE(list); - bf++; } - isum += irem; + freelist_size += u; list = next; } - *pbc = bc; - *pbf = bf; - *bsum = isum; + return freelist_size; } void @@ -1361,12 +1356,10 @@ { PyIntObject *p; PyIntBlock *list; - unsigned int ctr; - size_t bc, bf; /* block count, number of freed blocks */ - size_t isum; /* total unfreed ints per block */ + int i; + int u; /* total unfreed ints per block */ #if NSMALLNEGINTS + NSMALLPOSINTS > 0 - int i; PyIntObject **q; i = NSMALLNEGINTS + NSMALLPOSINTS; @@ -1376,27 +1369,24 @@ *q++ = NULL; } #endif - PyInt_CompactFreeList(&bc, &bf, &isum); + u = PyInt_ClearFreeList(); if (!Py_VerboseFlag) return; fprintf(stderr, "# cleanup ints"); - if (!isum) { + if (!u) { fprintf(stderr, "\n"); } else { fprintf(stderr, - ": %" PY_FORMAT_SIZE_T "d unfreed int%s in %" - PY_FORMAT_SIZE_T "d out of %" - PY_FORMAT_SIZE_T "d block%s\n", - isum, isum == 1 ? "" : "s", - bc - bf, bc, bc == 1 ? "" : "s"); + ": %d unfreed int%s\n", + u, u == 1 ? "" : "s"); } if (Py_VerboseFlag > 1) { list = block_list; while (list != NULL) { - for (ctr = 0, p = &list->objects[0]; - ctr < N_INTOBJECTS; - ctr++, p++) { + for (i = 0, p = &list->objects[0]; + i < N_INTOBJECTS; + i++, p++) { if (PyInt_CheckExact(p) && p->ob_refcnt != 0) /* XXX(twouters) cast refcount to long until %zd is universally Modified: python/trunk/Python/sysmodule.c ============================================================================== --- python/trunk/Python/sysmodule.c (original) +++ python/trunk/Python/sysmodule.c Sun Jul 6 05:35:58 2008 @@ -829,32 +829,12 @@ Clear the internal type lookup cache."); -static PyObject * -sys_compact_freelists(PyObject* self, PyObject* args) -{ - size_t isum, ibc, ibf; - size_t fsum, fbc, fbf; - - PyInt_CompactFreeList(&ibc, &ibf, &isum); - PyFloat_CompactFreeList(&fbc, &fbf, &fsum); - - return Py_BuildValue("(kkk)(kkk)", isum, ibc, ibf, - fsum, fbc, fbf); - -} - -PyDoc_STRVAR(sys_compact_freelists__doc__, -"_compact_freelists() -> ((remaing_objects, total_blocks, freed_blocks), ...)\n\ -Compact the free lists of ints and floats."); - static PyMethodDef sys_methods[] = { /* Might as well keep this in alphabetic order */ {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS, callstats_doc}, {"_clear_type_cache", sys_clear_type_cache, METH_NOARGS, sys_clear_type_cache__doc__}, - {"_compact_freelists", sys_compact_freelists, METH_NOARGS, - sys_compact_freelists__doc__}, {"_current_frames", sys_current_frames, METH_NOARGS, current_frames_doc}, {"displayhook", sys_displayhook, METH_O, displayhook_doc}, From buildbot at python.org Sun Jul 6 05:44:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 03:44:10 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080706034411.2A5D71E4004@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/731 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sun Jul 6 06:04:08 2008 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 6 Jul 2008 06:04:08 +0200 (CEST) Subject: [Python-checkins] r64754 - in python/branches/release25-maint: Lib/socket.py Lib/test/test_socket.py Misc/NEWS Message-ID: <20080706040408.524D61E4005@bag.python.org> Author: gregory.p.smith Date: Sun Jul 6 06:04:07 2008 New Revision: 64754 Log: Backport r62627 + r62744 from trunk to fix issue 2632. - Issue #2632: Prevent socket.read(bignumber) from over allocating memory in the common case when the data is returned from the underlying socket in increments much smaller than bignumber. Modified: python/branches/release25-maint/Lib/socket.py python/branches/release25-maint/Lib/test/test_socket.py python/branches/release25-maint/Misc/NEWS Modified: python/branches/release25-maint/Lib/socket.py ============================================================================== --- python/branches/release25-maint/Lib/socket.py (original) +++ python/branches/release25-maint/Lib/socket.py Sun Jul 6 06:04:07 2008 @@ -56,6 +56,11 @@ import os, sys try: + from cStringIO import StringIO +except ImportError: + from StringIO import StringIO + +try: from errno import EBADF except ImportError: EBADF = 9 @@ -211,6 +216,9 @@ bufsize = self.default_bufsize self.bufsize = bufsize self.softspace = False + # _rbufsize is the suggested recv buffer size. It is *strictly* + # obeyed within readline() for recv calls. If it is larger than + # default_bufsize it will be used for recv calls within read(). if bufsize == 0: self._rbufsize = 1 elif bufsize == 1: @@ -218,7 +226,11 @@ else: self._rbufsize = bufsize self._wbufsize = bufsize - self._rbuf = "" # A string + # We use StringIO for the read buffer to avoid holding a list + # of variously sized string objects which have been known to + # fragment the heap due to how they are malloc()ed and often + # realloc()ed down much smaller than their original allocation. + self._rbuf = StringIO() self._wbuf = [] # A list of strings self._close = close @@ -276,56 +288,85 @@ return buf_len def read(self, size=-1): - data = self._rbuf + # Use max, disallow tiny reads in a loop as they are very inefficient. + # We never leave read() with any leftover data from a new recv() call + # in our internal buffer. + rbufsize = max(self._rbufsize, self.default_bufsize) + # Our use of StringIO rather than lists of string objects returned by + # recv() minimizes memory usage and fragmentation that occurs when + # rbufsize is large compared to the typical return value of recv(). + buf = self._rbuf + buf.seek(0, 2) # seek end if size < 0: # Read until EOF - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" - if self._rbufsize <= 1: - recv_size = self.default_bufsize - else: - recv_size = self._rbufsize + self._rbuf = StringIO() # reset _rbuf. we consume it via buf. while True: - data = self._sock.recv(recv_size) + data = self._sock.recv(rbufsize) if not data: break - buffers.append(data) - return "".join(buffers) + buf.write(data) + return buf.getvalue() else: # Read until size bytes or EOF seen, whichever comes first - buf_len = len(data) + buf_len = buf.tell() if buf_len >= size: - self._rbuf = data[size:] - return data[:size] - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" + # Already have size bytes in our buffer? Extract and return. + buf.seek(0) + rv = buf.read(size) + self._rbuf = StringIO() + self._rbuf.write(buf.read()) + return rv + + self._rbuf = StringIO() # reset _rbuf. we consume it via buf. while True: left = size - buf_len - recv_size = min(self._rbufsize, left) - data = self._sock.recv(recv_size) + # recv() will malloc the amount of memory given as its + # parameter even though it often returns much less data + # than that. The returned data string is short lived + # as we copy it into a StringIO and free it. This avoids + # fragmentation issues on many platforms. + data = self._sock.recv(left) if not data: break - buffers.append(data) n = len(data) - if n >= left: - self._rbuf = data[left:] - buffers[-1] = data[:left] + if n == size and not buf_len: + # Shortcut. Avoid buffer data copies when: + # - We have no data in our buffer. + # AND + # - Our call to recv returned exactly the + # number of bytes we were asked to read. + return data + if n == left: + buf.write(data) + del data # explicit free break + assert n <= left, "recv(%d) returned %d bytes" % (left, n) + buf.write(data) buf_len += n - return "".join(buffers) + del data # explicit free + #assert buf_len == buf.tell() + return buf.getvalue() def readline(self, size=-1): - data = self._rbuf + buf = self._rbuf + buf.seek(0, 2) # seek end + if buf.tell() > 0: + # check if we already have it in our buffer + buf.seek(0) + bline = buf.readline(size) + if bline.endswith('\n') or len(bline) == size: + self._rbuf = StringIO() + self._rbuf.write(buf.read()) + return bline + del bline if size < 0: # Read until \n or EOF, whichever comes first if self._rbufsize <= 1: # Speed up unbuffered case - assert data == "" - buffers = [] + buf.seek(0) + buffers = [buf.read()] + self._rbuf = StringIO() # reset _rbuf. we consume it via buf. + data = None recv = self._sock.recv while data != "\n": data = recv(1) @@ -333,61 +374,64 @@ break buffers.append(data) return "".join(buffers) - nl = data.find('\n') - if nl >= 0: - nl += 1 - self._rbuf = data[nl:] - return data[:nl] - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" + + buf.seek(0, 2) # seek end + self._rbuf = StringIO() # reset _rbuf. we consume it via buf. while True: data = self._sock.recv(self._rbufsize) if not data: break - buffers.append(data) nl = data.find('\n') if nl >= 0: nl += 1 - self._rbuf = data[nl:] - buffers[-1] = data[:nl] + buf.write(buffer(data, 0, nl)) + self._rbuf.write(buffer(data, nl)) + del data break - return "".join(buffers) + buf.write(data) + return buf.getvalue() else: # Read until size bytes or \n or EOF seen, whichever comes first - nl = data.find('\n', 0, size) - if nl >= 0: - nl += 1 - self._rbuf = data[nl:] - return data[:nl] - buf_len = len(data) + buf.seek(0, 2) # seek end + buf_len = buf.tell() if buf_len >= size: - self._rbuf = data[size:] - return data[:size] - buffers = [] - if data: - buffers.append(data) - self._rbuf = "" + buf.seek(0) + rv = buf.read(size) + self._rbuf = StringIO() + self._rbuf.write(buf.read()) + return rv + self._rbuf = StringIO() # reset _rbuf. we consume it via buf. while True: data = self._sock.recv(self._rbufsize) if not data: break - buffers.append(data) left = size - buf_len + # did we just receive a newline? nl = data.find('\n', 0, left) if nl >= 0: nl += 1 - self._rbuf = data[nl:] - buffers[-1] = data[:nl] - break + # save the excess data to _rbuf + self._rbuf.write(buffer(data, nl)) + if buf_len: + buf.write(buffer(data, 0, nl)) + break + else: + # Shortcut. Avoid data copy through buf when returning + # a substring of our first recv(). + return data[:nl] n = len(data) + if n == size and not buf_len: + # Shortcut. Avoid data copy through buf when + # returning exactly all of our first recv(). + return data if n >= left: - self._rbuf = data[left:] - buffers[-1] = data[:left] + buf.write(buffer(data, 0, left)) + self._rbuf.write(buffer(data, left)) break + buf.write(data) buf_len += n - return "".join(buffers) + #assert buf_len == buf.tell() + return buf.getvalue() def readlines(self, sizehint=0): total = 0 Modified: python/branches/release25-maint/Lib/test/test_socket.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_socket.py (original) +++ python/branches/release25-maint/Lib/test/test_socket.py Sun Jul 6 06:04:07 2008 @@ -762,6 +762,33 @@ self.cli_file.write(MSG) self.cli_file.flush() + def testReadlineAfterRead(self): + a_baloo_is = self.serv_file.read(len("A baloo is")) + self.assertEqual("A baloo is", a_baloo_is) + _a_bear = self.serv_file.read(len(" a bear")) + self.assertEqual(" a bear", _a_bear) + line = self.serv_file.readline() + self.assertEqual("\n", line) + line = self.serv_file.readline() + self.assertEqual("A BALOO IS A BEAR.\n", line) + line = self.serv_file.readline() + self.assertEqual(MSG, line) + + def _testReadlineAfterRead(self): + self.cli_file.write("A baloo is a bear\n") + self.cli_file.write("A BALOO IS A BEAR.\n") + self.cli_file.write(MSG) + self.cli_file.flush() + + def testReadlineAfterReadNoNewline(self): + end_of_ = self.serv_file.read(len("End Of ")) + self.assertEqual("End Of ", end_of_) + line = self.serv_file.readline() + self.assertEqual("Line", line) + + def _testReadlineAfterReadNoNewline(self): + self.cli_file.write("End Of Line") + def testClosedAttr(self): self.assert_(not self.serv_file.closed) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Jul 6 06:04:07 2008 @@ -102,6 +102,9 @@ stdout and stderr fds rather than leaving them open until the instance is destroyed. +- Issue #2632: Prevent socket.read(bignumber) from over allocating memory + in the common case when the data is returned from the underlying socket + in increments much smaller than bignumber. Extension Modules ----------------- From buildbot at python.org Sun Jul 6 06:12:08 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 04:12:08 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20080706041208.3A2A51E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/1297 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sun Jul 6 06:21:13 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 04:21:13 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 2.5 Message-ID: <20080706042113.9007D1E4004@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%202.5/builds/10 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_timeout ====================================================================== FAIL: testConnectTimeout (test.test_timeout.TimeoutTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/2.5.klose-ubuntu-i386/build/Lib/test/test_timeout.py", line 122, in testConnectTimeout self.addr_remote) AssertionError: error not raised make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jul 6 07:32:09 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 6 Jul 2008 07:32:09 +0200 (CEST) Subject: [Python-checkins] r64755 - doctools/branches/0.4.x/EXAMPLES Message-ID: <20080706053209.909321E4004@bag.python.org> Author: georg.brandl Date: Sun Jul 6 07:32:09 2008 New Revision: 64755 Log: Backport r64750. Modified: doctools/branches/0.4.x/EXAMPLES Modified: doctools/branches/0.4.x/EXAMPLES ============================================================================== --- doctools/branches/0.4.x/EXAMPLES (original) +++ doctools/branches/0.4.x/EXAMPLES Sun Jul 6 07:32:09 2008 @@ -19,8 +19,8 @@ * PyUblas: http://tiker.net/doc/pyublas/ * Py on Windows: http://timgolden.me.uk/python-on-windows/ * Zope 3: e.g. http://docs.carduner.net/z3c-tutorial/ +* SymPy: http://docs.sympy.org/ * Grok (upcoming) * Django (upcoming) * Matplotlib (upcoming) * TurboGears (upcoming) - From buildbot at python.org Sun Jul 6 08:36:25 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 06:36:25 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 2.5 Message-ID: <20080706063625.E10031E4004@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%202.5/builds/514 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket ====================================================================== FAIL: testInterruptedTimeout (test.test_socket.TCPTimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/net/taipan/scratch1/nnorwitz/python/2.5.norwitz-tru64/build/Lib/test/test_socket.py", line 906, in testInterruptedTimeout self.fail("got Alarm in wrong place") AssertionError: got Alarm in wrong place sincerely, -The Buildbot From python-checkins at python.org Sun Jul 6 09:16:41 2008 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 6 Jul 2008 09:16:41 +0200 (CEST) Subject: [Python-checkins] r64756 - in python/trunk: Lib/subprocess.py Misc/NEWS Message-ID: <20080706071641.0D4131E4004@bag.python.org> Author: gregory.p.smith Date: Sun Jul 6 09:16:40 2008 New Revision: 64756 Log: - Issue #2113: Fix error in subprocess.Popen if the select system call is interrupted by a signal. Modified: python/trunk/Lib/subprocess.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/subprocess.py ============================================================================== --- python/trunk/Lib/subprocess.py (original) +++ python/trunk/Lib/subprocess.py Sun Jul 6 09:16:40 2008 @@ -1158,7 +1158,12 @@ input_offset = 0 while read_set or write_set: - rlist, wlist, xlist = select.select(read_set, write_set, []) + try: + rlist, wlist, xlist = select.select(read_set, write_set, []) + except select.error, e: + if e.args[0] == errno.EINTR: + continue + raise if self.stdin in wlist: # When select has indicated that the file is writable, Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jul 6 09:16:40 2008 @@ -59,6 +59,9 @@ urllib module in Python 3.0 to urllib.request, urllib.parse, and urllib.error. +- Issue #2113: Fix error in subprocess.Popen if the select system call is + interrupted by a signal. + Build ----- From nnorwitz at gmail.com Sun Jul 6 10:09:11 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 6 Jul 2008 04:09:11 -0400 Subject: [Python-checkins] Python Regression Test Failures basics (1) Message-ID: <20080706080911.GA31310@python.psfb.org> 324 tests OK. 1 test failed: test_sys 34 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing test_ossaudiodev test_pep277 test_py3kwarn test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ test__locale test_abc test_abstract_numbers test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat test_asyncore test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_buffer test_bufio test_bytes test_bz2 test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd test_cmd_line test_cmd_line_script test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_cprofile test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils test_dl test_docxmlrpc test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_epoll test_epoll skipped -- kernel doesn't support epoll() test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_fractions test_frozen test_ftplib test_funcattrs test_functools test_future test_future3 test_future4 test_future_builtins test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_httpservers [12413 refs] [12413 refs] [20804 refs] test_imageop test_imageop skipped -- No module named imgfile test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_int test_int_literal test_io test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_json test_kqueue test_kqueue skipped -- test works only on BSD test_largefile test_lib2to3 test_lib2to3 skipped -- Use of the `lib2to3' resource not enabled test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macos test_macos skipped -- No module named MacOS test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_memoryio test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_multiprocessing test_multiprocessing skipped -- OSError raises on RLock creation, see issue 3111! test_mutants test_mutex test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser Expecting 's_push: parser stack overflow' in next line s_push: parser stack overflow test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pipes test_pkg test_pkgimport test_pkgutil test_platform test_plistlib test_poll test_popen [12418 refs] [12418 refs] [12418 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_print test_profile test_profilehooks test_property test_pstats test_pty test_pwd test_py3kwarn test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag test_pyclbr test_pydoc [17296 refs] test_pyexpat test_queue test_quopri [14932 refs] [14932 refs] test_random test_re test_repr test_resource test_rfc822 test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site [12413 refs] [12413 refs] [12416 refs] [12413 refs] test_slice test_smtplib test_socket test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort test_sqlite test_ssl test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [14317 refs] [12631 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] . [12413 refs] [12413 refs] this bit of output is from a test of stdout in a different process ... [12413 refs] [12413 refs] [12631 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [12413 refs] [12413 refs] [12642 refs] [12436 refs] test test_sys failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_sys.py", line 371, in test_compact_freelists sys._compact_freelists() AttributeError: 'module' object has no attribute '_compact_freelists' test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12416 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [15643 refs] [16344 refs] test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_typechecks test_ucn test_unary test_undocumented_details test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 324 tests OK. 1 test failed: test_sys 34 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing test_ossaudiodev test_pep277 test_py3kwarn test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl [652844 refs] From nnorwitz at gmail.com Sun Jul 6 10:15:24 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 6 Jul 2008 04:15:24 -0400 Subject: [Python-checkins] Python Regression Test Failures opt (1) Message-ID: <20080706081523.GA32546@python.psfb.org> 324 tests OK. 1 test failed: test_sys 34 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing test_ossaudiodev test_pep277 test_py3kwarn test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ test__locale test_abc test_abstract_numbers test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat test_asyncore test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 test_bsddb3 skipped -- Use of the `bsddb' resource not enabled test_buffer test_bufio test_bytes test_bz2 test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd test_cmd_line test_cmd_line_script test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_cprofile test_crypt test_csv test_ctypes test_curses test_curses skipped -- Use of the `curses' resource not enabled test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils [16591 refs] test_dl test_docxmlrpc test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_epoll test_epoll skipped -- kernel doesn't support epoll() test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_fractions test_frozen test_ftplib test_funcattrs test_functools test_future test_future3 test_future4 test_future_builtins test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_httpservers [12413 refs] [12413 refs] [20804 refs] test_imageop test_imageop skipped -- No module named imgfile test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_int test_int_literal test_io test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_json test_kqueue test_kqueue skipped -- test works only on BSD test_largefile test_lib2to3 test_lib2to3 skipped -- Use of the `lib2to3' resource not enabled test_linuxaudiodev test_linuxaudiodev skipped -- Use of the `audio' resource not enabled test_list test_locale test_logging test_long test_long_future test_longexp test_macos test_macos skipped -- No module named MacOS test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_memoryio test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_multiprocessing test_multiprocessing skipped -- OSError raises on RLock creation, see issue 3111! test_mutants test_mutex test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_ossaudiodev test_ossaudiodev skipped -- Use of the `audio' resource not enabled test_parser Expecting 's_push: parser stack overflow' in next line s_push: parser stack overflow test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pipes test_pkg test_pkgimport test_pkgutil test_platform test_plistlib test_poll test_popen [12418 refs] [12418 refs] [12418 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_print test_profile test_profilehooks test_property test_pstats test_pty test_pwd test_py3kwarn test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag test_pyclbr test_pydoc [17296 refs] test_pyexpat test_queue test_quopri [14932 refs] [14932 refs] test_random test_re test_repr test_resource test_rfc822 test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site [12413 refs] [12413 refs] [12416 refs] [12413 refs] test_slice test_smtplib test_socket test_socketserver test_socketserver skipped -- Use of the `network' resource not enabled test_softspace test_sort test_sqlite test_ssl test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [14317 refs] [12631 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] . [12413 refs] [12413 refs] this bit of output is from a test of stdout in a different process ... [12413 refs] [12413 refs] [12631 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [12413 refs] [12413 refs] [12642 refs] [12436 refs] test test_sys failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_sys.py", line 371, in test_compact_freelists sys._compact_freelists() AttributeError: 'module' object has no attribute '_compact_freelists' test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12416 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [15643 refs] [16344 refs] test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_typechecks test_ucn test_unary test_undocumented_details test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllib2net skipped -- Use of the `network' resource not enabled test_urllibnet test_urllibnet skipped -- Use of the `network' resource not enabled test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 324 tests OK. 1 test failed: test_sys 34 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing test_ossaudiodev test_pep277 test_py3kwarn test_scriptpackages test_socketserver test_startfile test_sunaudiodev test_tcl test_timeout test_unicode_file test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl [652116 refs] From buildbot at python.org Sun Jul 6 10:46:26 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 08:46:26 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 trunk Message-ID: <20080706084626.4EAD11E4004@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%20trunk/builds/3331 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/cluster/members/member0/tmp/tmp405msq/cgi-bin/file2.py", line 2, in import cgi sincerely, -The Buildbot From nnorwitz at gmail.com Sun Jul 6 11:38:14 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 6 Jul 2008 05:38:14 -0400 Subject: [Python-checkins] Python Regression Test Failures all (2) Message-ID: <20080706093814.GA11592@python.psfb.org> 329 tests OK. 2 tests failed: test_lib2to3 test_sys 25 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_multiprocessing test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ test__locale test_abc test_abstract_numbers test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat test_asyncore test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 Sleepycat Software: Berkeley DB 4.1.25: (December 19, 2002) Test path prefix: /tmp/z-test_bsddb3-9102 test_buffer test_bufio test_bytes test_bz2 test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd test_cmd_line test_cmd_line_script test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler testCompileLibrary still working, be patient... test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_cprofile test_crypt test_csv test_ctypes test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils test_dl test_docxmlrpc test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_epoll test_epoll skipped -- kernel doesn't support epoll() test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_fractions test_frozen test_ftplib test_funcattrs test_functools test_future test_future3 test_future4 test_future_builtins test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_httpservers [12413 refs] [12413 refs] [20804 refs] test_imageop test_imageop skipped -- No module named imgfile test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_int test_int_literal test_io test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_json test_kqueue test_kqueue skipped -- test works only on BSD test_largefile test_lib2to3 No handlers could be found for logger "RefactoringTool" test test_lib2to3 failed -- errors occurred; run in verbose mode for details test_list test_locale test_logging test_long test_long_future test_longexp test_macos test_macos skipped -- No module named MacOS test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_memoryio test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_multiprocessing test_multiprocessing skipped -- OSError raises on RLock creation, see issue 3111! test_mutants test_mutex test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_parser Expecting 's_push: parser stack overflow' in next line s_push: parser stack overflow test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pipes test_pkg test_pkgimport test_pkgutil test_platform test_plistlib test_poll test_popen [12418 refs] [12418 refs] [12418 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_print test_profile test_profilehooks test_property test_pstats test_pty test_pwd test_py3kwarn test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag test_pyclbr test_pydoc [17296 refs] test_pyexpat test_queue test_quopri [14932 refs] [14932 refs] test_random test_re test_repr test_resource test_rfc822 test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site [12413 refs] [12413 refs] [12416 refs] [12413 refs] test_slice test_smtplib test_socket test_socketserver test_softspace test_sort test_sqlite test_ssl test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [14317 refs] [12631 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] . [12413 refs] [12413 refs] this bit of output is from a test of stdout in a different process ... [12413 refs] [12413 refs] [12631 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [12413 refs] [12413 refs] [12642 refs] [12436 refs] test test_sys failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.6/test/test_sys.py", line 371, in test_compact_freelists sys._compact_freelists() AttributeError: 'module' object has no attribute '_compact_freelists' test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12416 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [15643 refs] [15499 refs] test_threading_local test_threadsignals test_time test_timeout test_tokenize test_trace test_traceback test_transformer test_tuple test_typechecks test_ucn test_unary test_undocumented_details test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllibnet test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 329 tests OK. 2 tests failed: test_lib2to3 test_sys 25 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_multiprocessing test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl [669413 refs] From python-checkins at python.org Sun Jul 6 14:39:09 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 6 Jul 2008 14:39:09 +0200 (CEST) Subject: [Python-checkins] r64757 - python/trunk/Lib/test/test_sys.py Message-ID: <20080706123909.E35F51E400A@bag.python.org> Author: benjamin.peterson Date: Sun Jul 6 14:39:09 2008 New Revision: 64757 Log: remove test_compact_freelists from test_sys Modified: python/trunk/Lib/test/test_sys.py Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Sun Jul 6 14:39:09 2008 @@ -367,25 +367,6 @@ def test_clear_type_cache(self): sys._clear_type_cache() - def test_compact_freelists(self): - sys._compact_freelists() - r = sys._compact_freelists() -## # freed blocks shouldn't change -## self.assertEqual(r[0][2], 0) -## self.assertEqual(r[1][2], 0) -## # fill freelists -## ints = list(range(10000)) -## floats = [float(i) for i in ints] -## del ints -## del floats -## # should free more than 200 blocks each -## r = sys._compact_freelists() -## self.assert_(r[0][1] > 100, r[0][1]) -## self.assert_(r[1][2] > 100, r[1][1]) -## -## self.assert_(r[0][2] > 100, r[0][2]) -## self.assert_(r[1][2] > 100, r[1][2]) - def test_ioencoding(self): import subprocess,os env = dict(os.environ) From python-checkins at python.org Sun Jul 6 19:06:30 2008 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 6 Jul 2008 19:06:30 +0200 (CEST) Subject: [Python-checkins] r64758 - python/trunk/Modules/_fileio.c Message-ID: <20080706170630.216E31E4005@bag.python.org> Author: gregory.p.smith Date: Sun Jul 6 19:06:29 2008 New Revision: 64758 Log: fix issue3304 - remove an incorrect PyMem_Free in fileio_init Modified: python/trunk/Modules/_fileio.c Modified: python/trunk/Modules/_fileio.c ============================================================================== --- python/trunk/Modules/_fileio.c (original) +++ python/trunk/Modules/_fileio.c Sun Jul 6 19:06:29 2008 @@ -278,7 +278,6 @@ ret = -1; done: - PyMem_Free(name); return ret; } From python-checkins at python.org Sun Jul 6 19:36:20 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 6 Jul 2008 19:36:20 +0200 (CEST) Subject: [Python-checkins] r64759 - python/trunk/Doc/tools/sphinxext/opensearch.xml Message-ID: <20080706173620.9EE431E4005@bag.python.org> Author: georg.brandl Date: Sun Jul 6 19:36:20 2008 New Revision: 64759 Log: Fix opensearch template. Modified: python/trunk/Doc/tools/sphinxext/opensearch.xml Modified: python/trunk/Doc/tools/sphinxext/opensearch.xml ============================================================================== --- python/trunk/Doc/tools/sphinxext/opensearch.xml (original) +++ python/trunk/Doc/tools/sphinxext/opensearch.xml Sun Jul 6 19:36:20 2008 @@ -1,14 +1,4 @@ - - - Python Docs - Python Documentation - Search the Python documentation - utf-8 - - - - - - http://www.python.org/images/favicon16x16.ico - - +{% extends "!opensearch.xml" %} +{% block extra -%} +http://www.python.org/images/favicon16x16.ico +{%- endblock %} From python-checkins at python.org Sun Jul 6 19:43:16 2008 From: python-checkins at python.org (andrew.kuchling) Date: Sun, 6 Jul 2008 19:43:16 +0200 (CEST) Subject: [Python-checkins] r64760 - python/trunk/Doc/library/shutil.rst Message-ID: <20080706174316.CF0B81E4005@bag.python.org> Author: andrew.kuchling Date: Sun Jul 6 19:43:16 2008 New Revision: 64760 Log: Wording fix Modified: python/trunk/Doc/library/shutil.rst Modified: python/trunk/Doc/library/shutil.rst ============================================================================== --- python/trunk/Doc/library/shutil.rst (original) +++ python/trunk/Doc/library/shutil.rst Sun Jul 6 19:43:16 2008 @@ -82,7 +82,7 @@ This factory function creates a function that can be used as a callable for :func:`copytree`\'s *ignore* argument, ignoring files and directories that - match one the glob-style *patterns* provided. See the example below. + match one of the glob-style *patterns* provided. See the example below. .. versionadded:: 2.6 From python-checkins at python.org Sun Jul 6 19:44:18 2008 From: python-checkins at python.org (andrew.kuchling) Date: Sun, 6 Jul 2008 19:44:18 +0200 (CEST) Subject: [Python-checkins] r64761 - python/trunk/Doc/whatsnew/2.6.rst Message-ID: <20080706174418.354641E4005@bag.python.org> Author: andrew.kuchling Date: Sun Jul 6 19:44:17 2008 New Revision: 64761 Log: Add two items; rewrap paragraph Modified: python/trunk/Doc/whatsnew/2.6.rst Modified: python/trunk/Doc/whatsnew/2.6.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.6.rst (original) +++ python/trunk/Doc/whatsnew/2.6.rst Sun Jul 6 19:44:17 2008 @@ -1681,6 +1681,11 @@ available, instead of restricting itself to protocol 1. (Contributed by W. Barnes; :issue:`1551443`.) +* The :mod:`cgi` module will now read variables from the query string of an + HTTP POST request. This makes it possible to use form actions with + URLs such as "/cgi-bin/add.py?category=1". (Contributed by + Alexandre Fiori and Nubis; :issue:`1817`.) + * The :mod:`cmath` module underwent an extensive set of revisions, thanks to Mark Dickinson and Christian Heimes, that added some new features and greatly improved the accuracy of the computations. @@ -2137,6 +2142,24 @@ * The :mod:`sets` module has been deprecated; it's better to use the built-in :class:`set` and :class:`frozenset` types. +* The :func:`shutil.copytree` function now has an optional **ignore** argument + that takes a callable object. This callable will receive each directory path + and a list of the directory's contents, and returns a list of names that + will be ignored, not copied. + + The :mod:`shutil` module also provides an :func:`ignore_patterns` + function for use with this new parameter. + :func:`ignore_patterns` takes an arbitrary number of glob-style patterns + and will ignore any files and directories that match this pattern. + The following example copies a directory tree, but skip both SVN's internal + :file:`.svn` directories and Emacs backup + files, which have names ending with '~':: + + shutil.copytree('Doc/library', '/tmp/library', + ignore=shutil.ignore_patterns('*~')) + + (Contributed by Tarek Ziad?; :issue:`2663`.) + * Integrating signal handling with GUI handling event loops like those used by Tkinter or GTk+ has long been a problem; most software ends up polling, waking up every fraction of a second. @@ -2500,9 +2523,10 @@ ... ValueError: malformed string -The module also includes -:class:`NodeVisitor` and :class:`NodeTransformer` classes -for traversing and modifying an AST, and functions for common transformations such as changing line numbers. +The module also includes :class:`NodeVisitor` and +:class:`NodeTransformer` classes for traversing and modifying an AST, +and functions for common transformations such as changing line +numbers. .. ====================================================================== From buildbot at python.org Sun Jul 6 20:33:17 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 18:33:17 +0000 Subject: [Python-checkins] buildbot failure in PPC64 Debian trunk Message-ID: <20080706183317.6B3F91E4005@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%20Debian%20trunk/builds/1156 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_lib2to3 ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 1427, in test_import_from self.check(b, a) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 1416, in test_import_module self.check(b, a) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/pybot/buildarea64/trunk.klose-debian-ppc64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jul 6 20:40:31 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 18:40:31 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc trunk Message-ID: <20080706184031.33DED1E4005@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%20trunk/builds/231 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_lib2to3 ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 1427, in test_import_from self.check(b, a) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 1416, in test_import_module self.check(b, a) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' sincerely, -The Buildbot From python-checkins at python.org Sun Jul 6 23:34:39 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Sun, 6 Jul 2008 23:34:39 +0200 (CEST) Subject: [Python-checkins] r64762 - in python/trunk: Lib/SimpleHTTPServer.py Misc/NEWS Message-ID: <20080706213439.6EB411E4005@bag.python.org> Author: amaury.forgeotdarc Date: Sun Jul 6 23:34:39 2008 New Revision: 64762 Log: Issue839496: SimpleHTTPServer should open all files in binary mode. Forward-port of 38255 (2005/01/15!) This was already fixed in 2.4, but never merged into trunk... py3k is already right, thanks to the bytes/str distinction! Should be backported to 2.5. Modified: python/trunk/Lib/SimpleHTTPServer.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/SimpleHTTPServer.py ============================================================================== --- python/trunk/Lib/SimpleHTTPServer.py (original) +++ python/trunk/Lib/SimpleHTTPServer.py Sun Jul 6 23:34:39 2008 @@ -79,12 +79,11 @@ else: return self.list_directory(path) ctype = self.guess_type(path) - if ctype.startswith('text/'): - mode = 'r' - else: - mode = 'rb' try: - f = open(path, mode) + # Always read in binary mode. Opening files in text mode may cause + # newline translations, making the actual size of the content + # transmitted *less* than the content-length! + f = open(path, 'rb') except IOError: self.send_error(404, "File not found") return None Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jul 6 23:34:39 2008 @@ -36,6 +36,12 @@ Library ------- +- Issue #839496: SimpleHTTPServer used to open text files in text mode. This is + both unnecessary (HTTP allows text content to be sent in several forms) and + wrong because the actual transmitted size could differ with the + content-length. The problem had been corrected in the 2.4 branch, but never + merged into trunk. + - Issue #2663: add filtering capability to shutil.copytree(). - Issue #1622: Correct interpretation of various ZIP header fields. From nnorwitz at gmail.com Sun Jul 6 23:36:22 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 6 Jul 2008 17:36:22 -0400 Subject: [Python-checkins] Python Regression Test Failures all (1) Message-ID: <20080706213622.GA1870@python.psfb.org> 330 tests OK. 1 test failed: test_lib2to3 25 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_multiprocessing test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ test__locale test_abc test_abstract_numbers test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat test_asyncore test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 Sleepycat Software: Berkeley DB 4.1.25: (December 19, 2002) Test path prefix: /tmp/z-test_bsddb3-31833 test_buffer test_bufio test_bytes test_bz2 test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd test_cmd_line test_cmd_line_script test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler testCompileLibrary still working, be patient... test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_cprofile test_crypt test_csv test_ctypes test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils test_dl test_docxmlrpc test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_epoll test_epoll skipped -- kernel doesn't support epoll() test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_fractions test_frozen test_ftplib test_funcattrs test_functools test_future test_future3 test_future4 test_future_builtins test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_httpservers [12413 refs] [12413 refs] [20804 refs] test_imageop test_imageop skipped -- No module named imgfile test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_int test_int_literal test_io test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_json test_kqueue test_kqueue skipped -- test works only on BSD test_largefile test_lib2to3 No handlers could be found for logger "RefactoringTool" test test_lib2to3 failed -- errors occurred; run in verbose mode for details test_list test_locale test_logging test_long test_long_future test_longexp test_macos test_macos skipped -- No module named MacOS test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_memoryio test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_multiprocessing test_multiprocessing skipped -- OSError raises on RLock creation, see issue 3111! test_mutants test_mutex test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_parser Expecting 's_push: parser stack overflow' in next line s_push: parser stack overflow test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pipes test_pkg test_pkgimport test_pkgutil test_platform test_plistlib test_poll test_popen [12418 refs] [12418 refs] [12418 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_print test_profile test_profilehooks test_property test_pstats test_pty test_pwd test_py3kwarn test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag test_pyclbr test_pydoc [17296 refs] test_pyexpat test_queue test_quopri [14932 refs] [14932 refs] test_random test_re test_repr test_resource test_rfc822 test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site [12413 refs] [12413 refs] [12416 refs] [12413 refs] test_slice test_smtplib test_socket test_socketserver test_softspace test_sort test_sqlite test_ssl test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [14317 refs] [12631 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] . [12413 refs] [12413 refs] this bit of output is from a test of stdout in a different process ... [12413 refs] [12413 refs] [12631 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [12413 refs] [12413 refs] [12642 refs] [12436 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12416 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [15643 refs] [16344 refs] test_threading_local test_threadsignals test_time test_timeout test_tokenize test_trace test_traceback test_transformer test_tuple test_typechecks test_ucn test_unary test_undocumented_details test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllibnet test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 330 tests OK. 1 test failed: test_lib2to3 25 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_multiprocessing test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl [669391 refs] From buildbot at python.org Mon Jul 7 00:33:13 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 22:33:13 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 3.0 Message-ID: <20080706223313.BC7CD1E4005@bag.python.org> The Buildbot has detected a new failure of OS X x86 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%203.0/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Mon Jul 7 01:51:38 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 06 Jul 2008 23:51:38 +0000 Subject: [Python-checkins] buildbot failure in g4 osx.4 3.0 Message-ID: <20080706235138.BCBB11E4007@bag.python.org> The Buildbot has detected a new failure of g4 osx.4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/g4%20osx.4%203.0/builds/1091 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: psf-g4 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/Users/buildslave/bb/3.0.psf-g4/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jul 7 06:27:08 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 Jul 2008 04:27:08 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 3.0 Message-ID: <20080707042708.CAE531E4007@bag.python.org> The Buildbot has detected a new failure of x86 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20gentoo%203.0/builds/1204 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Unknown signal 32 sincerely, -The Buildbot From buildbot at python.org Mon Jul 7 06:30:50 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 Jul 2008 04:30:50 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080707043051.1B74B1E4008@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/149 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_ssl ====================================================================== ERROR: testSSLconnect (test.test_ssl.BasicTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 44, in testSSLconnect s.connect(("svn.python.org", 443)) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/ssl.py", line 323, in connect socket.connect(self, addr) socket.error: [Errno 111] Connection refused ====================================================================== ERROR: testConnect (test.test_ssl.NetworkedTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 105, in testConnect s.connect(("svn.python.org", 443)) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/ssl.py", line 323, in connect socket.connect(self, addr) socket.error: [Errno 111] Connection refused ====================================================================== ERROR: testFetchServerCert (test.test_ssl.NetworkedTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 158, in testFetchServerCert pem = ssl.get_server_certificate(("svn.python.org", 443)) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/ssl.py", line 415, in get_server_certificate s.connect(addr) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/ssl.py", line 323, in connect socket.connect(self, addr) socket.error: [Errno 111] Connection refused ====================================================================== ERROR: testNonBlockingHandshake (test.test_ssl.NetworkedTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_ssl.py", line 134, in testNonBlockingHandshake s.connect(("svn.python.org", 443)) socket.error: [Errno 111] Connection refused make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jul 7 06:31:59 2008 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 7 Jul 2008 06:31:59 +0200 (CEST) Subject: [Python-checkins] r64767 - in python/trunk: Lib/test/test_bz2.py Misc/NEWS Modules/bz2module.c Message-ID: <20080707043159.18CA41E4007@bag.python.org> Author: gregory.p.smith Date: Mon Jul 7 06:31:58 2008 New Revision: 64767 Log: - Issue #3309: Fix bz2.BZFile itererator to release its internal lock properly when raising an exception due to the bz2file being closed. Prevents a deadlock. Modified: python/trunk/Lib/test/test_bz2.py python/trunk/Misc/NEWS python/trunk/Modules/bz2module.c Modified: python/trunk/Lib/test/test_bz2.py ============================================================================== --- python/trunk/Lib/test/test_bz2.py (original) +++ python/trunk/Lib/test/test_bz2.py Mon Jul 7 06:31:58 2008 @@ -112,6 +112,17 @@ self.assertEqual(list(iter(bz2f)), sio.readlines()) bz2f.close() + def testClosedIteratorDeadlock(self): + # "Test that iteration on a closed bz2file releases the lock." + # http://bugs.python.org/issue3309 + self.createTempFile() + bz2f = BZ2File(self.filename) + bz2f.close() + self.assertRaises(ValueError, bz2f.next) + # This call will deadlock of the above .next call failed to + # release the lock. + self.assertRaises(ValueError, bz2f.readlines) + def testXReadLines(self): # "Test BZ2File.xreadlines()" self.createTempFile() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jul 7 06:31:58 2008 @@ -68,6 +68,10 @@ - Issue #2113: Fix error in subprocess.Popen if the select system call is interrupted by a signal. +- Issue #3309: Fix bz2.BZFile itererator to release its internal lock + properly when raising an exception due to the bz2file being closed. + Prevents a deadlock. + Build ----- Modified: python/trunk/Modules/bz2module.c ============================================================================== --- python/trunk/Modules/bz2module.c (original) +++ python/trunk/Modules/bz2module.c Mon Jul 7 06:31:58 2008 @@ -1451,6 +1451,7 @@ PyStringObject* ret; ACQUIRE_LOCK(self); if (self->mode == MODE_CLOSED) { + RELEASE_LOCK(self); PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); return NULL; From buildbot at python.org Mon Jul 7 06:38:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 Jul 2008 04:38:10 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080707043810.E37781E4007@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/742 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jul 7 06:51:47 2008 From: python-checkins at python.org (josiah.carlson) Date: Mon, 7 Jul 2008 06:51:47 +0200 (CEST) Subject: [Python-checkins] r64768 - in python/trunk/Lib: asynchat.py asyncore.py test/test_asyncore.py Message-ID: <20080707045147.1D1511E4007@bag.python.org> Author: josiah.carlson Date: Mon Jul 7 06:51:46 2008 New Revision: 64768 Log: Fixed bugs 760475, 953599, and 1519. Modified: python/trunk/Lib/asynchat.py python/trunk/Lib/asyncore.py python/trunk/Lib/test/test_asyncore.py Modified: python/trunk/Lib/asynchat.py ============================================================================== --- python/trunk/Lib/asynchat.py (original) +++ python/trunk/Lib/asynchat.py Mon Jul 7 06:51:46 2008 @@ -59,7 +59,7 @@ ac_in_buffer_size = 4096 ac_out_buffer_size = 4096 - def __init__ (self, conn=None): + def __init__ (self, sock=None, map=None): # for string terminator matching self.ac_in_buffer = '' @@ -74,7 +74,7 @@ # we toss the use of the "simple producer" and replace it with # a pure deque, which the original fifo was a wrapping of self.producer_fifo = deque() - asyncore.dispatcher.__init__ (self, conn) + asyncore.dispatcher.__init__ (self, sock, map) def collect_incoming_data(self, data): raise NotImplementedError("must be implemented in subclass") Modified: python/trunk/Lib/asyncore.py ============================================================================== --- python/trunk/Lib/asyncore.py (original) +++ python/trunk/Lib/asyncore.py Mon Jul 7 06:51:46 2008 @@ -99,8 +99,10 @@ obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() - if flags & (select.POLLERR | select.POLLHUP | select.POLLNVAL): + if flags & (select.POLLERR | select.POLLNVAL): obj.handle_expt_event() + if flags & select.POLLHUP: + obj.handle_close_event() except (ExitNow, KeyboardInterrupt, SystemExit): raise except: @@ -467,7 +469,7 @@ ), 'error' ) - self.close() + self.handle_close() def handle_expt(self): self.log_info('unhandled exception', 'warning') Modified: python/trunk/Lib/test/test_asyncore.py ============================================================================== --- python/trunk/Lib/test/test_asyncore.py (original) +++ python/trunk/Lib/test/test_asyncore.py Mon Jul 7 06:51:46 2008 @@ -38,6 +38,7 @@ raise asyncore.ExitNow() handle_write_event = handle_read_event + handle_close_event = handle_read_event handle_expt_event = handle_read_event class crashingdummy: @@ -48,6 +49,7 @@ raise Exception() handle_write_event = handle_read_event + handle_close_event = handle_read_event handle_expt_event = handle_read_event def handle_error(self): @@ -117,6 +119,7 @@ def __init__(self): self.read = False self.write = False + self.closed = False self.expt = False def handle_read_event(self): @@ -125,6 +128,9 @@ def handle_write_event(self): self.write = True + def handle_close_event(self): + self.closed = True + def handle_expt_event(self): self.expt = True @@ -167,9 +173,9 @@ for flag in (select.POLLERR, select.POLLHUP, select.POLLNVAL): tobj = testobj() - self.assertEqual(tobj.expt, False) + self.assertEqual((tobj.expt, tobj.closed)[flag == select.POLLHUP], False) asyncore.readwrite(tobj, flag) - self.assertEqual(tobj.expt, True) + self.assertEqual((tobj.expt, tobj.closed)[flag == select.POLLHUP], True) # check that ExitNow exceptions in the object handler method # bubbles all the way up through asyncore readwrite calls From python-checkins at python.org Mon Jul 7 06:54:32 2008 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 7 Jul 2008 06:54:32 +0200 (CEST) Subject: [Python-checkins] r64769 - python/trunk/Modules/Setup.dist Message-ID: <20080707045432.08E211E4007@bag.python.org> Author: gregory.p.smith Date: Mon Jul 7 06:54:31 2008 New Revision: 64769 Log: Add commented out #_sha256 and #_sha512 lines per issue 3183. Modified: python/trunk/Modules/Setup.dist Modified: python/trunk/Modules/Setup.dist ============================================================================== --- python/trunk/Modules/Setup.dist (original) +++ python/trunk/Modules/Setup.dist Mon Jul 7 06:54:31 2008 @@ -246,9 +246,11 @@ #_md5 md5module.c md5.c -# The _sha module implements the SHA checksum algorithm. -# (NIST's Secure Hash Algorithm.) +# The _sha module implements the SHA checksum algorithms. +# (NIST's Secure Hash Algorithms.) #_sha shamodule.c +#_sha256 sha256module.c +#_sha512 sha512module.c # SGI IRIX specific modules -- off by default. From buildbot at python.org Mon Jul 7 06:58:39 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 Jul 2008 04:58:39 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080707045839.B94B61E4007@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/736 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Mon Jul 7 07:09:12 2008 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 7 Jul 2008 07:09:12 +0200 (CEST) Subject: [Python-checkins] r64771 - in python/trunk: Lib/httplib.py Misc/NEWS Message-ID: <20080707050912.D54D31E4007@bag.python.org> Author: gregory.p.smith Date: Mon Jul 7 07:09:12 2008 New Revision: 64771 Log: - Issue #3094: httplib.HTTPSConnection Host: headers no longer include the redundant ":443" port number designation when the connection is using the default https port (443). Modified: python/trunk/Lib/httplib.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/httplib.py ============================================================================== --- python/trunk/Lib/httplib.py (original) +++ python/trunk/Lib/httplib.py Mon Jul 7 07:09:12 2008 @@ -813,7 +813,7 @@ host_enc = self.host.encode("ascii") except UnicodeEncodeError: host_enc = self.host.encode("idna") - if self.port == HTTP_PORT: + if self.port == self.default_port: self.putheader('Host', host_enc) else: self.putheader('Host', "%s:%s" % (host_enc, self.port)) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jul 7 07:09:12 2008 @@ -72,6 +72,10 @@ properly when raising an exception due to the bz2file being closed. Prevents a deadlock. +- Issue #3094: httplib.HTTPSConnection Host: headers no longer include the + redundant ":443" port number designation when the connection is using the + default https port (443). + Build ----- From buildbot at python.org Mon Jul 7 07:15:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 Jul 2008 05:15:36 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080707051536.C54061E4007@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/348 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jul 7 07:36:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 Jul 2008 05:36:24 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080707053625.0C0DF1E400B@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1194 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_ssl make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jul 7 08:49:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 Jul 2008 06:49:32 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080707064933.015581E4007@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/248 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jul 7 09:54:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 Jul 2008 07:54:46 +0000 Subject: [Python-checkins] buildbot failure in S-390 Debian 3.0 Message-ID: <20080707075446.6566B1E4007@bag.python.org> The Buildbot has detected a new failure of S-390 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/S-390%20Debian%203.0/builds/589 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-s390 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Mon Jul 7 11:36:08 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 7 Jul 2008 05:36:08 -0400 Subject: [Python-checkins] Python Regression Test Failures all (1) Message-ID: <20080707093608.GA25785@python.psfb.org> 330 tests OK. 1 test failed: test_lib2to3 25 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_multiprocessing test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_unittest test_doctest test_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ test__locale test_abc test_abstract_numbers test_aepack test_aepack skipped -- No module named aepack test_al test_al skipped -- No module named al test_anydbm test_applesingle test_applesingle skipped -- No module named macostools test_array test_ast test_asynchat test_asyncore test_atexit test_audioop test_augassign test_base64 test_bastion test_bigaddrspace test_bigmem test_binascii test_binhex test_binop test_bisect test_bool test_bsddb test_bsddb185 test_bsddb185 skipped -- No module named bsddb185 test_bsddb3 Sleepycat Software: Berkeley DB 4.1.25: (December 19, 2002) Test path prefix: /tmp/z-test_bsddb3-22956 test_buffer test_bufio test_bytes test_bz2 test_calendar test_call test_capi test_cd test_cd skipped -- No module named cd test_cfgparser test_cgi test_charmapcodec test_cl test_cl skipped -- No module named cl test_class test_cmath test_cmd test_cmd_line test_cmd_line_script test_code test_codeccallbacks test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_codecs test_codeop test_coding test_coercion test_collections test_colorsys test_commands test_compare test_compile test_compiler testCompileLibrary still working, be patient... test_complex test_complex_args test_contains test_contextlib test_cookie test_cookielib test_copy test_copy_reg test_cpickle test_cprofile test_crypt test_csv test_ctypes test_datetime test_dbm test_decimal test_decorators test_defaultdict test_deque test_descr test_descrtut test_difflib test_dircache test_dis test_distutils test_dl test_docxmlrpc test_dumbdbm test_dummy_thread test_dummy_threading test_email test_email_codecs test_email_renamed test_enumerate test_eof test_epoll test_epoll skipped -- kernel doesn't support epoll() test_errno test_exception_variations test_extcall test_fcntl test_file test_filecmp test_fileinput test_float test_fnmatch test_fork1 test_format test_fpformat test_fractions test_frozen test_ftplib test_funcattrs test_functools test_future test_future3 test_future4 test_future_builtins test_gc test_gdbm test_generators test_genericpath test_genexps test_getargs test_getargs2 test_getopt test_gettext test_gl test_gl skipped -- No module named gl test_glob test_global test_grp test_gzip test_hash test_hashlib test_heapq test_hmac test_hotshot test_htmllib test_htmlparser test_httplib test_httpservers [12413 refs] [12413 refs] [20804 refs] test_imageop test_imageop skipped -- No module named imgfile test_imaplib test_imgfile test_imgfile skipped -- No module named imgfile test_imp test_import test_importhooks test_index test_inspect test_int test_int_literal test_io test_ioctl test_ioctl skipped -- Unable to open /dev/tty test_isinstance test_iter test_iterlen test_itertools test_json test_kqueue test_kqueue skipped -- test works only on BSD test_largefile test_lib2to3 No handlers could be found for logger "RefactoringTool" test test_lib2to3 failed -- errors occurred; run in verbose mode for details test_list test_locale test_logging test_long test_long_future test_longexp test_macos test_macos skipped -- No module named MacOS test_macostools test_macostools skipped -- No module named macostools test_macpath test_mailbox test_marshal test_math test_md5 test_memoryio test_mhlib test_mimetools test_mimetypes test_minidom test_mmap test_module test_modulefinder test_multibytecodec test_multibytecodec_support test_multifile test_multiprocessing test_multiprocessing skipped -- OSError raises on RLock creation, see issue 3111! test_mutants test_mutex test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test_os test_parser Expecting 's_push: parser stack overflow' in next line s_push: parser stack overflow test_peepholer test_pep247 test_pep263 test_pep277 test_pep277 skipped -- test works only on NT+ test_pep292 test_pep352 test_pickle test_pickletools test_pipes test_pkg test_pkgimport test_pkgutil test_platform test_plistlib test_poll test_popen [12418 refs] [12418 refs] [12418 refs] test_popen2 test_poplib test_posix test_posixpath test_pow test_pprint test_print test_profile test_profilehooks test_property test_pstats test_pty test_pwd test_py3kwarn test_py3kwarn skipped -- test.test_py3kwarn must be run with the -3 flag test_pyclbr test_pydoc [17296 refs] test_pyexpat test_queue test_quopri [14932 refs] [14932 refs] test_random test_re test_repr test_resource test_rfc822 test_richcmp test_robotparser test_runpy test_sax test_scope test_scriptpackages test_scriptpackages skipped -- No module named aetools test_select test_set test_sets test_sgmllib test_sha test_shelve test_shlex test_shutil test_signal test_site [12413 refs] [12413 refs] [12416 refs] [12413 refs] test_slice test_smtplib test_socket test_socketserver test_softspace test_sort test_sqlite test_ssl test_startfile test_startfile skipped -- cannot import name startfile test_str test_strftime test_string test_stringprep test_strop test_strptime test_struct test_structmembers test_structseq test_subprocess [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [14317 refs] [12631 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] [12413 refs] . [12413 refs] [12413 refs] this bit of output is from a test of stdout in a different process ... [12413 refs] [12413 refs] [12631 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry test_symtable test_syntax test_sys [12413 refs] [12413 refs] [12642 refs] [12436 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12416 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [15643 refs] [16344 refs] test_threading_local test_threadsignals test_time test_timeout test_tokenize test_trace test_traceback test_transformer test_tuple test_typechecks test_ucn test_unary test_undocumented_details test_unicode test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test_univnewlines test_unpack test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllibnet test_urlparse test_userdict test_userlist test_userstring test_uu test_uuid WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. test_wait3 test_wait4 test_warnings test_wave test_weakref test_whichdb test_winreg test_winreg skipped -- No module named _winreg test_winsound test_winsound skipped -- No module named winsound test_with test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 330 tests OK. 1 test failed: test_lib2to3 25 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imageop test_imgfile test_ioctl test_kqueue test_macos test_macostools test_multiprocessing test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 3 skips unexpected on linux2: test_epoll test_multiprocessing test_ioctl [669435 refs] From python-checkins at python.org Mon Jul 7 13:16:14 2008 From: python-checkins at python.org (skip.montanaro) Date: Mon, 7 Jul 2008 13:16:14 +0200 (CEST) Subject: [Python-checkins] r64772 - python/trunk/Objects/abstract.c Message-ID: <20080707111614.F20961E4007@bag.python.org> Author: skip.montanaro Date: Mon Jul 7 13:16:14 2008 New Revision: 64772 Log: Correct grammar. Modified: python/trunk/Objects/abstract.c Modified: python/trunk/Objects/abstract.c ============================================================================== --- python/trunk/Objects/abstract.c (original) +++ python/trunk/Objects/abstract.c Mon Jul 7 13:16:14 2008 @@ -1946,7 +1946,7 @@ return m->sq_item(s, i); } - return type_error("'%.200s' object is unindexable", s); + return type_error("'%.200s' object does not support indexing", s); } PyObject * From ncoghlan at gmail.com Mon Jul 7 15:10:18 2008 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 07 Jul 2008 23:10:18 +1000 Subject: [Python-checkins] r64761 - python/trunk/Doc/whatsnew/2.6.rst In-Reply-To: <20080706174418.354641E4005@bag.python.org> References: <20080706174418.354641E4005@bag.python.org> Message-ID: <487215BA.7030508@gmail.com> andrew.kuchling wrote: > + The :mod:`shutil` module also provides an :func:`ignore_patterns` > + function for use with this new parameter. > + :func:`ignore_patterns` takes an arbitrary number of glob-style patterns > + and will ignore any files and directories that match this pattern. > + The following example copies a directory tree, but skip both SVN's internal > + :file:`.svn` directories and Emacs backup > + files, which have names ending with '~':: > + > + shutil.copytree('Doc/library', '/tmp/library', > + ignore=shutil.ignore_patterns('*~')) That code doesn't match the description - I think there was meant to be another argument to ignore_patterns. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org From ncoghlan at gmail.com Mon Jul 7 15:13:20 2008 From: ncoghlan at gmail.com (Nick Coghlan) Date: Mon, 07 Jul 2008 23:13:20 +1000 Subject: [Python-checkins] r64768 - in python/trunk/Lib: asynchat.py asyncore.py test/test_asyncore.py In-Reply-To: <20080707045147.1D1511E4007@bag.python.org> References: <20080707045147.1D1511E4007@bag.python.org> Message-ID: <48721670.6020107@gmail.com> josiah.carlson wrote: > Modified: python/trunk/Lib/asynchat.py > ============================================================================== > --- python/trunk/Lib/asynchat.py (original) > +++ python/trunk/Lib/asynchat.py Mon Jul 7 06:51:46 2008 > @@ -59,7 +59,7 @@ > ac_in_buffer_size = 4096 > ac_out_buffer_size = 4096 > > - def __init__ (self, conn=None): > + def __init__ (self, sock=None, map=None): > # for string terminator matching > self.ac_in_buffer = '' Won't that change break any code calling asyncore.dispatcher with keyword arguments? Was there a specific reason for changing the name of the first argument from conn to sock? Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org From python-checkins at python.org Mon Jul 7 18:51:09 2008 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 7 Jul 2008 18:51:09 +0200 (CEST) Subject: [Python-checkins] r64774 - python/trunk/Doc/whatsnew/2.6.rst Message-ID: <20080707165109.5C7F41E4007@bag.python.org> Author: andrew.kuchling Date: Mon Jul 7 18:51:09 2008 New Revision: 64774 Log: Fix example to match text Modified: python/trunk/Doc/whatsnew/2.6.rst Modified: python/trunk/Doc/whatsnew/2.6.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.6.rst (original) +++ python/trunk/Doc/whatsnew/2.6.rst Mon Jul 7 18:51:09 2008 @@ -2156,7 +2156,7 @@ files, which have names ending with '~':: shutil.copytree('Doc/library', '/tmp/library', - ignore=shutil.ignore_patterns('*~')) + ignore=shutil.ignore_patterns('*~', '.svn')) (Contributed by Tarek Ziad?; :issue:`2663`.) From python-checkins at python.org Mon Jul 7 19:03:00 2008 From: python-checkins at python.org (facundo.batista) Date: Mon, 7 Jul 2008 19:03:00 +0200 (CEST) Subject: [Python-checkins] r64775 - in python/trunk: Lib/test/test_audioop.py Modules/audioop.c Message-ID: <20080707170300.320A91E4007@bag.python.org> Author: facundo.batista Date: Mon Jul 7 19:02:59 2008 New Revision: 64775 Log: Issue 3306. Better control for a lenght in findmax() function. Modified: python/trunk/Lib/test/test_audioop.py python/trunk/Modules/audioop.c Modified: python/trunk/Lib/test/test_audioop.py ============================================================================== --- python/trunk/Lib/test/test_audioop.py (original) +++ python/trunk/Lib/test/test_audioop.py Mon Jul 7 19:02:59 2008 @@ -161,6 +161,10 @@ self.assertEqual(audioop.getsample(data[1], 2, i), i) self.assertEqual(audioop.getsample(data[2], 4, i), i) + def test_negavitelen(self): + # from issue 3306, previously it segfaulted + self.assertRaises(audioop.error, + audioop.findmax, ''.join( chr(x) for x in xrange(256)), -2392392) def test_main(): run_unittest(TestAudioop) Modified: python/trunk/Modules/audioop.c ============================================================================== --- python/trunk/Modules/audioop.c (original) +++ python/trunk/Modules/audioop.c Mon Jul 7 19:02:59 2008 @@ -575,7 +575,7 @@ } len1 >>= 1; - if ( len1 < len2 ) { + if ( len2 < 0 || len1 < len2 ) { PyErr_SetString(AudioopError, "Input sample should be longer"); return 0; } From nedds at uchicago.edu Mon Jul 7 19:08:08 2008 From: nedds at uchicago.edu (Nick Edds) Date: Mon, 7 Jul 2008 12:08:08 -0500 Subject: [Python-checkins] r64651 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py In-Reply-To: <43aa6ff70807052001w6f5414c4ib4974771a708efe7@mail.gmail.com> References: <20080702020011.EE4671E4015@bag.python.org> <43aa6ff70807041822w51c1a93fu3867b1c7a87a9f5e@mail.gmail.com> <1aff528e0807051016l738ece23k198de8024983a03b@mail.gmail.com> <43aa6ff70807052001w6f5414c4ib4974771a708efe7@mail.gmail.com> Message-ID: <1aff528e0807071008iecc05afib4f189d76a0a9f61@mail.gmail.com> For star imports, should I handle them in the same way that fix_imports handles them, i.e. just give a warning and avoid fixing them? On Sat, Jul 5, 2008 at 10:01 PM, Collin Winter wrote: > On Sat, Jul 5, 2008 at 7:37 PM, Brett Cannon wrote: > > On Sat, Jul 5, 2008 at 10:16 AM, Nick Edds wrote: > >> Brett, > >> > >> If you want me to try and make this a fixer, I can give it a shot over > the > >> next few days because I'm already fairly comfortable with fixers in > 2to3. I > >> think based on the revision that was attempted and what I've read > online, I > >> have a pretty good idea of what needs to be done with this fixer. > Hopefully > >> I'll have the time to get this done by Monday or Tuesday if you'd like > me to > >> do it. > >> > > > > Go for it! Basically the fixer needs to deal with the fact that urllib > > and urllib2 now span multiple modules. So as Collin mentioned, you > > probably should import all the modules they span across and then > > update the references in the code appropriately. Trick is going to be > > situations where the modules are imported as something else, e.g., > > ``import urllib as spam`` since that won't work when the modules have > > multiple names. But since I suspect that is a rare case it might just > > have to be a warning or something. > > Agreed. I think we can just warn in this case, rather than wasting > time catering to rarities like this. > > >> On Sat, Jul 5, 2008 at 11:58 AM, Brett Cannon wrote: > >>> > >>> On Fri, Jul 4, 2008 at 6:22 PM, Collin Winter > wrote: > >>> > On Tue, Jul 1, 2008 at 7:00 PM, brett.cannon > >>> > wrote: > >>> >> Author: brett.cannon > >>> >> Date: Wed Jul 2 04:00:11 2008 > >>> >> New Revision: 64651 > >>> >> > >>> >> Log: > >>> >> Update fix_imports for urllib. Had to change the fixer itself to > handle > >>> >> modules > >>> >> that are split across several renames in 3.0. > >>> > > >>> > So I realize that you already reverted this, but I thought to comment > >>> > anyway: this implementation is almost certainly wrong. Any fixer for > >>> > this particular PEP 3108 change will need to possibly insert extra > >>> > imports to handle the new urllib.request/error/etc modules. I think > >>> > this kind of thing should be broken into its own fixer, or at least > >>> > its own distinct functionality inside of fix_imports. > >>> > > >>> > >>> OK. I will see if I can figure out how this works at some point. > >>> > >>> > Nick Edds is working to speed up fix_imports by stripping out the > >>> > member matching stuff, which we don't believe to be actually useful > in > >>> > the majority of module renamings. IMHO there should be two different > >>> > mappings: one for bare-bones module renames (StringIO -> io), and a > >>> > separate one for more complex renames, like urllib/urllib2. That will > >>> > allow optimizing the former larger pattern while preserving > >>> > flexibility for the rare cases in the latter. > >>> > > >>> > >>> Makes sense. > >>> > >>> -Brett > >> > >> > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stackless-checkins-bounces at stackless.com Mon Jul 7 19:33:15 2008 From: stackless-checkins-bounces at stackless.com (stackless-checkins-bounces at stackless.com) Date: Mon, 07 Jul 2008 19:33:15 +0200 Subject: [Python-checkins] Your message to Stackless-checkins awaits moderator approval Message-ID: Your mail to 'Stackless-checkins' with the subject r64776 - in stackless/trunk: Doc/Makefile Doc/c-api/float.rst Doc/c-api/int.rst Doc/conf.py Doc/glossary.rst Doc/includes/email-alternative.py Doc/includes/mp_benchmarks.py Doc/includes/mp_newtype.py Doc/includes/mp_pool.py Doc/includes/mp_synchronize.py Doc/includes/mp_webserver.py Doc/includes/mp_workers.py Doc/includes/noddy.c Doc/includes/noddy2.c Doc/includes/noddy3.c Doc/includes/noddy4.c Doc/includes/run-func.c Doc/includes/shoddy.c Doc/includes/sqlite3/ctx_manager.py Doc/includes/typestruct.h Doc/library/abc.rst Doc/library/ast.rst Doc/library/cgi.rst Doc/library/cmath.rst Doc/library/collections.rst Doc/library/commands.rst Doc/library/decimal.rst Doc/library/fractions.rst Doc/library/gc.rst Doc/library/hotshot.rst Doc/library/math.rst Doc/library/msilib.rst Doc/library/multiprocessing.rst Doc/library/os.path.rst Doc/library/os.rst Doc/library/pickle.rst Doc/library/popen2.rst Doc/library/pprint.rst Doc/library/py_compile.rst Doc/library/rlcompleter.rst Do! c/library/shutil.rst Doc/library/socketserver.rst Doc/library/someos.rst Doc/library/ssl.rst Doc/library/stdtypes.rst Doc/library/subprocess.rst Doc/library/sys.rst Doc/library/urllib.rst Doc/library/zipfile.rst Doc/library/zlib.rst Doc/reference/compound_stmts.rst Doc/reference/expressions.rst Doc/tools/sphinxext/opensearch.xml Doc/tools/sphinxext/patchlevel.py Doc/tools/sphinxext/pyspecific.py Doc/whatsnew/2.6.rst Include/bytes_methods.h Include/floatobject.h Include/intobject.h Include/patchlevel.h Include/stringobject.h Include/warnings.h Lib/SimpleHTTPServer.py Lib/_abcoll.py Lib/ast.py Lib/asynchat.py Lib/asyncore.py Lib/bsddb/test/test_distributed_transactions.py Lib/bsddb/test/test_early_close.py Lib/bsddb/test/test_replication.py Lib/cgi.py Lib/ctypes/test/test_errno.py Lib/curses/textpad.py Lib/decimal.py Lib/difflib.py Lib/distutils/__init__.py Lib/distutils/config.py Lib/distutils/tests/test_build_ext.py Lib/distutils/tests/test_config.py Lib/distutils/tests/tes! t_upload.py Lib/encodings/utf_32.py Lib/encodings/utf_32_be.py Lib/encodings/utf_32_le.py Lib/fractions.py Lib/httplib.py Lib/idlelib/idlever.py Lib/json/__init__.py Lib/json/decoder.py Lib/json/encoder.py Lib/json/scanner.py Lib/json/tests/__init__.py Lib/json/tests/test_decode.py Lib/json/tests/test_default.py Lib/json/tes Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 1971773 bytes with a limit of 500 KB Either the message will get posted to the list, or you will receive notification of the moderator's decision. If you would like to cancel this posting, please visit the following URL: http://www.stackless.com/mailman/confirm/stackless-checkins/5992bcaf9a3f1745c511ee22cda23a570d5c7d06 From stackless-checkins-bounces at stackless.com Mon Jul 7 19:46:52 2008 From: stackless-checkins-bounces at stackless.com (stackless-checkins-bounces at stackless.com) Date: Mon, 07 Jul 2008 19:46:52 +0200 Subject: [Python-checkins] Request to mailing list Stackless-checkins rejected Message-ID: Your request to the Stackless-checkins mailing list Posting of your message titled "r64776 - in stackless/trunk: Doc/Makefile Doc/c-api/float.rst Doc/c-api/int.rst Doc/conf.py Doc/glossary.rst Doc/includes/email-alternative.py Doc/includes/mp_benchmarks.py Doc/includes/mp_newtype.py Doc/includes/mp_pool.py Doc/includes/mp_synchronize.py Doc/includes/mp_webserver.py Doc/includes/mp_workers.py Doc/includes/noddy.c Doc/includes/noddy2.c Doc/includes/noddy3.c Doc/includes/noddy4.c Doc/includes/run-func.c Doc/includes/shoddy.c Doc/includes/sqlite3/ctx_manager.py Doc/includes/typestruct.h Doc/library/abc.rst Doc/library/ast.rst Doc/library/cgi.rst Doc/library/cmath.rst Doc/library/collections.rst Doc/library/commands.rst Doc/library/decimal.rst Doc/library/fractions.rst Doc/library/gc.rst Doc/library/hotshot.rst Doc/library/math.rst Doc/library/msilib.rst Doc/library/multiprocessing.rst Doc/library/os.path.rst Doc/library/os.rst Doc/library/pickle.rst Doc/library/popen2.rst Doc/library/pprint.rst Doc/library/py_compile.rst Doc/library/rlcompleter.rst Do! c/library/shutil.rst Doc/library/socketserver.rst Doc/library/someos.rst Doc/library/ssl.rst Doc/library/stdtypes.rst Doc/library/subprocess.rst Doc/library/sys.rst Doc/library/urllib.rst Doc/library/zipfile.rst Doc/library/zlib.rst Doc/reference/compound_stmts.rst Doc/reference/expressions.rst Doc/tools/sphinxext/opensearch.xml Doc/tools/sphinxext/patchlevel.py Doc/tools/sphinxext/pyspecific.py Doc/whatsnew/2.6.rst Include/bytes_methods.h Include/floatobject.h Include/intobject.h Include/patchlevel.h Include/stringobject.h Include/warnings.h Lib/SimpleHTTPServer.py Lib/_abcoll.py Lib/ast.py Lib/asynchat.py Lib/asyncore.py Lib/bsddb/test/test_distributed_transactions.py Lib/bsddb/test/test_early_close.py Lib/bsddb/test/test_replication.py Lib/cgi.py Lib/ctypes/test/test_errno.py Lib/curses/textpad.py Lib/decimal.py Lib/difflib.py Lib/distutils/__init__.py Lib/distutils/config.py Lib/distutils/tests/test_build_ext.py Lib/distutils/tests/test_config.py Lib/distutils/tests/tes! t_upload.py Lib/encodings/utf_32.py Lib/encodings/utf_32_be.py Lib/encodings/utf_32_le.py Lib/fractions.py Lib/httplib.py Lib/idlelib/idlever.py Lib/json/__init__.py Lib/json/decoder.py Lib/json/encoder.py Lib/json/scanner.py Lib/json/tests/__init__.py Lib/json/tests/test_decode.py Lib/json/tests/test_default.py Lib/json/tes" has been rejected by the list moderator. The moderator gave the following reason for rejecting your request: "No reason given" Any questions or comments should be directed to the list administrator at: stackless-checkins-owner at stackless.com From buildbot at python.org Mon Jul 7 20:49:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 Jul 2008 18:49:22 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080707184922.A3FDE1E4008@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/744 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: facundo.batista BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Mon Jul 7 20:55:09 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 07 Jul 2008 18:55:09 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20080707185510.06EAC1E4008@bag.python.org> The Buildbot has detected a new failure of ppc Debian unstable 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ppc%20Debian%20unstable%203.0/builds/1196 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: facundo.batista BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From brett at python.org Mon Jul 7 21:00:45 2008 From: brett at python.org (Brett Cannon) Date: Mon, 7 Jul 2008 12:00:45 -0700 Subject: [Python-checkins] r64651 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py In-Reply-To: <1aff528e0807071008iecc05afib4f189d76a0a9f61@mail.gmail.com> References: <20080702020011.EE4671E4015@bag.python.org> <43aa6ff70807041822w51c1a93fu3867b1c7a87a9f5e@mail.gmail.com> <1aff528e0807051016l738ece23k198de8024983a03b@mail.gmail.com> <43aa6ff70807052001w6f5414c4ib4974771a708efe7@mail.gmail.com> <1aff528e0807071008iecc05afib4f189d76a0a9f61@mail.gmail.com> Message-ID: On Mon, Jul 7, 2008 at 10:08 AM, Nick Edds wrote: > For star imports, should I handle them in the same way that fix_imports > handles them, i.e. just give a warning and avoid fixing them? > I think so, especially in this situation where you would be importing even more modules and thus more names than in the other case handled by fix_imports. -Brett > On Sat, Jul 5, 2008 at 10:01 PM, Collin Winter wrote: >> >> On Sat, Jul 5, 2008 at 7:37 PM, Brett Cannon wrote: >> > On Sat, Jul 5, 2008 at 10:16 AM, Nick Edds wrote: >> >> Brett, >> >> >> >> If you want me to try and make this a fixer, I can give it a shot over >> >> the >> >> next few days because I'm already fairly comfortable with fixers in >> >> 2to3. I >> >> think based on the revision that was attempted and what I've read >> >> online, I >> >> have a pretty good idea of what needs to be done with this fixer. >> >> Hopefully >> >> I'll have the time to get this done by Monday or Tuesday if you'd like >> >> me to >> >> do it. >> >> >> > >> > Go for it! Basically the fixer needs to deal with the fact that urllib >> > and urllib2 now span multiple modules. So as Collin mentioned, you >> > probably should import all the modules they span across and then >> > update the references in the code appropriately. Trick is going to be >> > situations where the modules are imported as something else, e.g., >> > ``import urllib as spam`` since that won't work when the modules have >> > multiple names. But since I suspect that is a rare case it might just >> > have to be a warning or something. >> >> Agreed. I think we can just warn in this case, rather than wasting >> time catering to rarities like this. >> >> >> On Sat, Jul 5, 2008 at 11:58 AM, Brett Cannon wrote: >> >>> >> >>> On Fri, Jul 4, 2008 at 6:22 PM, Collin Winter >> >>> wrote: >> >>> > On Tue, Jul 1, 2008 at 7:00 PM, brett.cannon >> >>> > wrote: >> >>> >> Author: brett.cannon >> >>> >> Date: Wed Jul 2 04:00:11 2008 >> >>> >> New Revision: 64651 >> >>> >> >> >>> >> Log: >> >>> >> Update fix_imports for urllib. Had to change the fixer itself to >> >>> >> handle >> >>> >> modules >> >>> >> that are split across several renames in 3.0. >> >>> > >> >>> > So I realize that you already reverted this, but I thought to >> >>> > comment >> >>> > anyway: this implementation is almost certainly wrong. Any fixer for >> >>> > this particular PEP 3108 change will need to possibly insert extra >> >>> > imports to handle the new urllib.request/error/etc modules. I think >> >>> > this kind of thing should be broken into its own fixer, or at least >> >>> > its own distinct functionality inside of fix_imports. >> >>> > >> >>> >> >>> OK. I will see if I can figure out how this works at some point. >> >>> >> >>> > Nick Edds is working to speed up fix_imports by stripping out the >> >>> > member matching stuff, which we don't believe to be actually useful >> >>> > in >> >>> > the majority of module renamings. IMHO there should be two different >> >>> > mappings: one for bare-bones module renames (StringIO -> io), and a >> >>> > separate one for more complex renames, like urllib/urllib2. That >> >>> > will >> >>> > allow optimizing the former larger pattern while preserving >> >>> > flexibility for the rare cases in the latter. >> >>> > >> >>> >> >>> Makes sense. >> >>> >> >>> -Brett >> >> >> >> >> > > > From nedds at uchicago.edu Mon Jul 7 22:38:36 2008 From: nedds at uchicago.edu (Nick Edds) Date: Mon, 7 Jul 2008 15:38:36 -0500 Subject: [Python-checkins] r64651 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py In-Reply-To: References: <20080702020011.EE4671E4015@bag.python.org> <43aa6ff70807041822w51c1a93fu3867b1c7a87a9f5e@mail.gmail.com> <1aff528e0807051016l738ece23k198de8024983a03b@mail.gmail.com> <43aa6ff70807052001w6f5414c4ib4974771a708efe7@mail.gmail.com> <1aff528e0807071008iecc05afib4f189d76a0a9f61@mail.gmail.com> Message-ID: <1aff528e0807071338u8182820p38723e1a4ba7e694@mail.gmail.com> I just submitted a fix_urllib using bugs.python.org, so if you two could take a look at it and give me some feedback, that would be great. Just run 2to3 on temp.py to get an idea of the changes it makes. Nick On Mon, Jul 7, 2008 at 2:00 PM, Brett Cannon wrote: > On Mon, Jul 7, 2008 at 10:08 AM, Nick Edds wrote: > > For star imports, should I handle them in the same way that fix_imports > > handles them, i.e. just give a warning and avoid fixing them? > > > > I think so, especially in this situation where you would be importing > even more modules and thus more names than in the other case handled > by fix_imports. > > -Brett > > > > On Sat, Jul 5, 2008 at 10:01 PM, Collin Winter > wrote: > >> > >> On Sat, Jul 5, 2008 at 7:37 PM, Brett Cannon wrote: > >> > On Sat, Jul 5, 2008 at 10:16 AM, Nick Edds > wrote: > >> >> Brett, > >> >> > >> >> If you want me to try and make this a fixer, I can give it a shot > over > >> >> the > >> >> next few days because I'm already fairly comfortable with fixers in > >> >> 2to3. I > >> >> think based on the revision that was attempted and what I've read > >> >> online, I > >> >> have a pretty good idea of what needs to be done with this fixer. > >> >> Hopefully > >> >> I'll have the time to get this done by Monday or Tuesday if you'd > like > >> >> me to > >> >> do it. > >> >> > >> > > >> > Go for it! Basically the fixer needs to deal with the fact that urllib > >> > and urllib2 now span multiple modules. So as Collin mentioned, you > >> > probably should import all the modules they span across and then > >> > update the references in the code appropriately. Trick is going to be > >> > situations where the modules are imported as something else, e.g., > >> > ``import urllib as spam`` since that won't work when the modules have > >> > multiple names. But since I suspect that is a rare case it might just > >> > have to be a warning or something. > >> > >> Agreed. I think we can just warn in this case, rather than wasting > >> time catering to rarities like this. > >> > >> >> On Sat, Jul 5, 2008 at 11:58 AM, Brett Cannon > wrote: > >> >>> > >> >>> On Fri, Jul 4, 2008 at 6:22 PM, Collin Winter > >> >>> wrote: > >> >>> > On Tue, Jul 1, 2008 at 7:00 PM, brett.cannon > >> >>> > wrote: > >> >>> >> Author: brett.cannon > >> >>> >> Date: Wed Jul 2 04:00:11 2008 > >> >>> >> New Revision: 64651 > >> >>> >> > >> >>> >> Log: > >> >>> >> Update fix_imports for urllib. Had to change the fixer itself to > >> >>> >> handle > >> >>> >> modules > >> >>> >> that are split across several renames in 3.0. > >> >>> > > >> >>> > So I realize that you already reverted this, but I thought to > >> >>> > comment > >> >>> > anyway: this implementation is almost certainly wrong. Any fixer > for > >> >>> > this particular PEP 3108 change will need to possibly insert extra > >> >>> > imports to handle the new urllib.request/error/etc modules. I > think > >> >>> > this kind of thing should be broken into its own fixer, or at > least > >> >>> > its own distinct functionality inside of fix_imports. > >> >>> > > >> >>> > >> >>> OK. I will see if I can figure out how this works at some point. > >> >>> > >> >>> > Nick Edds is working to speed up fix_imports by stripping out the > >> >>> > member matching stuff, which we don't believe to be actually > useful > >> >>> > in > >> >>> > the majority of module renamings. IMHO there should be two > different > >> >>> > mappings: one for bare-bones module renames (StringIO -> io), and > a > >> >>> > separate one for more complex renames, like urllib/urllib2. That > >> >>> > will > >> >>> > allow optimizing the former larger pattern while preserving > >> >>> > flexibility for the rare cases in the latter. > >> >>> > > >> >>> > >> >>> Makes sense. > >> >>> > >> >>> -Brett > >> >> > >> >> > >> > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Tue Jul 8 09:05:23 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 8 Jul 2008 09:05:23 +0200 (CEST) Subject: [Python-checkins] r64788 - python/trunk/Doc/library/collections.rst Message-ID: <20080708070523.904D61E401B@bag.python.org> Author: georg.brandl Date: Tue Jul 8 09:05:23 2008 New Revision: 64788 Log: Add missing ABCs to list. Modified: python/trunk/Doc/library/collections.rst Modified: python/trunk/Doc/library/collections.rst ============================================================================== --- python/trunk/Doc/library/collections.rst (original) +++ python/trunk/Doc/library/collections.rst Tue Jul 8 09:05:23 2008 @@ -46,42 +46,50 @@ The collections module offers the following ABCs: -========================= ==================== ====================== ==================================================== -ABC Inherits Abstract Methods Mixin Methods -========================= ==================== ====================== ==================================================== -:class:`Container` ``__contains__`` -:class:`Hashable` ``__hash__`` -:class:`Iterable` ``__iter__`` -:class:`Iterator` :class:`Iterable` ``__next__`` ``__iter__`` -:class:`Sized` ``__len__`` - -:class:`Mapping` :class:`Sized`, ``__getitem__``, ``__contains__``, ``keys``, ``items``, ``values``, - :class:`Iterable`, ``__len__``. and ``get``, ``__eq__``, and ``__ne__`` - :class:`Container` ``__iter__`` - -:class:`MutableMapping` :class:`Mapping` ``__getitem__`` Inherited Mapping methods and - ``__setitem__``, ``pop``, ``popitem``, ``clear``, ``update``, - ``__delitem__``, and ``setdefault`` - ``__iter__``, and - ``__len__`` - -:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``. ``__iter__``, ``__reversed__``. - :class:`Iterable`, and ``__len__`` ``index``, and ``count`` - :class:`Container` - -:class:`MutableSequnce` :class:`Sequence` ``__getitem__`` Inherited Sequence methods and - ``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``, - ``insert``, ``remove``, and ``__iadd__`` - and ``__len__`` - -:class:`Set` :class:`Sized`, ``__len__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, - :class:`Iterable`, ``__iter__``, and ``__gt__``, ``__ge__``, ``__and__``, ``__or__`` - :class:`Container` ``__contains__`` ``__sub__``, ``__xor__``, and ``isdisjoint`` - -:class:`MutableSet` :class:`Set` ``add`` and Inherited Set methods and - ``discard`` ``clear``, ``pop``, ``remove``, ``__ior__``, - ``__iand__``, ``__ixor__``, and ``__isub__`` -========================= ==================== ====================== ==================================================== +========================= ===================== ====================== ==================================================== +ABC Inherits Abstract Methods Mixin Methods +========================= ===================== ====================== ==================================================== +:class:`Container` ``__contains__`` +:class:`Hashable` ``__hash__`` +:class:`Iterable` ``__iter__`` +:class:`Iterator` :class:`Iterable` ``__next__`` ``__iter__`` +:class:`Sized` ``__len__`` +:class:`Callable` ``__call__`` + +:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``. ``__iter__``, ``__reversed__``. + :class:`Iterable`, and ``__len__`` ``index``, and ``count`` + :class:`Container` + +:class:`MutableSequnce` :class:`Sequence` ``__getitem__`` Inherited Sequence methods and + ``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``, + ``insert``, ``remove``, and ``__iadd__`` + and ``__len__`` + +:class:`Set` :class:`Sized`, ``__len__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, + :class:`Iterable`, ``__iter__``, and ``__gt__``, ``__ge__``, ``__and__``, ``__or__`` + :class:`Container` ``__contains__`` ``__sub__``, ``__xor__``, and ``isdisjoint`` + +:class:`MutableSet` :class:`Set` ``add`` and Inherited Set methods and + ``discard`` ``clear``, ``pop``, ``remove``, ``__ior__``, + ``__iand__``, ``__ixor__``, and ``__isub__`` + +:class:`Mapping` :class:`Sized`, ``__getitem__``, ``__contains__``, ``keys``, ``items``, ``values``, + :class:`Iterable`, ``__len__``. and ``get``, ``__eq__``, and ``__ne__`` + :class:`Container` ``__iter__`` + +:class:`MutableMapping` :class:`Mapping` ``__getitem__`` Inherited Mapping methods and + ``__setitem__``, ``pop``, ``popitem``, ``clear``, ``update``, + ``__delitem__``, and ``setdefault`` + ``__iter__``, and + ``__len__`` + +:class:`MappingView` :class:`Sized` ``__len__`` +:class:`KeysView` :class:`MappingView`, ``__contains__``, + :class:`Set` ``__iter__`` +:class:`ItemsView` :class:`MappingView`, ``__contains__``, + :class:`Set` ``__iter__`` +:class:`ValuesView` :class:`MappingView` ``__contains__``, ``__iter__`` +========================= ===================== ====================== ==================================================== These ABCs allow us to ask classes or instances if they provide particular functionality, for example:: From buildbot at python.org Tue Jul 8 13:02:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 08 Jul 2008 11:02:43 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20080708110243.577C61E400B@bag.python.org> The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/1303 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith,josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Tue Jul 8 16:08:04 2008 From: python-checkins at python.org (nick.coghlan) Date: Tue, 8 Jul 2008 16:08:04 +0200 (CEST) Subject: [Python-checkins] r64791 - in python/trunk: Lib/test/test_exceptions.py Objects/exceptions.c Objects/object.c Message-ID: <20080708140804.EE95C1E4018@bag.python.org> Author: nick.coghlan Date: Tue Jul 8 16:08:04 2008 New Revision: 64791 Log: Issue 2517: Allow unicode messages in Exceptions again by correctly bypassing the instance dictionary when looking up __unicode__ on new-style classes Modified: python/trunk/Lib/test/test_exceptions.py python/trunk/Objects/exceptions.c python/trunk/Objects/object.c Modified: python/trunk/Lib/test/test_exceptions.py ============================================================================== --- python/trunk/Lib/test/test_exceptions.py (original) +++ python/trunk/Lib/test/test_exceptions.py Tue Jul 8 16:08:04 2008 @@ -342,6 +342,7 @@ self.failUnless(unicode(Exception)) self.failUnless(str(Exception('a'))) self.failUnless(unicode(Exception(u'a'))) + self.failUnless(unicode(Exception(u'\xe1'))) def test_main(): Modified: python/trunk/Objects/exceptions.c ============================================================================== --- python/trunk/Objects/exceptions.c (original) +++ python/trunk/Objects/exceptions.c Tue Jul 8 16:08:04 2008 @@ -117,6 +117,28 @@ return out; } +#ifdef Py_USING_UNICODE +static PyObject * +BaseException_unicode(PyBaseExceptionObject *self) +{ + PyObject *out; + + switch (PyTuple_GET_SIZE(self->args)) { + case 0: + out = PyUnicode_FromString(""); + break; + case 1: + out = PyObject_Unicode(PyTuple_GET_ITEM(self->args, 0)); + break; + default: + out = PyObject_Unicode(self->args); + break; + } + + return out; +} +#endif + static PyObject * BaseException_repr(PyBaseExceptionObject *self) { @@ -181,6 +203,9 @@ static PyMethodDef BaseException_methods[] = { {"__reduce__", (PyCFunction)BaseException_reduce, METH_NOARGS }, {"__setstate__", (PyCFunction)BaseException_setstate, METH_O }, +#ifdef Py_USING_UNICODE + {"__unicode__", (PyCFunction)BaseException_unicode, METH_NOARGS }, +#endif {NULL, NULL, 0, NULL}, }; Modified: python/trunk/Objects/object.c ============================================================================== --- python/trunk/Objects/object.c (original) +++ python/trunk/Objects/object.c Tue Jul 8 16:08:04 2008 @@ -458,6 +458,7 @@ PyObject *res; PyObject *func; PyObject *str; + int unicode_method_found = 0; static PyObject *unicodestr; if (v == NULL) { @@ -471,26 +472,46 @@ Py_INCREF(v); return v; } - /* XXX As soon as we have a tp_unicode slot, we should - check this before trying the __unicode__ - method. */ + + /* Try the __unicode__ method */ if (unicodestr == NULL) { unicodestr= PyString_InternFromString("__unicode__"); if (unicodestr == NULL) return NULL; } - func = PyObject_GetAttr(v, unicodestr); - if (func != NULL) { - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); + if (PyInstance_Check(v)) { + /* We're an instance of a classic class */ + /* Try __unicode__ from the instance -- alas we have no type */ + func = PyObject_GetAttr(v, unicodestr); + if (func != NULL) { + unicode_method_found = 1; + res = PyObject_CallFunctionObjArgs(func, NULL); + Py_DECREF(func); + } + else { + PyErr_Clear(); + } } else { - PyErr_Clear(); + /* Not a classic class instance, try __unicode__ from type */ + /* _PyType_Lookup doesn't create a reference */ + func = _PyType_Lookup(Py_TYPE(v), unicodestr); + if (func != NULL) { + unicode_method_found = 1; + res = PyObject_CallFunctionObjArgs(func, v, NULL); + } + else { + PyErr_Clear(); + } + } + + /* Didn't find __unicode__ */ + if (!unicode_method_found) { if (PyUnicode_Check(v)) { /* For a Unicode subtype that's didn't overwrite __unicode__, return a true Unicode object with the same data. */ return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(v), - PyUnicode_GET_SIZE(v)); + PyUnicode_GET_SIZE(v)); } if (PyString_CheckExact(v)) { Py_INCREF(v); @@ -503,6 +524,7 @@ res = PyObject_Repr(v); } } + if (res == NULL) return NULL; if (!PyUnicode_Check(res)) { From python-checkins at python.org Tue Jul 8 16:21:42 2008 From: python-checkins at python.org (nick.coghlan) Date: Tue, 8 Jul 2008 16:21:42 +0200 (CEST) Subject: [Python-checkins] r64793 - in python/trunk/Misc: ACKS NEWS Message-ID: <20080708142142.8F41C1E400B@bag.python.org> Author: nick.coghlan Date: Tue Jul 8 16:21:42 2008 New Revision: 64793 Log: Add missing NEWS and ACK entries for r64791 Modified: python/trunk/Misc/ACKS python/trunk/Misc/NEWS Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Tue Jul 8 16:21:42 2008 @@ -146,6 +146,7 @@ Matthew Dixon Cowles Christopher A. Craig Laura Creighton +Simon Cross Drew Csillag John Cugini Tom Culliton Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jul 8 16:21:42 2008 @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #2517: Allow unicode messages in Exceptions again by correctly + bypassing the instance dictionary when looking up __unicode__ on + new-style classes. + - Issue #3242: Fix a crash inside the print statement, if sys.stdout is set to a custom object whose write() method happens to install another file in sys.stdout. From buildbot at python.org Tue Jul 8 16:37:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 08 Jul 2008 14:37:10 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080708143710.C9DEE1E4025@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/741 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Tue Jul 8 16:45:44 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 8 Jul 2008 16:45:44 +0200 (CEST) Subject: [Python-checkins] r64794 - in doctools/trunk: CHANGES doc/ext/autodoc.rst sphinx/ext/autodoc.py Message-ID: <20080708144544.5596D1E400B@bag.python.org> Author: georg.brandl Date: Tue Jul 8 16:45:44 2008 New Revision: 64794 Log: automodule now supports module options. Modified: doctools/trunk/CHANGES doctools/trunk/doc/ext/autodoc.rst doctools/trunk/sphinx/ext/autodoc.py Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Tue Jul 8 16:45:44 2008 @@ -12,6 +12,9 @@ * `JSONHTMLBuilder` was added that similarily to `PickleHTMLBuilder` dumps the generated HTML into JSON files for further processing. +* The `automodule` directive now supports the ``synopsis``, + ``deprecated`` and ``platform`` options. + Release 0.4.1 (Jul 5, 2008) =========================== Modified: doctools/trunk/doc/ext/autodoc.rst ============================================================================== --- doctools/trunk/doc/ext/autodoc.rst (original) +++ doctools/trunk/doc/ext/autodoc.rst Tue Jul 8 16:45:44 2008 @@ -121,6 +121,11 @@ .. versionadded:: 0.4 + * :dir:`automodule` also recognizes the ``synopsis``, ``platform`` and + ``deprecated`` options that the standard :dir:`module` directive supports. + + .. versionadded:: 0.5 + .. note:: In an :dir:`automodule` directive with the ``members`` option set, only Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Tue Jul 8 16:45:44 2008 @@ -383,7 +383,15 @@ and 'staticmethod' or what result.append(indent + u'.. %s:: %s%s' % (directive, name_in_directive, args), '') - if what != 'module': + if what == 'module': + # Add some module-specific options + if options.synopsis: + result.append(indent + u' :synopsis: ' + options.synopsis, '') + if options.platform: + result.append(indent + u' :platform: ' + options.platform, '') + if options.deprecated: + result.append(indent + u' :deprecated:', '') + else: # Be explicit about the module, this is necessary since .. class:: doesn't # support a prepended module name result.append(indent + u' :module: %s' % mod, '') @@ -500,6 +508,9 @@ genopt.undoc_members = 'undoc-members' in options genopt.show_inheritance = 'show-inheritance' in options genopt.noindex = 'noindex' in options + genopt.synopsis = options.get('synopsis', '') + genopt.platform = options.get('platform', '') + genopt.deprecated = 'deprecated' in options filename_set = set() warnings, result = generate_rst(what, name, members, genopt, content, state.document, @@ -549,7 +560,8 @@ def setup(app): mod_options = {'members': members_option, 'undoc-members': directives.flag, - 'noindex': directives.flag} + 'noindex': directives.flag, 'synopsis': lambda x: x, + 'platform': lambda x: x, 'deprecated': directives.flag} cls_options = {'members': members_option, 'undoc-members': directives.flag, 'noindex': directives.flag, 'inherited-members': directives.flag, 'show-inheritance': directives.flag} From python-checkins at python.org Tue Jul 8 16:48:59 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 8 Jul 2008 16:48:59 +0200 (CEST) Subject: [Python-checkins] r64795 - in doctools/branches/0.4.x: CHANGES sphinx/builder.py sphinx/static/searchtools.js sphinx/templates/layout.html Message-ID: <20080708144859.38FBE1E400B@bag.python.org> Author: georg.brandl Date: Tue Jul 8 16:48:58 2008 New Revision: 64795 Log: Use correct filename extension in search. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/builder.py doctools/branches/0.4.x/sphinx/static/searchtools.js doctools/branches/0.4.x/sphinx/templates/layout.html Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Tue Jul 8 16:48:58 2008 @@ -1,3 +1,10 @@ +Release 0.4.2 (in development) +============================== + +* The JavaScript search now uses the correct file name suffix when + referring to found items. + + Release 0.4.1 (Jul 5, 2008) =========================== Modified: doctools/branches/0.4.x/sphinx/builder.py ============================================================================== --- doctools/branches/0.4.x/sphinx/builder.py (original) +++ doctools/branches/0.4.x/sphinx/builder.py Tue Jul 8 16:48:58 2008 @@ -377,6 +377,7 @@ docstitle = self.config.html_title, shorttitle = self.config.html_short_title, show_sphinx = self.config.html_show_sphinx, + file_suffix = self.config.html_file_suffix, rellinks = rellinks, builder = self.name, parents = [], Modified: doctools/branches/0.4.x/sphinx/static/searchtools.js ============================================================================== --- doctools/branches/0.4.x/sphinx/static/searchtools.js (original) +++ doctools/branches/0.4.x/sphinx/static/searchtools.js Tue Jul 8 16:48:58 2008 @@ -363,8 +363,10 @@ if (results.length) { var item = results.pop(); var listItem = $('
  • '); - listItem.append($('').attr('href', item[0] + '.html' + - highlightstring).html(item[1])); + listItem.append($('').attr( + 'href', + item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX + + highlightstring).html(item[1])); $.get('_sources/' + item[0] + '.txt', function(data) { listItem.append($.makeSearchSummary(data, searchwords, hlwords)); output.append(listItem); Modified: doctools/branches/0.4.x/sphinx/templates/layout.html ============================================================================== --- doctools/branches/0.4.x/sphinx/templates/layout.html (original) +++ doctools/branches/0.4.x/sphinx/templates/layout.html Tue Jul 8 16:48:58 2008 @@ -102,9 +102,10 @@ {%- if builder != 'htmlhelp' %} From buildbot at python.org Tue Jul 8 17:33:58 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 08 Jul 2008 15:33:58 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080708153358.D34D91E4026@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/426 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jul 8 17:46:45 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 08 Jul 2008 15:46:45 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080708154645.6C74A1E400B@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1228 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Tue Jul 8 20:46:53 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 8 Jul 2008 20:46:53 +0200 (CEST) Subject: [Python-checkins] r64803 - in doctools/branches/0.4.x: CHANGES sphinx/ext/autodoc.py Message-ID: <20080708184653.AA8CA1E400B@bag.python.org> Author: georg.brandl Date: Tue Jul 8 20:46:49 2008 New Revision: 64803 Log: Accept class options for modules too. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/ext/autodoc.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Tue Jul 8 20:46:49 2008 @@ -4,6 +4,9 @@ * The JavaScript search now uses the correct file name suffix when referring to found items. +* The automodule directive now accepts the ``inherited-members`` + and ``show-inheritance`` options again. + Release 0.4.1 (Jul 5, 2008) =========================== Modified: doctools/branches/0.4.x/sphinx/ext/autodoc.py ============================================================================== --- doctools/branches/0.4.x/sphinx/ext/autodoc.py (original) +++ doctools/branches/0.4.x/sphinx/ext/autodoc.py Tue Jul 8 20:46:49 2008 @@ -548,7 +548,8 @@ def setup(app): mod_options = {'members': members_option, 'undoc-members': directives.flag, - 'noindex': directives.flag} + 'noindex': directives.flag, 'inherited-members': directives.flag, + 'show-inheritance': directives.flag} cls_options = {'members': members_option, 'undoc-members': directives.flag, 'noindex': directives.flag, 'inherited-members': directives.flag, 'show-inheritance': directives.flag} From python-checkins at python.org Tue Jul 8 20:48:30 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 8 Jul 2008 20:48:30 +0200 (CEST) Subject: [Python-checkins] r64804 - in doctools/trunk: doc/_templates/index.html sphinx/builder.py sphinx/ext/autodoc.py sphinx/quickstart.py sphinx/static/searchtools.js sphinx/templates/layout.html Message-ID: <20080708184830.C3D391E400B@bag.python.org> Author: georg.brandl Date: Tue Jul 8 20:48:21 2008 New Revision: 64804 Log: Merged revisions 64733,64743,64755,64795,64803 via svnmerge from svn+ssh://pythondev at svn.python.org/doctools/branches/0.4.x ........ r64733 | georg.brandl | 2008-07-05 17:04:12 +0200 (Sat, 05 Jul 2008) | 2 lines Ask for common extensions in quickstart. ........ r64743 | georg.brandl | 2008-07-05 18:34:55 +0200 (Sat, 05 Jul 2008) | 2 lines Add a direct link to the examples page. ........ r64755 | georg.brandl | 2008-07-06 07:32:09 +0200 (Sun, 06 Jul 2008) | 2 lines Backport r64750. ........ r64795 | georg.brandl | 2008-07-08 16:48:58 +0200 (Tue, 08 Jul 2008) | 2 lines Use correct filename extension in search. ........ r64803 | georg.brandl | 2008-07-08 20:46:49 +0200 (Tue, 08 Jul 2008) | 2 lines Accept class options for modules too. ........ Modified: doctools/trunk/ (props changed) doctools/trunk/doc/_templates/index.html doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/ext/autodoc.py doctools/trunk/sphinx/quickstart.py doctools/trunk/sphinx/static/searchtools.js doctools/trunk/sphinx/templates/layout.html Modified: doctools/trunk/doc/_templates/index.html ============================================================================== --- doctools/trunk/doc/_templates/index.html (original) +++ doctools/trunk/doc/_templates/index.html Tue Jul 8 20:48:21 2008 @@ -44,6 +44,9 @@ You can also download a PDF version of the Sphinx documentation, generated from the LaTeX Sphinx produces.

    +

    Links to more documentation generated with Sphinx can be found on the + Projects using Sphinx page. +

    Documentation

    Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Tue Jul 8 20:48:21 2008 @@ -378,6 +378,7 @@ docstitle = self.config.html_title, shorttitle = self.config.html_short_title, show_sphinx = self.config.html_show_sphinx, + file_suffix = self.config.html_file_suffix, rellinks = rellinks, builder = self.name, parents = [], Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Tue Jul 8 20:48:21 2008 @@ -560,7 +560,8 @@ def setup(app): mod_options = {'members': members_option, 'undoc-members': directives.flag, - 'noindex': directives.flag, 'synopsis': lambda x: x, + 'noindex': directives.flag, 'inherited-members': directives.flag, + 'show-inheritance': directives.flag, 'synopsis': lambda x: x, 'platform': lambda x: x, 'deprecated': directives.flag} cls_options = {'members': members_option, 'undoc-members': directives.flag, 'noindex': directives.flag, 'inherited-members': directives.flag, Modified: doctools/trunk/sphinx/quickstart.py ============================================================================== --- doctools/trunk/sphinx/quickstart.py (original) +++ doctools/trunk/sphinx/quickstart.py Tue Jul 8 20:48:21 2008 @@ -42,7 +42,7 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -#extensions = [] +extensions = [%(extensions)s] # Add any paths that contain templates here, relative to this directory. templates_path = ['%(dot)stemplates'] @@ -397,6 +397,12 @@ do_prompt(d, 'master', 'Name of your master document (without suffix)', 'index') print ''' +Please indicate if you want to use one of the following Sphinx extensions:''' + do_prompt(d, 'ext_autodoc', 'autodoc: automatically insert docstrings ' + 'from modules (y/n)', 'n', boolean) + do_prompt(d, 'ext_doctest', 'doctest: automatically test code snippets ' + 'in doctest blocks (y/n)', 'n', boolean) + print ''' If you are under Unix, a Makefile can be generated for you so that you only have to run e.g. `make html' instead of invoking sphinx-build directly.''' @@ -407,6 +413,9 @@ d['year'] = time.strftime('%Y') d['now'] = time.asctime() d['underline'] = len(d['project']) * '=' + d['extensions'] = ', '.join( + repr('sphinx.ext.' + name) for name in ('autodoc', 'doctest') + if d['ext_' + name].upper() in ('Y', 'YES')) if not path.isdir(d['path']): mkdir_p(d['path']) Modified: doctools/trunk/sphinx/static/searchtools.js ============================================================================== --- doctools/trunk/sphinx/static/searchtools.js (original) +++ doctools/trunk/sphinx/static/searchtools.js Tue Jul 8 20:48:21 2008 @@ -363,8 +363,10 @@ if (results.length) { var item = results.pop(); var listItem = $('
  • '); - listItem.append($('').attr('href', item[0] + '.html' + - highlightstring).html(item[1])); + listItem.append($('').attr( + 'href', + item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX + + highlightstring).html(item[1])); $.get('_sources/' + item[0] + '.txt', function(data) { listItem.append($.makeSearchSummary(data, searchwords, hlwords)); output.append(listItem); Modified: doctools/trunk/sphinx/templates/layout.html ============================================================================== --- doctools/trunk/sphinx/templates/layout.html (original) +++ doctools/trunk/sphinx/templates/layout.html Tue Jul 8 20:48:21 2008 @@ -102,9 +102,10 @@ {%- if builder != 'htmlhelp' %} From python-checkins at python.org Tue Jul 8 21:39:33 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 8 Jul 2008 21:39:33 +0200 (CEST) Subject: [Python-checkins] r64808 - in doctools/branches/0.4.x: CHANGES sphinx/builder.py sphinx/environment.py Message-ID: <20080708193933.A6E761E400B@bag.python.org> Author: georg.brandl Date: Tue Jul 8 21:39:33 2008 New Revision: 64808 Log: Allow relocation of source and doctree dir. Modified: doctools/branches/0.4.x/CHANGES doctools/branches/0.4.x/sphinx/builder.py doctools/branches/0.4.x/sphinx/environment.py Modified: doctools/branches/0.4.x/CHANGES ============================================================================== --- doctools/branches/0.4.x/CHANGES (original) +++ doctools/branches/0.4.x/CHANGES Tue Jul 8 21:39:33 2008 @@ -7,6 +7,9 @@ * The automodule directive now accepts the ``inherited-members`` and ``show-inheritance`` options again. +* You can now rebuild the docs normally after relocating the source + and/or doctree directory. + Release 0.4.1 (Jul 5, 2008) =========================== Modified: doctools/branches/0.4.x/sphinx/builder.py ============================================================================== --- doctools/branches/0.4.x/sphinx/builder.py (original) +++ doctools/branches/0.4.x/sphinx/builder.py Tue Jul 8 21:39:33 2008 @@ -211,7 +211,7 @@ warnings = [] self.env.set_warnfunc(warnings.append) self.info(bold('updating environment: '), nonl=1) - iterator = self.env.update(self.config, self.app) + iterator = self.env.update(self.config, self.srcdir, self.doctreedir, self.app) # the first item in the iterator is a summary message self.info(iterator.next()) for docname in self.status_iterator(iterator, 'reading... ', purple): Modified: doctools/branches/0.4.x/sphinx/environment.py ============================================================================== --- doctools/branches/0.4.x/sphinx/environment.py (original) +++ doctools/branches/0.4.x/sphinx/environment.py Tue Jul 8 21:39:33 2008 @@ -396,7 +396,7 @@ return added, changed, removed - def update(self, config, app=None): + def update(self, config, srcdir, doctreedir, app=None): """(Re-)read all files new or changed since last update. Yields a summary and then docnames as it processes them. Store all environment docnames in the canonical format (ie using SEP as a separator in place of @@ -416,6 +416,9 @@ break else: msg = '' + # the source and doctree directories may have been relocated + self.srcdir = srcdir + self.doctreedir = doctreedir self.find_files(config) added, changed, removed = self.get_outdated_files(config_changed) msg += '%s added, %s changed, %s removed' % (len(added), len(changed), From helen at nstnetwork.com Wed Jul 9 16:37:23 2008 From: helen at nstnetwork.com (helen at nstnetwork.com) Date: Wed, 9 Jul 2008 22:37:23 +0800 Subject: [Python-checkins] Sell Cisco Systems equipment items Message-ID: <20080709154042.AE9E91A8F66@Linux-Mail.com> Hello, We have following original Cisco,Card,GBIC/SFP,WIC,cables items for sale If you are interested, pls feel free to contact me. example of the products: CWDM-SFP-1G 38dB (Ultra long-haul)--1510nm,1530nm,1550nm,1570nm,1590nm,1610nm WS-G5483, GLC-SX-MM SFP-GE-L WS-G5487, WS-G5484, WS-G5486, GLC-SX-MM, GLC-LH-SM, GLC-ZX-SM, GLC-T, ...... NM-2FE2W-T1, NM-2FE2W-E1, NM-2FE2W-V2, WIC-1T, WIC-2T, WIC-2A/S, WIC-1B/ST, WIC-1ENET, VWIC-1MFT-T1, VWIC-1MFT-E1, VWIC-2MFT-T1, VWIC-2MFT-E1, VWIC-1MFT-G703, VWIC-2MFT-G703, VWIC-1MFT-T1-DI, VWIC-2MFT-T1-DI, NM-1E, NM-4E, ...... WS-C2950-24, WS-C2950T-24, WS-C2950G-24-EI, WS-C2950G-48-EI, ...... CONSOLE CABLE, CAB-STACK-1M/3M, CAB-V35MT, CAB-V35FC, CAB-SS-V.35MT, CAB-SS-V.35FC, CAB-SS-232MT, CAB-SS-232FC, CAB-232MT, CAB-232FC, CAB-SS-X21MT, CAB-SS-X21FC, CAB-X21MT, ...... MEM-npe400-512MB, MEM-3660-128mb, MEM2600-32D, MEM2600-16FS, MEM2600XM-64D, MEM-S1-128MB, MEM-S2-256MB, MEM-S2-512MB, MEM-MSFC-128MB, MEM2801-256D, MEM3800-256D, MEM3800-512, MEM3745-256D, MEM1841-256D, MEM180X-256D, WS-X6K-MSFC2-KIT, .... and so on. Regards Helen.Zhou NEWSTAR NETWORKING TECHNOLOGY www.nstnetwork.com MSN: Helen at nstnetwork.com Email: Helen at nstnetwork.com AOL helenxuezhou Icq 320-880-606 From python-checkins at python.org Thu Jul 10 11:31:08 2008 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 10 Jul 2008 11:31:08 +0200 (CEST) Subject: [Python-checkins] r64835 - in python/trunk/Lib: fractions.py test/test_fractions.py Message-ID: <20080710093108.9D3A01E4028@bag.python.org> Author: raymond.hettinger Date: Thu Jul 10 11:31:08 2008 New Revision: 64835 Log: Issue 3287: Raise correct exception for float inputs. Modified: python/trunk/Lib/fractions.py python/trunk/Lib/test/test_fractions.py Modified: python/trunk/Lib/fractions.py ============================================================================== --- python/trunk/Lib/fractions.py (original) +++ python/trunk/Lib/fractions.py Thu Jul 10 11:31:08 2008 @@ -96,9 +96,11 @@ if denominator == 0: raise ZeroDivisionError('Fraction(%s, 0)' % numerator) - - numerator = numerator.__index__() - denominator = denominator.__index__() + try: + numerator = numerator.__index__() + denominator = denominator.__index__() + except AttributeError: + raise TypeError('Numerator and denominator must support __index__.') g = gcd(numerator, denominator) self._numerator = numerator // g self._denominator = denominator // g Modified: python/trunk/Lib/test/test_fractions.py ============================================================================== --- python/trunk/Lib/test/test_fractions.py (original) +++ python/trunk/Lib/test/test_fractions.py Thu Jul 10 11:31:08 2008 @@ -62,11 +62,11 @@ self.assertRaisesMessage(ZeroDivisionError, "Fraction(12, 0)", F, 12, 0) - self.assertRaises(AttributeError, F, 1.5) - self.assertRaises(AttributeError, F, 1.5 + 3j) + self.assertRaises(TypeError, F, 1.5) + self.assertRaises(TypeError, F, 1.5 + 3j) - self.assertRaises(AttributeError, F, F(1, 2), 3) - self.assertRaises(AttributeError, F, "3/2", 3) + self.assertRaises(TypeError, F, F(1, 2), 3) + self.assertRaises(TypeError, F, "3/2", 3) def testFromString(self): self.assertEquals((5, 1), _components(F("5"))) From ncoghlan at gmail.com Thu Jul 10 12:14:17 2008 From: ncoghlan at gmail.com (Nick Coghlan) Date: Thu, 10 Jul 2008 20:14:17 +1000 Subject: [Python-checkins] r64835 - in python/trunk/Lib: fractions.py test/test_fractions.py In-Reply-To: <20080710093108.9D3A01E4028@bag.python.org> References: <20080710093108.9D3A01E4028@bag.python.org> Message-ID: <4875E0F9.8090501@gmail.com> raymond.hettinger wrote: > Author: raymond.hettinger > Date: Thu Jul 10 11:31:08 2008 > New Revision: 64835 > > Log: > Issue 3287: Raise correct exception for float inputs. > > Modified: > python/trunk/Lib/fractions.py > python/trunk/Lib/test/test_fractions.py > > Modified: python/trunk/Lib/fractions.py > ============================================================================== > --- python/trunk/Lib/fractions.py (original) > +++ python/trunk/Lib/fractions.py Thu Jul 10 11:31:08 2008 > @@ -96,9 +96,11 @@ > > if denominator == 0: > raise ZeroDivisionError('Fraction(%s, 0)' % numerator) > - > - numerator = numerator.__index__() > - denominator = denominator.__index__() > + try: > + numerator = numerator.__index__() > + denominator = denominator.__index__() > + except AttributeError: > + raise TypeError('Numerator and denominator must support __index__.') Any particular reason this code is calling __index__ directly instead of using operator.index() which will give the TypeError automatically? Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org From python-checkins at python.org Thu Jul 10 12:28:42 2008 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 10 Jul 2008 12:28:42 +0200 (CEST) Subject: [Python-checkins] r64836 - python/trunk/Lib/fractions.py Message-ID: <20080710102842.197081E400D@bag.python.org> Author: raymond.hettinger Date: Thu Jul 10 12:28:41 2008 New Revision: 64836 Log: Use operator.index() instead of n.__index__(). Modified: python/trunk/Lib/fractions.py Modified: python/trunk/Lib/fractions.py ============================================================================== --- python/trunk/Lib/fractions.py (original) +++ python/trunk/Lib/fractions.py Thu Jul 10 12:28:41 2008 @@ -96,11 +96,8 @@ if denominator == 0: raise ZeroDivisionError('Fraction(%s, 0)' % numerator) - try: - numerator = numerator.__index__() - denominator = denominator.__index__() - except AttributeError: - raise TypeError('Numerator and denominator must support __index__.') + numerator = operator.index(numerator) + denominator = operator.index(denominator) g = gcd(numerator, denominator) self._numerator = numerator // g self._denominator = denominator // g From buildbot at python.org Thu Jul 10 12:43:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 10 Jul 2008 10:43:43 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080710104343.3F5F21E400D@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/743 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Thu Jul 10 15:43:27 2008 From: python-checkins at python.org (robert.schuppenies) Date: Thu, 10 Jul 2008 15:43:27 +0200 (CEST) Subject: [Python-checkins] r64842 - in python/trunk: Lib/test/test_sys.py Python/sysmodule.c Message-ID: <20080710134327.20D111E400D@bag.python.org> Author: robert.schuppenies Date: Thu Jul 10 15:43:26 2008 New Revision: 64842 Log: Fixed Issue3122 and extended sys.getsizeof tests for built-in types. Modified: python/trunk/Lib/test/test_sys.py python/trunk/Python/sysmodule.c Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Thu Jul 10 15:43:26 2008 @@ -398,8 +398,10 @@ # due to missing size_t information from struct, it is assumed that # sizeof(Py_ssize_t) = sizeof(void*) self.header = 'PP' + self.vheader = self.header + 'P' if hasattr(sys, "gettotalrefcount"): self.header += '2P' + self.vheader += '2P' self.file = open(test.test_support.TESTFN, 'wb') def tearDown(self): @@ -424,44 +426,90 @@ """ return struct.calcsize(fmt + '0P') - def test_standardtypes(self): + def test_objecttypes(self): + # check all types defined in Objects/ h = self.header + vh = self.vheader size = self.calcsize + check = self.check_sizeof # bool - self.check_sizeof(True, size(h + 'l')) + check(True, size(h + 'l')) # buffer - self.check_sizeof(buffer(''), size(h + '2P2Pil')) + check(buffer(''), size(h + '2P2Pil')) + # builtin_function_or_method + check(len, size(h + '3P')) # cell def get_cell(): x = 42 def inner(): return x return inner - self.check_sizeof(get_cell().func_closure[0], size(h + 'P')) - # old-style class + check(get_cell().func_closure[0], size(h + 'P')) + # classobj (old-style class) class class_oldstyle(): def method(): pass - self.check_sizeof(class_oldstyle, size(h + '6P')) - # instance - self.check_sizeof(class_oldstyle(), size(h + '3P')) - # method - self.check_sizeof(class_oldstyle().method, size(h + '4P')) - # code - self.check_sizeof(get_cell().func_code, size(h + '4i8Pi2P')) + check(class_oldstyle, size(h + '6P')) + # instance (old-style class) + check(class_oldstyle(), size(h + '3P')) + # instancemethod (old-style class) + check(class_oldstyle().method, size(h + '4P')) # complex - self.check_sizeof(complex(0,1), size(h + '2d')) + check(complex(0,1), size(h + '2d')) + # code + check(get_cell().func_code, size(h + '4i8Pi2P')) + # BaseException + check(BaseException(), size(h + '3P')) + # UnicodeEncodeError + check(UnicodeEncodeError("", u"", 0, 0, ""), size(h + '5P2PP')) + # UnicodeDecodeError + check(UnicodeDecodeError("", "", 0, 0, ""), size(h + '5P2PP')) + # UnicodeTranslateError + check(UnicodeTranslateError(u"", 0, 1, ""), size(h + '5P2PP')) + # method_descriptor (descriptor object) + check(str.lower, size(h + '2PP')) + # classmethod_descriptor (descriptor object) + # XXX + # member_descriptor (descriptor object) + import datetime + check(datetime.timedelta.days, size(h + '2PP')) + # getset_descriptor (descriptor object) + import __builtin__ + check(__builtin__.file.closed, size(h + '2PP')) + # wrapper_descriptor (descriptor object) + check(int.__add__, size(h + '2P2P')) + # dictproxy + class C(object): pass + check(C.__dict__, size(h + 'P')) + # method-wrapper (descriptor object) + check({}.__iter__, size(h + '2P')) + # dict + check({}, size(h + '3P2P') + 8*size('P2P')) + x = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8} + check(x, size(h + '3P2P') + (8+16)*size('P2P')) + # dictionary-keyiterator + check({}.iterkeys(), size(h + 'P2PPP')) + # dictionary-valueiterator + check({}.itervalues(), size(h + 'P2PPP')) + # dictionary-itemiterator + check({}.iteritems(), size(h + 'P2PPP')) + # ellipses + check(Ellipsis, size(h + '')) + # EncodingMap + import codecs, encodings.iso8859_3 + x = codecs.charmap_build(encodings.iso8859_3.decoding_table) + check(x, size(h + '32B2iB')) # enumerate - self.check_sizeof(enumerate([]), size(h + 'l3P')) - # reverse - self.check_sizeof(reversed(''), size(h + 'PP')) + check(enumerate([]), size(h + 'l3P')) # file - self.check_sizeof(self.file, size(h + '4P2i4P3i3Pi')) + check(self.file, size(h + '4P2i4P3i3Pi')) # float - self.check_sizeof(float(0), size(h + 'd')) + check(float(0), size(h + 'd')) + # sys.floatinfo + check(sys.float_info, size(vh) + self.P * len(sys.float_info)) # function def func(): pass - self.check_sizeof(func, size(h + '9P')) + check(func, size(h + '9P')) class c(): @staticmethod def foo(): @@ -470,40 +518,82 @@ def bar(cls): pass # staticmethod - self.check_sizeof(foo, size(h + 'P')) + check(foo, size(h + 'P')) # classmethod - self.check_sizeof(bar, size(h + 'P')) + check(bar, size(h + 'P')) # generator def get_gen(): yield 1 - self.check_sizeof(get_gen(), size(h + 'Pi2P')) + check(get_gen(), size(h + 'Pi2P')) # integer - self.check_sizeof(1, size(h + 'l')) - # builtin_function_or_method - self.check_sizeof(abs, size(h + '3P')) + check(1, size(h + 'l')) + check(100, size(h + 'l')) + # iterator + check(iter('abc'), size(h + 'lP')) + # callable-iterator + import re + check(re.finditer('',''), size(h + '2P')) + # list + samples = [[], [1,2,3], ['1', '2', '3']] + for sample in samples: + check(sample, size(vh + 'PP') + len(sample)*self.P) + # sortwrapper (list) + # XXX + # cmpwrapper (list) + # XXX + # listiterator (list) + check(iter([]), size(h + 'lP')) + # listreverseiterator (list) + check(reversed([]), size(h + 'lP')) + # long + check(0L, size(vh + 'H')) + check(1L, size(vh + 'H')) + check(-1L, size(vh + 'H')) + check(32768L, size(vh + 'H') + self.H) + check(32768L*32768L-1, size(vh + 'H') + self.H) + check(32768L*32768L, size(vh + 'H') + 2*self.H) # module - self.check_sizeof(unittest, size(h + 'P')) - # xrange - self.check_sizeof(xrange(1), size(h + '3l')) + check(unittest, size(h + 'P')) + # None + check(None, size(h + '')) + # object + check(object(), size(h + '')) + # property (descriptor object) + class C(object): + def getx(self): return self.__x + def setx(self, value): self.__x = value + def delx(self): del self.__x + x = property(getx, setx, delx, "") + check(x, size(h + '4Pi')) + # PyCObject + # XXX + # rangeiterator + check(iter(xrange(1)), size(h + '4l')) + # reverse + check(reversed(''), size(h + 'PP')) # slice - self.check_sizeof(slice(0), size(h + '3P')) - - h += 'P' - # new-style class - class class_newstyle(object): - def method(): - pass - # type (PyTypeObject + PyNumberMethods + PyMappingMethods + - # PySequenceMethods + PyBufferProcs) - self.check_sizeof(class_newstyle, size('P2P15Pl4PP9PP11PI') +\ - size(h + '41P 10P 3P 6P')) - - def test_specialtypes(self): - h = self.header - size = self.calcsize - # dict - self.check_sizeof({}, size(h + '3P2P') + 8*size('P2P')) - longdict = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8} - self.check_sizeof(longdict, size(h + '3P2P') + (8+16)*size('P2P')) + check(slice(1), size(h + '3P')) + # str + check('', size(vh + 'lic')) + check('abc', size(vh + 'lic') + 3*self.c) + # super + check(super(int), size(h + '3P')) + # tuple + check((), size(vh)) + check((1,2,3), size(vh) + 3*self.P) + # tupleiterator + check(iter(()), size(h + 'lP')) + # type + # (PyTypeObject + PyNumberMethods + PyMappingMethods + + # PySequenceMethods + PyBufferProcs) + s = size('P2P15Pl4PP9PP11PI') + size(vh + '41P 10P 3P 6P') + class newstyleclass(object): + pass + check(newstyleclass, s) + # builtin type + check(int, s) + # NotImplementedType + import types + check(types.NotImplementedType, s) # unicode usize = len(u'\0'.encode('unicode-internal')) samples = [u'', u'1'*100] @@ -511,8 +601,7 @@ # has been cached for s in samples: basicsize = size(h + 'PPlP') + usize * (len(s) + 1) - self.check_sizeof(s, basicsize,\ - size2=basicsize + sys.getsizeof(str(s))) + check(s, basicsize, size2=basicsize + sys.getsizeof(str(s))) # XXX trigger caching encoded version as Python string s = samples[1] try: @@ -520,25 +609,41 @@ except AttributeError: pass finally: - self.check_sizeof(s, basicsize + sys.getsizeof(str(s))) + check(s, basicsize + sys.getsizeof(str(s))) + # weakref + import weakref + check(weakref.ref(int), size(h + '2Pl2P')) + # weakproxy + # XXX + # weakcallableproxy + check(weakref.proxy(int), size(h + '2Pl2P')) + # xrange + check(xrange(1), size(h + '3l')) + check(xrange(66000), size(h + '3l')) - h += 'P' - # list - self.check_sizeof([], size(h + 'PP')) - self.check_sizeof([1, 2, 3], size(h + 'PP') + 3*self.P) - # long - self.check_sizeof(0L, size(h + 'H')) - self.check_sizeof(1L, size(h + 'H')) - self.check_sizeof(-1L, size(h + 'H')) - self.check_sizeof(32768L, size(h + 'H') + self.H) - self.check_sizeof(32768L*32768L-1, size(h + 'H') + self.H) - self.check_sizeof(32768L*32768L, size(h + 'H') + 2*self.H) - # string - self.check_sizeof('', size(h + 'lic')) - self.check_sizeof('abc', size(h + 'lic') + 3*self.c) - # tuple - self.check_sizeof((), size(h)) - self.check_sizeof((1,2,3), size(h) + 3*self.P) + def test_pythontypes(self): + # check all types defined in Python/ + h = self.header + vh = self.vheader + size = self.calcsize + check = self.check_sizeof + # _ast.AST + import _ast + check(_ast.AST(), size(h + '')) + # imp.NullImporter + import imp + check(imp.NullImporter(self.file.name), size(h + '')) + try: + raise TypeError + except TypeError: + tb = sys.exc_info()[2] + # traceback + if tb != None: + check(tb, size(h + '2P2i')) + # symtable entry + # XXX + # sys.flags + check(sys.flags, size(vh) + self.P * len(sys.flags)) def test_main(): Modified: python/trunk/Python/sysmodule.c ============================================================================== --- python/trunk/Python/sysmodule.c (original) +++ python/trunk/Python/sysmodule.c Thu Jul 10 15:43:26 2008 @@ -651,8 +651,15 @@ return NULL; } - /* Type objects */ - if (PyType_Check(args)){ + /* Make sure the type is initialized. float gets initialized late */ + if (PyType_Ready(Py_TYPE(args)) < 0) + return NULL; + + /* Instance of old-style class */ + if (PyInstance_Check(args)) + return PyInt_FromSsize_t(PyInstance_Type.tp_basicsize); + /* all other objects */ + else { PyObject *method = _PyType_Lookup(Py_TYPE(args), str__sizeof__); if (method == NULL) { @@ -662,15 +669,7 @@ return NULL; } return PyObject_CallFunctionObjArgs(method, args, NULL); - } - /* Instance of old-style classes */ - else if (PyInstance_Check(args)) - return PyInt_FromSsize_t(PyInstance_Type.tp_basicsize); - /* Old-style classes */ - else if (PyClass_Check(args)) - return PyInt_FromSsize_t(PyClass_Type.tp_basicsize); - else - return PyObject_CallMethod(args, "__sizeof__", NULL); + } } PyDoc_STRVAR(getsizeof_doc, From python-checkins at python.org Thu Jul 10 15:59:59 2008 From: python-checkins at python.org (armin.ronacher) Date: Thu, 10 Jul 2008 15:59:59 +0200 (CEST) Subject: [Python-checkins] r64844 - in doctools/trunk: CHANGES sphinx/builder.py sphinx/ext/autodoc.py sphinx/htmlwriter.py Message-ID: <20080710135959.89C821E400D@bag.python.org> Author: armin.ronacher Date: Thu Jul 10 15:59:59 2008 New Revision: 64844 Log: Fixed docstring dedenting and made the html writer more configurable in the sense that it doesn't change behavior based on the builder name any longer. Modified: doctools/trunk/CHANGES doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/ext/autodoc.py doctools/trunk/sphinx/htmlwriter.py Modified: doctools/trunk/CHANGES ============================================================================== --- doctools/trunk/CHANGES (original) +++ doctools/trunk/CHANGES Thu Jul 10 15:59:59 2008 @@ -15,6 +15,10 @@ * The `automodule` directive now supports the ``synopsis``, ``deprecated`` and ``platform`` options. +* The HTML builders have two additional attributes now that can be used + to disable the anchor-link creation after headlines and definition + links. EXPERIMENTAL + Release 0.4.1 (Jul 5, 2008) =========================== Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Thu Jul 10 15:59:59 2008 @@ -301,6 +301,8 @@ supported_image_types = ['image/svg+xml', 'image/png', 'image/gif', 'image/jpeg'] searchindex_filename = 'searchindex.json' + add_header_links = True + add_definition_links = True def init(self): """Load templates.""" @@ -810,6 +812,10 @@ copysource = False supported_image_types = ['image/png', 'image/gif', 'image/jpeg'] + # don't add links + add_header_links = False + add_definition_links = False + def init(self): StandaloneHTMLBuilder.init(self) # the output files for HTML help must be .html only Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Thu Jul 10 15:59:59 2008 @@ -12,6 +12,7 @@ """ import re +import sys import types import inspect import textwrap @@ -158,17 +159,25 @@ of nested_parse().) An empty line is added to act as a separator between this docstring and following content. """ - if not s or s.isspace(): - return [''] - s = s.expandtabs() - nl = s.rstrip().find('\n') - if nl == -1: - # Only one line... - return [s.strip(), ''] - # The first line may be indented differently... - firstline = s[:nl].strip() - otherlines = textwrap.dedent(s[nl+1:]) - return [firstline] + otherlines.splitlines() + [''] + lines = s.expandtabs().splitlines() + # Find minimum indentation of any non-blank lines after first line. + margin = sys.maxint + for line in lines[1:]: + content = len(line.lstrip()) + if content: + indent = len(line) - content + margin = min(margin, indent) + # Remove indentation. + if lines: + lines[0] = lines[0].lstrip() + if margin < sys.maxint: + for i in range(1, len(lines)): lines[i] = lines[i][margin:] + # Remove any trailing or leading blank lines. + while lines and not lines[-1]: + lines.pop() + while lines and not lines[0]: + lines.pop(0) + return lines def get_module_charset(module): @@ -441,8 +450,8 @@ # unqualified :members: given if what == 'module': # for implicit module members, check __module__ to avoid documenting - # imported objects - members_check_module = True + # imported objects if __all__ is not defined + members_check_module = not hasattr(todoc, '__all__') all_members = inspect.getmembers(todoc) else: if options.inherited_members: Modified: doctools/trunk/sphinx/htmlwriter.py ============================================================================== --- doctools/trunk/sphinx/htmlwriter.py (original) +++ doctools/trunk/sphinx/htmlwriter.py Thu Jul 10 15:59:59 2008 @@ -71,7 +71,7 @@ if node.parent['desctype'] in ('class', 'exception'): self.body.append('%s ' % node.parent['desctype']) def depart_desc_signature(self, node): - if node['ids'] and self.builder.name != 'htmlhelp': + if node['ids'] and self.builder.add_definition_links: self.body.append(u'\u00B6') self.body.append('\n') @@ -342,7 +342,7 @@ def depart_title(self, node): close_tag = self.context[-1] - if self.builder.name != 'htmlhelp' and \ + if self.builder.add_header_links and \ (close_tag.startswith(' Author: raymond.hettinger Date: Thu Jul 10 16:03:19 2008 New Revision: 64845 Log: Issue 3301: Bisect functions behaved badly when lo was negative. Modified: python/trunk/Lib/bisect.py python/trunk/Lib/test/test_bisect.py python/trunk/Misc/NEWS python/trunk/Modules/_bisectmodule.c Modified: python/trunk/Lib/bisect.py ============================================================================== --- python/trunk/Lib/bisect.py (original) +++ python/trunk/Lib/bisect.py Thu Jul 10 16:03:19 2008 @@ -9,6 +9,8 @@ slice of a to be searched. """ + if lo < 0: + raise ValueError('lo must be non-negative') if hi is None: hi = len(a) while lo < hi: @@ -30,6 +32,8 @@ slice of a to be searched. """ + if lo < 0: + raise ValueError('lo must be non-negative') if hi is None: hi = len(a) while lo < hi: @@ -49,6 +53,8 @@ slice of a to be searched. """ + if lo < 0: + raise ValueError('lo must be non-negative') if hi is None: hi = len(a) while lo < hi: @@ -69,6 +75,8 @@ slice of a to be searched. """ + if lo < 0: + raise ValueError('lo must be non-negative') if hi is None: hi = len(a) while lo < hi: Modified: python/trunk/Lib/test/test_bisect.py ============================================================================== --- python/trunk/Lib/test/test_bisect.py (original) +++ python/trunk/Lib/test/test_bisect.py Thu Jul 10 16:03:19 2008 @@ -114,6 +114,14 @@ self.assertEqual(func(data, elem), expected) self.assertEqual(func(UserList(data), elem), expected) + def test_negative_lo(self): + # Issue 3301 + mod = self.module + self.assertRaises(ValueError, mod.bisect_left, [1, 2, 3], 5, -1, 3), + self.assertRaises(ValueError, mod.bisect_right, [1, 2, 3], 5, -1, 3), + self.assertRaises(ValueError, mod.insort_left, [1, 2, 3], 5, -1, 3), + self.assertRaises(ValueError, mod.insort_right, [1, 2, 3], 5, -1, 3), + def test_random(self, n=25): from random import randrange for i in xrange(n): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jul 10 16:03:19 2008 @@ -10,6 +10,7 @@ Core and Builtins ----------------- + - Issue #2517: Allow unicode messages in Exceptions again by correctly bypassing the instance dictionary when looking up __unicode__ on new-style classes. @@ -40,6 +41,8 @@ Library ------- +- Issue #3301: Bisect module modules behaved badly when lo was negative. + - Issue #839496: SimpleHTTPServer used to open text files in text mode. This is both unnecessary (HTTP allows text content to be sent in several forms) and wrong because the actual transmitted size could differ with the Modified: python/trunk/Modules/_bisectmodule.c ============================================================================== --- python/trunk/Modules/_bisectmodule.c (original) +++ python/trunk/Modules/_bisectmodule.c Thu Jul 10 16:03:19 2008 @@ -11,6 +11,10 @@ PyObject *litem; Py_ssize_t mid, res; + if (lo < 0) { + PyErr_SetString(PyExc_ValueError, "lo must be non-negative"); + return -1; + } if (hi == -1) { hi = PySequence_Size(list); if (hi < 0) @@ -108,6 +112,10 @@ PyObject *litem; int mid, res; + if (lo < 0) { + PyErr_SetString(PyExc_ValueError, "lo must be non-negative"); + return -1; + } if (hi == -1) { hi = PySequence_Size(list); if (hi < 0) From buildbot at python.org Thu Jul 10 16:16:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 10 Jul 2008 14:16:03 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080710141603.D75771E4021@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/745 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Thu Jul 10 16:34:57 2008 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 10 Jul 2008 16:34:57 +0200 (CEST) Subject: [Python-checkins] r64846 - in python/trunk: Lib/fractions.py Lib/test/test_fractions.py Misc/NEWS Message-ID: <20080710143457.B26761E400D@bag.python.org> Author: raymond.hettinger Date: Thu Jul 10 16:34:57 2008 New Revision: 64846 Log: Issue 3285: Fractions from_float() and from_decimal() accept Integral arguments. Modified: python/trunk/Lib/fractions.py python/trunk/Lib/test/test_fractions.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/fractions.py ============================================================================== --- python/trunk/Lib/fractions.py (original) +++ python/trunk/Lib/fractions.py Thu Jul 10 16:34:57 2008 @@ -110,7 +110,9 @@ Beware that Fraction.from_float(0.3) != Fraction(3, 10). """ - if not isinstance(f, float): + if isinstance(f, numbers.Integral): + f = float(f) + elif not isinstance(f, float): raise TypeError("%s.from_float() only takes floats, not %r (%s)" % (cls.__name__, f, type(f).__name__)) if math.isnan(f) or math.isinf(f): @@ -121,7 +123,9 @@ def from_decimal(cls, dec): """Converts a finite Decimal instance to a rational number, exactly.""" from decimal import Decimal - if not isinstance(dec, Decimal): + if isinstance(dec, numbers.Integral): + dec = Decimal(int(dec)) + elif not isinstance(dec, Decimal): raise TypeError( "%s.from_decimal() only takes Decimals, not %r (%s)" % (cls.__name__, dec, type(dec).__name__)) Modified: python/trunk/Lib/test/test_fractions.py ============================================================================== --- python/trunk/Lib/test/test_fractions.py (original) +++ python/trunk/Lib/test/test_fractions.py Thu Jul 10 16:34:57 2008 @@ -137,10 +137,8 @@ self.assertNotEquals(F(4, 2), r) def testFromFloat(self): - self.assertRaisesMessage( - TypeError, "Fraction.from_float() only takes floats, not 3 (int)", - F.from_float, 3) - + self.assertRaises(TypeError, F.from_float, 3+4j) + self.assertEquals((10, 1), _components(F.from_float(10))) self.assertEquals((0, 1), _components(F.from_float(-0.0))) self.assertEquals((10, 1), _components(F.from_float(10.0))) self.assertEquals((-5, 2), _components(F.from_float(-2.5))) @@ -164,10 +162,8 @@ F.from_float, nan) def testFromDecimal(self): - self.assertRaisesMessage( - TypeError, - "Fraction.from_decimal() only takes Decimals, not 3 (int)", - F.from_decimal, 3) + self.assertRaises(TypeError, F.from_decimal, 3+4j) + self.assertEquals(F(10, 1), F.from_decimal(10)) self.assertEquals(F(0), F.from_decimal(Decimal("-0"))) self.assertEquals(F(5, 10), F.from_decimal(Decimal("0.5"))) self.assertEquals(F(5, 1000), F.from_decimal(Decimal("5e-3"))) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jul 10 16:34:57 2008 @@ -41,6 +41,8 @@ Library ------- +- Issue #3285: Fractions from_float() and from_decimal() accept Integral arguments. + - Issue #3301: Bisect module modules behaved badly when lo was negative. - Issue #839496: SimpleHTTPServer used to open text files in text mode. This is From python-checkins at python.org Thu Jul 10 16:42:10 2008 From: python-checkins at python.org (kristjan.jonsson) Date: Thu, 10 Jul 2008 16:42:10 +0200 (CEST) Subject: [Python-checkins] r64848 - svn:log Message-ID: <20080710144210.844BB1E400D@bag.python.org> Author: kristjan.jonsson Revision: 64848 Property Name: svn:log Action: modified Property diff: --- old property value +++ new property value @@ -0,0 +1,2 @@ +Use Py_CLEAR wherever prudent. This should be used if nulling a member or prior to assignment. This also makes the home-grown macro ZAP redundant. +Use PyObject_CallFunction in place of PyObject_Call to simplify things where appropriate. \ No newline at end of file From python-checkins at python.org Thu Jul 10 16:43:31 2008 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 10 Jul 2008 16:43:31 +0200 (CEST) Subject: [Python-checkins] r64849 - python/trunk/Misc/NEWS Message-ID: <20080710144332.0F2BE1E400D@bag.python.org> Author: andrew.kuchling Date: Thu Jul 10 16:43:31 2008 New Revision: 64849 Log: Wording changes Modified: python/trunk/Misc/NEWS Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jul 10 16:43:31 2008 @@ -31,7 +31,7 @@ 10, -1). - Issue #3219: Calling a function with repeated keyword arguments, f(a=2, a=23), - would not cause a syntax error. This was regression from 2.4 caused by the + would not cause a syntax error. This was a regression from 2.4 caused by the switch to the new compiler. - Issue #2862: Make int and float freelist management consistent with other @@ -43,11 +43,11 @@ - Issue #3285: Fractions from_float() and from_decimal() accept Integral arguments. -- Issue #3301: Bisect module modules behaved badly when lo was negative. +- Issue #3301: Bisect module behaved badly when lo was negative. - Issue #839496: SimpleHTTPServer used to open text files in text mode. This is both unnecessary (HTTP allows text content to be sent in several forms) and - wrong because the actual transmitted size could differ with the + wrong because the actual transmitted size could differ from the content-length. The problem had been corrected in the 2.4 branch, but never merged into trunk. @@ -61,8 +61,8 @@ archives with comments over 4k were flagged as invalid). Allow writing Zip files with archives by setting the 'comment' attribute of a ZipFile. -- Issue #449227: Now with the rlcompleter module, callable objects are added - "(" when completed. +- Issue #449227: The rlcompleter module now adds "(" to callable objects + when completed. - Issue #3190: Pydoc now hides the automatic module attribute __package__ (the handling is now the same as that of other special attributes like __name__). @@ -77,7 +77,7 @@ - Issue #2113: Fix error in subprocess.Popen if the select system call is interrupted by a signal. -- Issue #3309: Fix bz2.BZFile itererator to release its internal lock +- Issue #3309: Fix bz2.BZFile iterator to release its internal lock properly when raising an exception due to the bz2file being closed. Prevents a deadlock. From python-checkins at python.org Thu Jul 10 17:24:05 2008 From: python-checkins at python.org (robert.schuppenies) Date: Thu, 10 Jul 2008 17:24:05 +0200 (CEST) Subject: [Python-checkins] r64853 - in python/trunk: Lib/test/test_sys.py Objects/bytearrayobject.c Objects/frameobject.c Objects/longobject.c Objects/setobject.c Objects/unicodeobject.c Message-ID: <20080710152405.5AD5F1E400D@bag.python.org> Author: robert.schuppenies Date: Thu Jul 10 17:24:04 2008 New Revision: 64853 Log: Added additional __sizeof__ implementations and addressed comments made in Issue3122. Modified: python/trunk/Lib/test/test_sys.py python/trunk/Objects/bytearrayobject.c python/trunk/Objects/frameobject.c python/trunk/Objects/longobject.c python/trunk/Objects/setobject.c python/trunk/Objects/unicodeobject.c Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Thu Jul 10 17:24:04 2008 @@ -408,14 +408,11 @@ self.file.close() test.test_support.unlink(test.test_support.TESTFN) - def check_sizeof(self, o, size, size2=None): - """Check size of o. Possible are size and optionally size2).""" + def check_sizeof(self, o, size): result = sys.getsizeof(o) - msg = 'wrong size for %s: got %d, expected ' % (type(o), result) - if (size2 != None) and (result != size): - self.assertEqual(result, size2, msg + str(size2)) - else: - self.assertEqual(result, size, msg + str(size)) + msg = 'wrong size for %s: got %d, expected %d' \ + % (type(o), result, size) + self.assertEqual(result, size, msg) def calcsize(self, fmt): """Wrapper around struct.calcsize which enforces the alignment of the @@ -438,6 +435,13 @@ check(buffer(''), size(h + '2P2Pil')) # builtin_function_or_method check(len, size(h + '3P')) + # bytearray + samples = ['', 'u'*100000] + for sample in samples: + x = bytearray(sample) + check(x, size(vh + 'iPP') + x.__alloc__() * self.c) + # bytearray_iterator + check(iter(bytearray()), size(h + 'PP')) # cell def get_cell(): x = 42 @@ -507,6 +511,17 @@ check(float(0), size(h + 'd')) # sys.floatinfo check(sys.float_info, size(vh) + self.P * len(sys.float_info)) + # frame + import inspect + CO_MAXBLOCKS = 20 + x = inspect.currentframe() + ncells = len(x.f_code.co_cellvars) + nfrees = len(x.f_code.co_freevars) + extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\ + ncells + nfrees - 1 + check(x, size(vh + '12P3i') +\ + CO_MAXBLOCKS*struct.calcsize('3i') +\ + self.P + extras*self.P) # function def func(): pass check(func, size(h + '9P')) @@ -545,7 +560,7 @@ # listreverseiterator (list) check(reversed([]), size(h + 'lP')) # long - check(0L, size(vh + 'H')) + check(0L, size(vh + 'H') - self.H) check(1L, size(vh + 'H')) check(-1L, size(vh + 'H')) check(32768L, size(vh + 'H') + self.H) @@ -570,6 +585,29 @@ check(iter(xrange(1)), size(h + '4l')) # reverse check(reversed(''), size(h + 'PP')) + # set + # frozenset + PySet_MINSIZE = 8 + samples = [[], range(10), range(50)] + s = size(h + '3P2P') +\ + PySet_MINSIZE*struct.calcsize('lP') + self.l + self.P + for sample in samples: + minused = len(sample) + if minused == 0: tmp = 1 + # the computation of minused is actually a bit more complicated + # but this suffices for the sizeof test + minused = minused*2 + newsize = PySet_MINSIZE + while newsize <= minused: + newsize = newsize << 1 + if newsize <= 8: + check(set(sample), s) + check(frozenset(sample), s) + else: + check(set(sample), s + newsize*struct.calcsize('lP')) + check(frozenset(sample), s + newsize*struct.calcsize('lP')) + # setiterator + check(iter(set()), size(h + 'P3P')) # slice check(slice(1), size(h + '3P')) # str @@ -600,16 +638,7 @@ # we need to test for both sizes, because we don't know if the string # has been cached for s in samples: - basicsize = size(h + 'PPlP') + usize * (len(s) + 1) - check(s, basicsize, size2=basicsize + sys.getsizeof(str(s))) - # XXX trigger caching encoded version as Python string - s = samples[1] - try: - getattr(sys, s) - except AttributeError: - pass - finally: - check(s, basicsize + sys.getsizeof(str(s))) + check(s, size(h + 'PPlP') + usize * (len(s) + 1)) # weakref import weakref check(weakref.ref(int), size(h + '2Pl2P')) Modified: python/trunk/Objects/bytearrayobject.c ============================================================================== --- python/trunk/Objects/bytearrayobject.c (original) +++ python/trunk/Objects/bytearrayobject.c Thu Jul 10 17:24:04 2008 @@ -3106,6 +3106,19 @@ return Py_BuildValue("(O(Ns)N)", Py_TYPE(self), latin1, "latin-1", dict); } +PyDoc_STRVAR(sizeof_doc, +"B.__sizeof__() -> int\n\ + \n\ +Returns the size of B in memory, in bytes"); +static PyObject * +bytes_sizeof(PyByteArrayObject *self) +{ + Py_ssize_t res; + + res = sizeof(PyByteArrayObject) + self->ob_alloc * sizeof(char); + return PyInt_FromSsize_t(res); +} + static PySequenceMethods bytes_as_sequence = { (lenfunc)bytes_length, /* sq_length */ (binaryfunc)PyByteArray_Concat, /* sq_concat */ @@ -3138,6 +3151,7 @@ bytes_methods[] = { {"__alloc__", (PyCFunction)bytes_alloc, METH_NOARGS, alloc_doc}, {"__reduce__", (PyCFunction)bytes_reduce, METH_NOARGS, reduce_doc}, + {"__sizeof__", (PyCFunction)bytes_sizeof, METH_NOARGS, sizeof_doc}, {"append", (PyCFunction)bytes_append, METH_O, append__doc__}, {"capitalize", (PyCFunction)stringlib_capitalize, METH_NOARGS, _Py_capitalize__doc__}, Modified: python/trunk/Objects/frameobject.c ============================================================================== --- python/trunk/Objects/frameobject.c (original) +++ python/trunk/Objects/frameobject.c Thu Jul 10 17:24:04 2008 @@ -508,6 +508,29 @@ } } +static PyObject * +frame_sizeof(PyFrameObject *f) +{ + Py_ssize_t res, extras, ncells, nfrees; + + ncells = PyTuple_GET_SIZE(f->f_code->co_cellvars); + nfrees = PyTuple_GET_SIZE(f->f_code->co_freevars); + extras = f->f_code->co_stacksize + f->f_code->co_nlocals + + ncells + nfrees; + // subtract one as it is already included in PyFrameObject + res = sizeof(PyFrameObject) + (extras-1) * sizeof(PyObject *); + + return PyInt_FromSsize_t(res); +} + +PyDoc_STRVAR(sizeof__doc__, +"F.__sizeof__() -> size of F in memory, in bytes"); + +static PyMethodDef frame_methods[] = { + {"__sizeof__", (PyCFunction)frame_sizeof, METH_NOARGS, + sizeof__doc__}, + {NULL, NULL} /* sentinel */ +}; PyTypeObject PyFrame_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) @@ -537,7 +560,7 @@ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - 0, /* tp_methods */ + frame_methods, /* tp_methods */ frame_memberlist, /* tp_members */ frame_getsetlist, /* tp_getset */ 0, /* tp_base */ Modified: python/trunk/Objects/longobject.c ============================================================================== --- python/trunk/Objects/longobject.c (original) +++ python/trunk/Objects/longobject.c Thu Jul 10 17:24:04 2008 @@ -3441,9 +3441,9 @@ { Py_ssize_t res; - res = sizeof(PyLongObject) + abs(v->ob_size) * sizeof(digit); + res = v->ob_type->tp_basicsize; if (v->ob_size != 0) - res -= sizeof(digit); + res += abs(v->ob_size) * sizeof(digit); return PyInt_FromSsize_t(res); } Modified: python/trunk/Objects/setobject.c ============================================================================== --- python/trunk/Objects/setobject.c (original) +++ python/trunk/Objects/setobject.c Thu Jul 10 17:24:04 2008 @@ -1956,6 +1956,18 @@ PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); +static PyObject * +set_sizeof(PySetObject *so) +{ + Py_ssize_t res; + + res = sizeof(PySetObject); + if (so->table != so->smalltable) + res = res + (so->mask + 1) * sizeof(setentry); + return PyInt_FromSsize_t(res); +} + +PyDoc_STRVAR(sizeof_doc, "S.__sizeof__() -> size of S in memory, in bytes"); static int set_init(PySetObject *self, PyObject *args, PyObject *kwds) { @@ -2023,6 +2035,8 @@ reduce_doc}, {"remove", (PyCFunction)set_remove, METH_O, remove_doc}, + {"__sizeof__", (PyCFunction)set_sizeof, METH_NOARGS, + sizeof_doc}, {"symmetric_difference",(PyCFunction)set_symmetric_difference, METH_O, symmetric_difference_doc}, {"symmetric_difference_update",(PyCFunction)set_symmetric_difference_update, METH_O, @@ -2144,6 +2158,8 @@ issuperset_doc}, {"__reduce__", (PyCFunction)set_reduce, METH_NOARGS, reduce_doc}, + {"__sizeof__", (PyCFunction)set_sizeof, METH_NOARGS, + sizeof_doc}, {"symmetric_difference",(PyCFunction)set_symmetric_difference, METH_O, symmetric_difference_doc}, {"union", (PyCFunction)set_union, METH_VARARGS, Modified: python/trunk/Objects/unicodeobject.c ============================================================================== --- python/trunk/Objects/unicodeobject.c (original) +++ python/trunk/Objects/unicodeobject.c Thu Jul 10 17:24:04 2008 @@ -7898,20 +7898,8 @@ static PyObject * unicode__sizeof__(PyUnicodeObject *v) { - PyObject *res = NULL, *defsize = NULL; - - res = PyInt_FromSsize_t(sizeof(PyUnicodeObject) + - sizeof(Py_UNICODE) * (v->length + 1)); - if (v->defenc) { - defsize = PyObject_CallMethod(v->defenc, "__sizeof__", NULL); - if (defsize == NULL) { - Py_DECREF(res); - return NULL; - } - res = PyNumber_Add(res, defsize); - Py_DECREF(defsize); - } - return res; + return PyInt_FromSsize_t(sizeof(PyUnicodeObject) + + sizeof(Py_UNICODE) * (v->length + 1)); } PyDoc_STRVAR(sizeof__doc__, From python-checkins at python.org Thu Jul 10 17:37:08 2008 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 10 Jul 2008 17:37:08 +0200 (CEST) Subject: [Python-checkins] r64854 - python/trunk/Lib/optparse.py Message-ID: <20080710153708.ED6E31E400D@bag.python.org> Author: raymond.hettinger Date: Thu Jul 10 17:37:08 2008 New Revision: 64854 Log: Clear the -3 warnings in optparse.py Modified: python/trunk/Lib/optparse.py Modified: python/trunk/Lib/optparse.py ============================================================================== --- python/trunk/Lib/optparse.py (original) +++ python/trunk/Lib/optparse.py Thu Jul 10 17:37:08 2008 @@ -602,7 +602,7 @@ def _set_attrs(self, attrs): for attr in self.ATTRS: - if attrs.has_key(attr): + if attr in attrs: setattr(self, attr, attrs[attr]) del attrs[attr] else: @@ -701,7 +701,7 @@ def _check_callback(self): if self.action == "callback": - if not callable(self.callback): + if not hasattr(self.callback, '__call__'): raise OptionError( "callback not callable: %r" % self.callback, self) if (self.callback_args is not None and @@ -817,12 +817,6 @@ SUPPRESS_HELP = "SUPPRESS"+"HELP" SUPPRESS_USAGE = "SUPPRESS"+"USAGE" -# For compatibility with Python 2.2 -try: - True, False -except NameError: - (True, False) = (1, 0) - try: basestring except NameError: @@ -860,7 +854,7 @@ are silently ignored. """ for attr in dir(self): - if dict.has_key(attr): + if attr in dict: dval = dict[attr] if dval is not None: setattr(self, attr, dval) @@ -980,10 +974,10 @@ def _check_conflict(self, option): conflict_opts = [] for opt in option._short_opts: - if self._short_opt.has_key(opt): + if opt in self._short_opt: conflict_opts.append((opt, self._short_opt[opt])) for opt in option._long_opts: - if self._long_opt.has_key(opt): + if opt in self._long_opt: conflict_opts.append((opt, self._long_opt[opt])) if conflict_opts: @@ -1029,7 +1023,7 @@ if option.dest is not None: # option has a dest, we need a default if option.default is not NO_DEFAULT: self.defaults[option.dest] = option.default - elif not self.defaults.has_key(option.dest): + elif option.dest not in self.defaults: self.defaults[option.dest] = None return option @@ -1045,8 +1039,8 @@ self._long_opt.get(opt_str)) def has_option(self, opt_str): - return (self._short_opt.has_key(opt_str) or - self._long_opt.has_key(opt_str)) + return (opt_str in self._short_opt or + opt_str in self._long_opt) def remove_option(self, opt_str): option = self._short_opt.get(opt_str) @@ -1664,7 +1658,7 @@ 'words', raise BadOptionError. """ # Is there an exact match? - if wordmap.has_key(s): + if s in wordmap: return s else: # Isolate all words with s as a prefix. From python-checkins at python.org Thu Jul 10 18:06:41 2008 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 10 Jul 2008 18:06:41 +0200 (CEST) Subject: [Python-checkins] r64855 - python/trunk/Lib/unittest.py Message-ID: <20080710160641.B2C6D1E401A@bag.python.org> Author: raymond.hettinger Date: Thu Jul 10 18:06:41 2008 New Revision: 64855 Log: Suppress -3 warnings in unittest.py Modified: python/trunk/Lib/unittest.py Modified: python/trunk/Lib/unittest.py ============================================================================== --- python/trunk/Lib/unittest.py (original) +++ python/trunk/Lib/unittest.py Thu Jul 10 18:06:41 2008 @@ -68,7 +68,6 @@ # Backward compatibility ############################################################################## if sys.version_info[:2] < (2, 2): - False, True = 0, 1 def isinstance(obj, clsinfo): import __builtin__ if type(clsinfo) in (tuple, list): @@ -79,6 +78,14 @@ return 0 else: return __builtin__.isinstance(obj, clsinfo) +def _CmpToKey(mycmp): + 'Convert a cmp= function into a key= function' + class K(object): + def __init__(self, obj): + self.obj = obj + def __lt__(self, other): + return mycmp(self.obj, other.obj) == -1 + return K ############################################################################## # Test framework core @@ -429,7 +436,7 @@ def addTest(self, test): # sanity checks - if not callable(test): + if not hasattr(test, '__call__'): raise TypeError("the test to add must be callable") if (isinstance(test, (type, types.ClassType)) and issubclass(test, (TestCase, TestSuite))): @@ -584,7 +591,7 @@ return TestSuite([parent(obj.__name__)]) elif isinstance(obj, TestSuite): return obj - elif callable(obj): + elif hasattr(obj, '__call__'): test = obj() if isinstance(test, TestSuite): return test @@ -607,10 +614,10 @@ """Return a sorted sequence of method names found within testCaseClass """ def isTestMethod(attrname, testCaseClass=testCaseClass, prefix=self.testMethodPrefix): - return attrname.startswith(prefix) and callable(getattr(testCaseClass, attrname)) + return attrname.startswith(prefix) and hasattr(getattr(testCaseClass, attrname), '__call__') testFnNames = filter(isTestMethod, dir(testCaseClass)) if self.sortTestMethodsUsing: - testFnNames.sort(self.sortTestMethodsUsing) + testFnNames.sort(key=_CmpToKey(self.sortTestMethodsUsing)) return testFnNames From buildbot at python.org Thu Jul 10 18:25:06 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 10 Jul 2008 16:25:06 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080710162506.BBF991E4014@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/748 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From sw at trilifecom.com Thu Jul 10 07:16:37 2008 From: sw at trilifecom.com (Professional Communications Training) Date: Thu, 10 Jul 2008 13:16:37 +0800 Subject: [Python-checkins] Speaking English with Correct Pronunciation 17 and 18 July Message-ID: <20080710051637468.66EA02E62F607FB4@C34342-49909> If you can't read this, please visit our website at: http://www.trilifecom.com. Should you wish to enquire about our courses, change your email address or unsubscribe, please email us at courses at trilifecom.com. We apologise if you have unsubscribed and are still receiving emails from us. We need the exact email address to unsubscribe. Thanks. Many times, we shy away, hesitate or are reluctant to speak at work and social situations, because we are afraid we might mispronounce words. Regain your confidence in speaking correctly in our 2 day course. You?ll learn how to pronounce ? common words that are usually mispronounced ? words and phrases, you usually use at work ? any word in the Dictionary You'll sound more refine, be better understood; and impress others at personal, work and social situations. (The fee for the course is $488/-, no GST.) For full course and registration details, please visit our website at: http://www.trilifecom.com. Please also visit our website for information on our other courses. We look forward with great pleasure to welcoming you to our course. Yours sincerely Merle Celine Magness (Ms) TriLife Communications, Singapore Tel: 6581-0970 Email: courses at trilifecom.com website: http://www.trilifecom.com This is a genuine advertisement. Should you wish to enquire about our courses, change your email address or unsubscribe, please email us at courses at trilifecom.com. We apologise if you have unsubscribed and are still receiving emails from us. We need the exact email address to unsubscribe. -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Thu Jul 10 19:13:55 2008 From: python-checkins at python.org (robert.schuppenies) Date: Thu, 10 Jul 2008 19:13:55 +0200 (CEST) Subject: [Python-checkins] r64856 - in python/trunk: Doc/library/sys.rst Lib/test/test_sys.py Modules/_testcapimodule.c Python/sysmodule.c Message-ID: <20080710171355.F0DF61E400E@bag.python.org> Author: robert.schuppenies Date: Thu Jul 10 19:13:55 2008 New Revision: 64856 Log: Added garbage collector overhead and optional default return value to sys.getsizeof. Modified: python/trunk/Doc/library/sys.rst python/trunk/Lib/test/test_sys.py python/trunk/Modules/_testcapimodule.c python/trunk/Python/sysmodule.c Modified: python/trunk/Doc/library/sys.rst ============================================================================== --- python/trunk/Doc/library/sys.rst (original) +++ python/trunk/Doc/library/sys.rst Thu Jul 10 19:13:55 2008 @@ -393,13 +393,20 @@ :func:`setrecursionlimit`. -.. function:: getsizeof(object) +.. function:: getsizeof(object[, default]) Return the size of an object in bytes. The object can be any type of object. All built-in objects will return correct results, but this - does not have to hold true for third-party extensions as it is implementation + does not have to hold true for third-party extensions as it is implementation specific. + The *default* argument allows to define a value which will be returned + if the object type does not provide means to retrieve the size and would + cause a `TypeError`. + + func:`getsizeof` calls the object's __sizeof__ method and adds an additional + garbage collector overhead if the object is managed by the garbage collector. + .. versionadded:: 2.6 Modified: python/trunk/Lib/test/test_sys.py ============================================================================== --- python/trunk/Lib/test/test_sys.py (original) +++ python/trunk/Lib/test/test_sys.py Thu Jul 10 19:13:55 2008 @@ -389,6 +389,9 @@ class SizeofTest(unittest.TestCase): + TPFLAGS_HAVE_GC = 1<<14 + TPFLAGS_HEAPTYPE = 1L<<9 + def setUp(self): self.c = len(struct.pack('c', ' ')) self.H = len(struct.pack('H', 0)) @@ -402,6 +405,8 @@ if hasattr(sys, "gettotalrefcount"): self.header += '2P' self.vheader += '2P' + import _testcapi + self.gc_headsize = _testcapi.SIZEOF_PYGC_HEAD self.file = open(test.test_support.TESTFN, 'wb') def tearDown(self): @@ -410,6 +415,9 @@ def check_sizeof(self, o, size): result = sys.getsizeof(o) + if ((type(o) == type) and (o.__flags__ & self.TPFLAGS_HEAPTYPE) or\ + ((type(o) != type) and (type(o).__flags__ & self.TPFLAGS_HAVE_GC))): + size += self.gc_headsize msg = 'wrong size for %s: got %d, expected %d' \ % (type(o), result, size) self.assertEqual(result, size, msg) @@ -423,6 +431,21 @@ """ return struct.calcsize(fmt + '0P') + def test_gc_head_size(self): + # Check that the gc header size is added to objects tracked by the gc. + h = self.header + size = self.calcsize + gc_header_size = self.gc_headsize + # bool objects are not gc tracked + self.assertEqual(sys.getsizeof(True), size(h + 'l')) + # but lists are + self.assertEqual(sys.getsizeof([]), size(h + 'P PP') + gc_header_size) + + def test_default(self): + h = self.header + size = self.calcsize + self.assertEqual(sys.getsizeof(True, -1), size(h + 'l')) + def test_objecttypes(self): # check all types defined in Objects/ h = self.header Modified: python/trunk/Modules/_testcapimodule.c ============================================================================== --- python/trunk/Modules/_testcapimodule.c (original) +++ python/trunk/Modules/_testcapimodule.c Thu Jul 10 19:13:55 2008 @@ -967,6 +967,7 @@ PyModule_AddObject(m, "ULLONG_MAX", PyLong_FromUnsignedLongLong(PY_ULLONG_MAX)); PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyInt_FromSsize_t(PY_SSIZE_T_MAX)); PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyInt_FromSsize_t(PY_SSIZE_T_MIN)); + PyModule_AddObject(m, "SIZEOF_PYGC_HEAD", PyInt_FromSsize_t(sizeof(PyGC_Head))); TestError = PyErr_NewException("_testcapi.error", NULL, NULL); Py_INCREF(TestError); Modified: python/trunk/Python/sysmodule.c ============================================================================== --- python/trunk/Python/sysmodule.c (original) +++ python/trunk/Python/sysmodule.c Thu Jul 10 19:13:55 2008 @@ -640,9 +640,16 @@ #endif /* USE_MALLOPT */ static PyObject * -sys_getsizeof(PyObject *self, PyObject *args) +sys_getsizeof(PyObject *self, PyObject *args, PyObject *kwds) { - static PyObject * str__sizeof__ = NULL; + PyObject *res = NULL; + static PyObject *str__sizeof__, *gc_head_size = NULL; + static char *kwlist[] = {"object", "default", 0}; + PyObject *o, *dflt = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:getsizeof", + kwlist, &o, &dflt)) + return NULL; /* Initialize static variable needed by _PyType_Lookup */ if (str__sizeof__ == NULL) { @@ -651,29 +658,54 @@ return NULL; } + /* Initialize static variable for GC head size */ + if (gc_head_size == NULL) { + gc_head_size = PyInt_FromSsize_t(sizeof(PyGC_Head)); + if (gc_head_size == NULL) + return NULL; + } + /* Make sure the type is initialized. float gets initialized late */ - if (PyType_Ready(Py_TYPE(args)) < 0) + if (PyType_Ready(Py_TYPE(o)) < 0) return NULL; /* Instance of old-style class */ - if (PyInstance_Check(args)) - return PyInt_FromSsize_t(PyInstance_Type.tp_basicsize); + if (PyInstance_Check(o)) + res = PyInt_FromSsize_t(PyInstance_Type.tp_basicsize); /* all other objects */ else { - PyObject *method = _PyType_Lookup(Py_TYPE(args), + PyObject *method = _PyType_Lookup(Py_TYPE(o), str__sizeof__); - if (method == NULL) { + if (method == NULL) PyErr_Format(PyExc_TypeError, "Type %.100s doesn't define __sizeof__", - Py_TYPE(args)->tp_name); - return NULL; - } - return PyObject_CallFunctionObjArgs(method, args, NULL); + Py_TYPE(o)->tp_name); + else + res = PyObject_CallFunctionObjArgs(method, o, NULL); + } + + /* Has a default value been given? */ + if ((res == NULL) && (dflt != NULL) && + PyErr_ExceptionMatches(PyExc_TypeError)) + { + PyErr_Clear(); + Py_INCREF(dflt); + return dflt; + } + else if (res == NULL) + return res; + + /* add gc_head size */ + if (PyObject_IS_GC(o)) { + PyObject *tmp = res; + res = PyNumber_Add(tmp, gc_head_size); + Py_DECREF(tmp); } + return res; } PyDoc_STRVAR(getsizeof_doc, -"getsizeof(object) -> int\n\ +"getsizeof(object, default) -> int\n\ \n\ Return the size of object in bytes."); @@ -868,7 +900,8 @@ {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc}, {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, getrecursionlimit_doc}, - {"getsizeof", sys_getsizeof, METH_O, getsizeof_doc}, + {"getsizeof", (PyCFunction)sys_getsizeof, + METH_VARARGS | METH_KEYWORDS, getsizeof_doc}, {"_getframe", sys_getframe, METH_VARARGS, getframe_doc}, #ifdef MS_WINDOWS {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS, From python-checkins at python.org Fri Jul 11 02:10:50 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 11 Jul 2008 02:10:50 +0200 (CEST) Subject: [Python-checkins] r64858 - python/trunk/Misc/NEWS Message-ID: <20080711001050.555E61E4003@bag.python.org> Author: brett.cannon Date: Fri Jul 11 02:10:49 2008 New Revision: 64858 Log: Removal an invalid entry as the fixer for urllib is under active development. Modified: python/trunk/Misc/NEWS Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jul 11 02:10:49 2008 @@ -70,10 +70,6 @@ - Issue #2885 (partial): The urllib.urlopen() function has been deprecated for removal in Python 3.0 in favor of urllib2.urlopen(). -- Issue #2885 (partial): lib2to3 has been updated to handle the renaming of the - urllib module in Python 3.0 to urllib.request, urllib.parse, and - urllib.error. - - Issue #2113: Fix error in subprocess.Popen if the select system call is interrupted by a signal. From python-checkins at python.org Fri Jul 11 02:12:52 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 11 Jul 2008 02:12:52 +0200 (CEST) Subject: [Python-checkins] r64859 - in python/trunk: Doc/library/urllib2.rst Misc/NEWS Message-ID: <20080711001252.824FF1E4003@bag.python.org> Author: brett.cannon Date: Fri Jul 11 02:12:52 2008 New Revision: 64859 Log: Document the fact that urllib2 spans multiple modules with new names in Python 3.0. Modified: python/trunk/Doc/library/urllib2.rst python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/urllib2.rst ============================================================================== --- python/trunk/Doc/library/urllib2.rst (original) +++ python/trunk/Doc/library/urllib2.rst Fri Jul 11 02:12:52 2008 @@ -7,6 +7,13 @@ .. sectionauthor:: Moshe Zadka +.. note:: + The :mod:`urllib2` module has been split across several modules in + Python 3.0 named :mod:`urllib.request` and :mod:`urllib.error`. + The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. + + The :mod:`urllib2` module defines functions and classes which help in opening URLs (mostly HTTP) in a complex world --- basic and digest authentication, redirections, cookies and more. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jul 11 02:12:52 2008 @@ -87,6 +87,16 @@ - Issue #3215: Build sqlite3 as sqlite3.dll, not sqlite3.pyd. +Documentation +------------- + +- Document that urllib2 is split across multiple modules and renamed in + Python 3.0. + +- Document that urllib is split across multiple modules and renamed in + Python 3.0. + + What's New in Python 2.6 beta 1? ================================ From python-checkins at python.org Fri Jul 11 02:16:31 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 11 Jul 2008 02:16:31 +0200 (CEST) Subject: [Python-checkins] r64861 - in python/trunk: Doc/library/urlparse.rst Misc/NEWS Message-ID: <20080711001631.15BE91E4003@bag.python.org> Author: brett.cannon Date: Fri Jul 11 02:16:30 2008 New Revision: 64861 Log: Doc that urlparse is named urllib.parse in Python 3.0. Modified: python/trunk/Doc/library/urlparse.rst python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/urlparse.rst ============================================================================== --- python/trunk/Doc/library/urlparse.rst (original) +++ python/trunk/Doc/library/urlparse.rst Fri Jul 11 02:16:30 2008 @@ -12,6 +12,12 @@ pair: URL; parsing pair: relative; URL +.. note:: + The :mod:`urlparse` module is renamed to :mod:`urllib.parse` in Python 3.0. + The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. + + This module defines a standard interface to break Uniform Resource Locator (URL) strings up in components (addressing scheme, network location, path etc.), to combine the components back into a URL string, and to convert a "relative URL" Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jul 11 02:16:30 2008 @@ -90,6 +90,8 @@ Documentation ------------- +- Document that urlparse has been renamed to urllib.parse in Python 3.0. + - Document that urllib2 is split across multiple modules and renamed in Python 3.0. From buildbot at python.org Fri Jul 11 02:35:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 11 Jul 2008 00:35:32 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080711003532.2C3281E400E@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/153 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jul 11 02:42:33 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 11 Jul 2008 02:42:33 +0200 (CEST) Subject: [Python-checkins] r64863 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Message-ID: <20080711004233.03F691E4003@bag.python.org> Author: brett.cannon Date: Fri Jul 11 02:42:32 2008 New Revision: 64863 Log: Add urlparse -> urllib.parse to fix_imports. Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Fri Jul 11 02:42:32 2008 @@ -272,6 +272,9 @@ 'commands': ('subprocess', ['getstatusoutput', 'getoutput']), 'UserString' : ('collections', ['UserString']), 'UserList' : ('collections', ['UserList']), + 'urlparse' : ('urllib.parse', + ['urlparse', 'urlunparse', 'urlsplit', + 'urlunsplit', 'urljoin', 'urldefrag']), } From python-checkins at python.org Fri Jul 11 02:43:40 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 11 Jul 2008 02:43:40 +0200 (CEST) Subject: [Python-checkins] r64864 - peps/trunk/pep-3108.txt Message-ID: <20080711004340.B897C1E4003@bag.python.org> Author: brett.cannon Date: Fri Jul 11 02:43:40 2008 New Revision: 64864 Log: Knock urlparse off the todo list. Modified: peps/trunk/pep-3108.txt Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Fri Jul 11 02:43:40 2008 @@ -826,8 +826,8 @@ and ``tkSimpleDialog`` have no naming conflicts. -urllib package [done: 3.0] (TODO urllib2, urlparse, robotparser) -///////////////////////////////////////////////////////////////// +urllib package [done: 3.0] (TODO urllib(2), robotparser) +////////////////////////////////////////////////////////////////// Originally this new package was to be named ``url``, but because of the common use of the name as a variable, it has been deemed better From python-checkins at python.org Fri Jul 11 02:48:57 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 11 Jul 2008 02:48:57 +0200 (CEST) Subject: [Python-checkins] r64865 - in python/trunk: Doc/library/robotparser.rst Misc/NEWS Message-ID: <20080711004857.B77781E4003@bag.python.org> Author: brett.cannon Date: Fri Jul 11 02:48:57 2008 New Revision: 64865 Log: Doc that robotparse has been renamed urllib.robotparser in Python 3.0. Modified: python/trunk/Doc/library/robotparser.rst python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/robotparser.rst ============================================================================== --- python/trunk/Doc/library/robotparser.rst (original) +++ python/trunk/Doc/library/robotparser.rst Fri Jul 11 02:48:57 2008 @@ -13,6 +13,12 @@ single: World Wide Web single: URL single: robots.txt + +.. note:: + The :mod:`robotparser` module has been renamed :mod:`urllib.robotparser` in + Python 3.0. + The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. This module provides a single class, :class:`RobotFileParser`, which answers questions about whether or not a particular user agent can fetch a URL on the Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jul 11 02:48:57 2008 @@ -90,6 +90,9 @@ Documentation ------------- +- Document that robotparse has been renamed to urllib.robotparser in + Python 3.0. + - Document that urlparse has been renamed to urllib.parse in Python 3.0. - Document that urllib2 is split across multiple modules and renamed in From python-checkins at python.org Fri Jul 11 02:50:02 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 11 Jul 2008 02:50:02 +0200 (CEST) Subject: [Python-checkins] r64866 - python/trunk/Misc/NEWS Message-ID: <20080711005002.CAECA1E4003@bag.python.org> Author: brett.cannon Date: Fri Jul 11 02:50:01 2008 New Revision: 64866 Log: Fix a minor typo in the last entry made. Modified: python/trunk/Misc/NEWS Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jul 11 02:50:01 2008 @@ -90,7 +90,7 @@ Documentation ------------- -- Document that robotparse has been renamed to urllib.robotparser in +- Document that robotparser has been renamed to urllib.robotparser in Python 3.0. - Document that urlparse has been renamed to urllib.parse in Python 3.0. From python-checkins at python.org Fri Jul 11 03:00:10 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 11 Jul 2008 03:00:10 +0200 (CEST) Subject: [Python-checkins] r64868 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Message-ID: <20080711010010.54D4F1E4003@bag.python.org> Author: brett.cannon Date: Fri Jul 11 03:00:10 2008 New Revision: 64868 Log: Add robotparser -> urllib.robotparser to fix_imports. Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Fri Jul 11 03:00:10 2008 @@ -275,6 +275,7 @@ 'urlparse' : ('urllib.parse', ['urlparse', 'urlunparse', 'urlsplit', 'urlunsplit', 'urljoin', 'urldefrag']), + 'robotparser' : ('urllib.robotparser', ['RobotFileParser']), } From python-checkins at python.org Fri Jul 11 03:00:58 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 11 Jul 2008 03:00:58 +0200 (CEST) Subject: [Python-checkins] r64869 - peps/trunk/pep-3108.txt Message-ID: <20080711010058.12D101E4003@bag.python.org> Author: brett.cannon Date: Fri Jul 11 03:00:57 2008 New Revision: 64869 Log: robotparser has been handled. Modified: peps/trunk/pep-3108.txt Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Fri Jul 11 03:00:57 2008 @@ -826,8 +826,8 @@ and ``tkSimpleDialog`` have no naming conflicts. -urllib package [done: 3.0] (TODO urllib(2), robotparser) -////////////////////////////////////////////////////////////////// +urllib package [done: 3.0] (TODO urllib(2) fixers) +////////////////////////////////////////////////// Originally this new package was to be named ``url``, but because of the common use of the name as a variable, it has been deemed better From buildbot at python.org Fri Jul 11 03:37:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 11 Jul 2008 01:37:57 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080711013757.CAA141E4003@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/429 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_xmlrpc_net make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jul 11 03:38:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 11 Jul 2008 01:38:22 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080711013822.8A7311E4003@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/352 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jul 11 07:30:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 11 Jul 2008 05:30:47 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080711053048.1ACBA1E4017@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/251 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Fri Jul 11 07:56:27 2008 From: python-checkins at python.org (brett.cannon) Date: Fri, 11 Jul 2008 07:56:27 +0200 (CEST) Subject: [Python-checkins] r64870 - in sandbox/trunk/2to3/lib2to3: fixes/fix_imports.py fixes/fix_imports2.py tests/test_fixers.py Message-ID: <20080711055628.00E901E4013@bag.python.org> Author: brett.cannon Date: Fri Jul 11 07:56:27 2008 New Revision: 64870 Log: Fix the fixers for the new dbm package. Had to create a new fixer (fix_imports2) which did fixes in post-order. This because ``import anydbm`` was being translated into ``import dbm`` which was then subsequently changed into ``import dbm.ndbm``; one transform too many. Added: sandbox/trunk/2to3/lib2to3/fixes/fix_imports2.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Fri Jul 11 07:56:27 2008 @@ -1,10 +1,4 @@ -"""Fix incompatible imports and module references. - -Fixes: - * StringIO -> io - * cStringIO -> io - * md5 -> hashlib -""" +"""Fix incompatible imports and module references.""" # Author: Collin Winter # Local imports @@ -155,8 +149,7 @@ 'error', 'exit', 'exit_thread', 'get_ident', 'interrupt_main', 'stack_size', 'start_new', 'start_new_thread']), - 'whichdb': ('dbm', ['whichdb']), - 'anydbm': ('dbm', ['error', 'open']), + # anydbm and whichdb are handed by fix_imports2. 'dbhash': ('dbm.bsd', ['error', 'open']), 'dumbdbm': ('dbm.dumb', ['error', 'open', '_Database']), 'dbm': ('dbm.ndbm', ['error', 'open', 'library']), @@ -253,22 +246,22 @@ 'CGIHTTPServer': ('http.server', ['CGIHTTPRequestHandler', 'executable', 'nobody_uid', 'nobody']), - 'test.test_support': ('test.support', - ["Error", "TestFailed", "TestSkipped", "ResourceDenied", - "import_module", "verbose", "use_resources", - "max_memuse", "record_original_stdout", - "get_original_stdout", "unload", "unlink", "rmtree", - "forget", "is_resource_enabled", "requires", - "find_unused_port", "bind_port", - "fcmp", "is_jython", "TESTFN", "HOST", - "FUZZ", "findfile", "verify", "vereq", "sortdict", - "check_syntax_error", "open_urlresource", "WarningMessage", - "catch_warning", "CleanImport", "EnvironmentVarGuard", - "TransientResource", "captured_output", "captured_stdout", - "TransientResource", "transient_internet", "run_with_locale", - "set_memlimit", "bigmemtest", "bigaddrspacetest", - "BasicTestRunner", "run_unittest", "run_doctest", - "threading_setup", "threading_cleanup", "reap_children"]), + # 'test.test_support': ('test.support', + # ["Error", "TestFailed", "TestSkipped", "ResourceDenied", + # "import_module", "verbose", "use_resources", + # "max_memuse", "record_original_stdout", + # "get_original_stdout", "unload", "unlink", "rmtree", + # "forget", "is_resource_enabled", "requires", + # "find_unused_port", "bind_port", + # "fcmp", "is_jython", "TESTFN", "HOST", + # "FUZZ", "findfile", "verify", "vereq", "sortdict", + # "check_syntax_error", "open_urlresource", "WarningMessage", + # "catch_warning", "CleanImport", "EnvironmentVarGuard", + # "TransientResource", "captured_output", "captured_stdout", + # "TransientResource", "transient_internet", "run_with_locale", + # "set_memlimit", "bigmemtest", "bigaddrspacetest", + # "BasicTestRunner", "run_unittest", "run_doctest", + # "threading_setup", "threading_cleanup", "reap_children"]), 'commands': ('subprocess', ['getstatusoutput', 'getoutput']), 'UserString' : ('collections', ['UserString']), 'UserList' : ('collections', ['UserList']), @@ -283,9 +276,9 @@ return "(" + "|".join(map(repr, members)) + ")" -def build_pattern(): +def build_pattern(mapping=MAPPING): bare = set() - for old_module, (new_module, members) in MAPPING.items(): + for old_module, (new_module, members) in mapping.items(): bare.add(old_module) bare.update(members) members = alternates(members) @@ -310,6 +303,8 @@ PATTERN = "|".join(build_pattern()) order = "pre" # Pre-order tree traversal + + mapping = MAPPING # Don't match the node if it's within another match def match(self, node): @@ -332,7 +327,7 @@ star = results.get("star") if import_mod or mod_name: - new_name, members = MAPPING[(import_mod or mod_name).value] + new_name, members = self.mapping[(import_mod or mod_name).value] if import_mod: self.replace[import_mod.value] = new_name Added: sandbox/trunk/2to3/lib2to3/fixes/fix_imports2.py ============================================================================== --- (empty file) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports2.py Fri Jul 11 07:56:27 2008 @@ -0,0 +1,17 @@ +"""Fix incompatible imports and module references that must be fixed after +fix_imports.""" +from . import fix_imports + + +MAPPING = { + 'whichdb': ('dbm', ['whichdb']), + 'anydbm': ('dbm', ['error', 'open']), + } + + +class FixImports2(fix_imports.FixImports): + PATTERN = "|".join((fix_imports.build_pattern(MAPPING))) + + order = "post" + + mapping = MAPPING Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Fri Jul 11 07:56:27 2008 @@ -28,8 +28,10 @@ self.verbose = False class FixerTestCase(support.TestCase): - def setUp(self): - options = Options(fix=[self.fixer], print_function=False) + def setUp(self, fix_list=None): + if not fix_list: + fix_list = [self.fixer] + options = Options(fix=fix_list, print_function=False) self.refactor = refactor.RefactoringTool("lib2to3/fixes", options) self.fixer_log = [] self.filename = "" @@ -1490,6 +1492,24 @@ foo(%s) """ % (new, ", ".join(members), ", ".join(members)) self.check(b, a) + + +class Test_imports2(Test_imports): + fixer = "imports2" + from ..fixes.fix_imports2 import MAPPING as modules + + +class Test_imports_fixer_order(Test_imports): + + fixer = None + + def setUp(self): + Test_imports.setUp(self, ['imports', 'imports2']) + from ..fixes.fix_imports2 import MAPPING as mapping2 + self.modules = mapping2.copy() + from ..fixes.fix_imports import MAPPING as mapping1 + for key in ('dbhash', 'dumbdbm', 'dbm', 'gdbm'): + self.modules[key] = mapping1[key] class Test_input(FixerTestCase): From python-checkins at python.org Fri Jul 11 14:00:22 2008 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 11 Jul 2008 14:00:22 +0200 (CEST) Subject: [Python-checkins] r64871 - python/trunk/Doc/c-api/sequence.rst Message-ID: <20080711120022.8DFAE1E4011@bag.python.org> Author: raymond.hettinger Date: Fri Jul 11 14:00:21 2008 New Revision: 64871 Log: Add cautionary note on the use of PySequence_Fast_ITEMS. Modified: python/trunk/Doc/c-api/sequence.rst Modified: python/trunk/Doc/c-api/sequence.rst ============================================================================== --- python/trunk/Doc/c-api/sequence.rst (original) +++ python/trunk/Doc/c-api/sequence.rst Fri Jul 11 14:00:21 2008 @@ -143,6 +143,10 @@ Return the underlying array of PyObject pointers. Assumes that *o* was returned by :cfunc:`PySequence_Fast` and *o* is not *NULL*. + + Note, if a list gets resized, the reallocation may relocate the items array. + So, only use the underlying array pointer in contexts where the sequence + cannot change. .. versionadded:: 2.4 From python-checkins at python.org Fri Jul 11 23:28:26 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 11 Jul 2008 23:28:26 +0200 (CEST) Subject: [Python-checkins] r64880 - python/trunk/Lib/zipfile.py Message-ID: <20080711212826.964791E4004@bag.python.org> Author: amaury.forgeotdarc Date: Fri Jul 11 23:28:25 2008 New Revision: 64880 Log: #3317 in zipfile module, restore the previous names of global variables: some applications relied on them. Also remove duplicated lines. Modified: python/trunk/Lib/zipfile.py Modified: python/trunk/Lib/zipfile.py ============================================================================== --- python/trunk/Lib/zipfile.py (original) +++ python/trunk/Lib/zipfile.py Fri Jul 11 23:28:25 2008 @@ -43,9 +43,9 @@ # The "end of central directory" structure, magic number, size, and indices # (section V.I in the format document) -structEndCentDir = "<4s4H2LH" -magicEndCentDir = "PK\005\006" -sizeEndCentDir = struct.calcsize(structEndCentDir) +structEndArchive = "<4s4H2LH" +stringEndArchive = "PK\005\006" +sizeEndCentDir = struct.calcsize(structEndArchive) _ECD_SIGNATURE = 0 _ECD_DISK_NUMBER = 1 @@ -63,37 +63,9 @@ # The "central directory" structure, magic number, size, and indices # of entries in the structure (section V.F in the format document) structCentralDir = "<4s4B4HL2L5H2L" -magicCentralDir = "PK\001\002" +stringCentralDir = "PK\001\002" sizeCentralDir = struct.calcsize(structCentralDir) -# The "local file header" structure, magic number, size, and indices -# (section V.A in the format document) -structFileHeader = "<4s2B4HL2L2H" -magicFileHeader = "PK\003\004" -sizeFileHeader = struct.calcsize(structFileHeader) - -# The "Zip64 end of central directory locator" structure, magic number, and size -structEndCentDir64Locator = "<4sLQL" -magicEndCentDir64Locator = "PK\x06\x07" -sizeEndCentDir64Locator = struct.calcsize(structEndCentDir64Locator) - -# The "Zip64 end of central directory" record, magic number, size, and indices -# (section V.G in the format document) -structEndCentDir64 = "<4sQ2H2L4Q" -magicEndCentDir64 = "PK\x06\x06" -sizeEndCentDir64 = struct.calcsize(structEndCentDir64) - -_CD64_SIGNATURE = 0 -_CD64_DIRECTORY_RECSIZE = 1 -_CD64_CREATE_VERSION = 2 -_CD64_EXTRACT_VERSION = 3 -_CD64_DISK_NUMBER = 4 -_CD64_DISK_NUMBER_START = 5 -_CD64_NUMBER_ENTRIES_THIS_DISK = 6 -_CD64_NUMBER_ENTRIES_TOTAL = 7 -_CD64_DIRECTORY_SIZE = 8 -_CD64_OFFSET_START_CENTDIR = 9 - # indexes of entries in the central directory structure _CD_SIGNATURE = 0 _CD_CREATE_VERSION = 1 @@ -118,7 +90,7 @@ # The "local file header" structure, magic number, size, and indices # (section V.A in the format document) structFileHeader = "<4s2B4HL2L2H" -magicFileHeader = "PK\003\004" +stringFileHeader = "PK\003\004" sizeFileHeader = struct.calcsize(structFileHeader) _FH_SIGNATURE = 0 @@ -135,15 +107,15 @@ _FH_EXTRA_FIELD_LENGTH = 11 # The "Zip64 end of central directory locator" structure, magic number, and size -structEndCentDir64Locator = "<4sLQL" -magicEndCentDir64Locator = "PK\x06\x07" -sizeEndCentDir64Locator = struct.calcsize(structEndCentDir64Locator) +structEndArchive64Locator = "<4sLQL" +stringEndArchive64Locator = "PK\x06\x07" +sizeEndCentDir64Locator = struct.calcsize(structEndArchive64Locator) # The "Zip64 end of central directory" record, magic number, size, and indices # (section V.G in the format document) -structEndCentDir64 = "<4sQ2H2L4Q" -magicEndCentDir64 = "PK\x06\x06" -sizeEndCentDir64 = struct.calcsize(structEndCentDir64) +structEndArchive64 = "<4sQ2H2L4Q" +stringEndArchive64 = "PK\x06\x06" +sizeEndCentDir64 = struct.calcsize(structEndArchive64) _CD64_SIGNATURE = 0 _CD64_DIRECTORY_RECSIZE = 1 @@ -174,8 +146,8 @@ """ fpin.seek(offset - sizeEndCentDir64Locator, 2) data = fpin.read(sizeEndCentDir64Locator) - sig, diskno, reloff, disks = struct.unpack(structEndCentDir64Locator, data) - if sig != magicEndCentDir64Locator: + sig, diskno, reloff, disks = struct.unpack(structEndArchive64Locator, data) + if sig != stringEndArchive64Locator: return endrec if diskno != 0 or disks != 1: @@ -186,8 +158,8 @@ data = fpin.read(sizeEndCentDir64) sig, sz, create_version, read_version, disk_num, disk_dir, \ dircount, dircount2, dirsize, diroffset = \ - struct.unpack(structEndCentDir64, data) - if sig != magicEndCentDir64: + struct.unpack(structEndArchive64, data) + if sig != stringEndArchive64: return endrec # Update the original endrec using data from the ZIP64 record @@ -215,9 +187,9 @@ # file if this is the case). fpin.seek(-sizeEndCentDir, 2) data = fpin.read() - if data[0:4] == magicEndCentDir and data[-2:] == "\000\000": + if data[0:4] == stringEndArchive and data[-2:] == "\000\000": # the signature is correct and there's no comment, unpack structure - endrec = struct.unpack(structEndCentDir, data) + endrec = struct.unpack(structEndArchive, data) endrec=list(endrec) # Append a blank comment and record start offset @@ -239,11 +211,11 @@ maxCommentStart = max(filesize - (1 << 16) - sizeEndCentDir, 0) fpin.seek(maxCommentStart, 0) data = fpin.read() - start = data.rfind(magicEndCentDir) + start = data.rfind(stringEndArchive) if start >= 0: # found the magic number; attempt to unpack and interpret recData = data[start:start+sizeEndCentDir] - endrec = list(struct.unpack(structEndCentDir, recData)) + endrec = list(struct.unpack(structEndArchive, recData)) comment = data[start+sizeEndCentDir:] # check that comment length is correct if endrec[_ECD_COMMENT_SIZE] == len(comment): @@ -350,7 +322,7 @@ self.create_version = max(45, self.extract_version) filename, flag_bits = self._encodeFilenameFlags() - header = struct.pack(structFileHeader, magicFileHeader, + header = struct.pack(structFileHeader, stringFileHeader, self.extract_version, self.reserved, flag_bits, self.compress_type, dostime, dosdate, CRC, compress_size, file_size, @@ -779,7 +751,7 @@ total = 0 while total < size_cd: centdir = fp.read(sizeCentralDir) - if centdir[0:4] != magicCentralDir: + if centdir[0:4] != stringCentralDir: raise BadZipfile, "Bad magic number for central directory" centdir = struct.unpack(structCentralDir, centdir) if self.debug > 2: @@ -885,7 +857,7 @@ # Skip the file header: fheader = zef_file.read(sizeFileHeader) - if fheader[0:4] != magicFileHeader: + if fheader[0:4] != stringFileHeader: raise BadZipfile, "Bad magic number for file header" fheader = struct.unpack(structFileHeader, fheader) @@ -1173,7 +1145,7 @@ try: filename, flag_bits = zinfo._encodeFilenameFlags() centdir = struct.pack(structCentralDir, - magicCentralDir, create_version, + stringCentralDir, create_version, zinfo.create_system, extract_version, zinfo.reserved, flag_bits, zinfo.compress_type, dostime, dosdate, zinfo.CRC, compress_size, file_size, @@ -1201,13 +1173,13 @@ if pos1 > ZIP64_LIMIT: # Need to write the ZIP64 end-of-archive records zip64endrec = struct.pack( - structEndCentDir64, magicEndCentDir64, + structEndArchive64, stringEndArchive64, 44, 45, 45, 0, 0, count, count, pos2 - pos1, pos1) self.fp.write(zip64endrec) zip64locrec = struct.pack( - structEndCentDir64Locator, - magicEndCentDir64Locator, 0, pos2, 1) + structEndArchive64Locator, + stringEndArchive64Locator, 0, pos2, 1) self.fp.write(zip64locrec) centDirOffset = 0xFFFFFFFF @@ -1218,7 +1190,7 @@ % ZIP_MAX_COMMENT self.comment = self.comment[:ZIP_MAX_COMMENT] - endrec = struct.pack(structEndCentDir, magicEndCentDir, + endrec = struct.pack(structEndArchive, stringEndArchive, 0, 0, count % ZIP_FILECOUNT_LIMIT, count % ZIP_FILECOUNT_LIMIT, pos2 - pos1, centDirOffset, len(self.comment)) From python-checkins at python.org Fri Jul 11 23:45:07 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 11 Jul 2008 23:45:07 +0200 (CEST) Subject: [Python-checkins] r64881 - in python/trunk: Include/traceback.h Lib/test/test_traceback.py Python/_warnings.c Python/traceback.c Message-ID: <20080711214507.557FF1E4004@bag.python.org> Author: amaury.forgeotdarc Date: Fri Jul 11 23:45:06 2008 New Revision: 64881 Log: #3342: In tracebacks, printed source lines were not indented since r62555. #3343: Py_DisplaySourceLine should be a private function. Rename it to _Py_DisplaySourceLine. Modified: python/trunk/Include/traceback.h python/trunk/Lib/test/test_traceback.py python/trunk/Python/_warnings.c python/trunk/Python/traceback.c Modified: python/trunk/Include/traceback.h ============================================================================== --- python/trunk/Include/traceback.h (original) +++ python/trunk/Include/traceback.h Fri Jul 11 23:45:06 2008 @@ -19,7 +19,7 @@ PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); -PyAPI_FUNC(int) Py_DisplaySourceLine(PyObject *, const char *, int); +PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, const char *, int, int); /* Reveal traceback type so we can typecheck traceback objects */ PyAPI_DATA(PyTypeObject) PyTraceBack_Type; Modified: python/trunk/Lib/test/test_traceback.py ============================================================================== --- python/trunk/Lib/test/test_traceback.py (original) +++ python/trunk/Lib/test/test_traceback.py Fri Jul 11 23:45:06 2008 @@ -177,7 +177,7 @@ banner, location, source_line = tb_lines self.assert_(banner.startswith('Traceback')) self.assert_(location.startswith(' File')) - self.assert_(source_line.startswith('raise')) + self.assert_(source_line.startswith(' raise')) def test_main(): Modified: python/trunk/Python/_warnings.c ============================================================================== --- python/trunk/Python/_warnings.c (original) +++ python/trunk/Python/_warnings.c Fri Jul 11 23:45:06 2008 @@ -256,7 +256,6 @@ Py_XDECREF(name); /* Print " source_line\n" */ - PyFile_WriteString(" ", f_stderr); if (sourceline) { char *source_line_str = PyString_AS_STRING(sourceline); while (*source_line_str == ' ' || *source_line_str == '\t' || @@ -267,7 +266,8 @@ PyFile_WriteString("\n", f_stderr); } else - Py_DisplaySourceLine(f_stderr, PyString_AS_STRING(filename), lineno); + _Py_DisplaySourceLine(f_stderr, PyString_AS_STRING(filename), + lineno, 2); PyErr_Clear(); } Modified: python/trunk/Python/traceback.c ============================================================================== --- python/trunk/Python/traceback.c (original) +++ python/trunk/Python/traceback.c Fri Jul 11 23:45:06 2008 @@ -123,7 +123,7 @@ } int -Py_DisplaySourceLine(PyObject *f, const char *filename, int lineno) +_Py_DisplaySourceLine(PyObject *f, const char *filename, int lineno, int indent) { int err = 0; FILE *xfp = NULL; @@ -197,12 +197,27 @@ } while (*pLastChar != '\0' && *pLastChar != '\n'); } if (i == lineno) { + char buf[11]; char *p = linebuf; while (*p == ' ' || *p == '\t' || *p == '\014') p++; - err = PyFile_WriteString(p, f); - if (err == 0 && strchr(p, '\n') == NULL) - err = PyFile_WriteString("\n", f); + + /* Write some spaces before the line */ + strcpy(buf, " "); + assert (strlen(buf) == 10); + while (indent > 0) { + if(indent < 10) + buf[indent] = '\0'; + err = PyFile_WriteString(buf, f); + if (err != 0) + break; + indent -= 10; + } + + if (err == 0) + err = PyFile_WriteString(p, f); + if (err == 0 && strchr(p, '\n') == NULL) + err = PyFile_WriteString("\n", f); } fclose(xfp); return err; @@ -222,7 +237,7 @@ err = PyFile_WriteString(linebuf, f); if (err != 0) return err; - return Py_DisplaySourceLine(f, filename, lineno); + return _Py_DisplaySourceLine(f, filename, lineno, 4); } static int From buildbot at python.org Fri Jul 11 23:45:38 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 11 Jul 2008 21:45:38 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080711214538.6F18D1E4004@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/750 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,brett.cannon,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sat Jul 12 00:17:14 2008 From: python-checkins at python.org (josiah.carlson) Date: Sat, 12 Jul 2008 00:17:14 +0200 (CEST) Subject: [Python-checkins] r64882 - python/trunk/Lib/asyncore.py Message-ID: <20080711221714.74CC51E4004@bag.python.org> Author: josiah.carlson Date: Sat Jul 12 00:17:14 2008 New Revision: 64882 Log: Fix for the AttributeError in test_asynchat. Modified: python/trunk/Lib/asyncore.py Modified: python/trunk/Lib/asyncore.py ============================================================================== --- python/trunk/Lib/asyncore.py (original) +++ python/trunk/Lib/asyncore.py Sat Jul 12 00:17:14 2008 @@ -102,7 +102,7 @@ if flags & (select.POLLERR | select.POLLNVAL): obj.handle_expt_event() if flags & select.POLLHUP: - obj.handle_close_event() + obj.handle_close() except (ExitNow, KeyboardInterrupt, SystemExit): raise except: From buildbot at python.org Sat Jul 12 00:55:38 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 11 Jul 2008 22:55:38 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080711225538.A78AA1E4004@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/155 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asyncore ====================================================================== FAIL: test_readwrite (test.test_asyncore.HelperFunctionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_asyncore.py", line 179, in test_readwrite self.assertEqual((tobj.expt, tobj.closed)[flag == select.POLLHUP], True) AssertionError: False != True make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jul 12 01:09:28 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 11 Jul 2008 23:09:28 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080711230928.89A7F1E4004@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/748 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asyncore ====================================================================== FAIL: test_readwrite (test.test_asyncore.HelperFunctionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_asyncore.py", line 179, in test_readwrite self.assertEqual((tobj.expt, tobj.closed)[flag == select.POLLHUP], True) AssertionError: False != True make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jul 12 01:26:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 11 Jul 2008 23:26:40 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080711232640.BC5A11E4019@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1230 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sat Jul 12 01:26:59 2008 From: python-checkins at python.org (josiah.carlson) Date: Sat, 12 Jul 2008 01:26:59 +0200 (CEST) Subject: [Python-checkins] r64885 - python/trunk/Lib/test/test_asyncore.py Message-ID: <20080711232659.98AA51E4016@bag.python.org> Author: josiah.carlson Date: Sat Jul 12 01:26:59 2008 New Revision: 64885 Log: Fixed test for asyncore. Modified: python/trunk/Lib/test/test_asyncore.py Modified: python/trunk/Lib/test/test_asyncore.py ============================================================================== --- python/trunk/Lib/test/test_asyncore.py (original) +++ python/trunk/Lib/test/test_asyncore.py Sat Jul 12 01:26:59 2008 @@ -38,7 +38,7 @@ raise asyncore.ExitNow() handle_write_event = handle_read_event - handle_close_event = handle_read_event + handle_close = handle_read_event handle_expt_event = handle_read_event class crashingdummy: @@ -49,7 +49,7 @@ raise Exception() handle_write_event = handle_read_event - handle_close_event = handle_read_event + handle_close = handle_read_event handle_expt_event = handle_read_event def handle_error(self): @@ -128,7 +128,7 @@ def handle_write_event(self): self.write = True - def handle_close_event(self): + def handle_close(self): self.closed = True def handle_expt_event(self): From buildbot at python.org Sat Jul 12 01:44:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 11 Jul 2008 23:44:32 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080711234432.7BB901E4004@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/431 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asyncore ====================================================================== FAIL: test_readwrite (test.test_asyncore.HelperFunctionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_asyncore.py", line 179, in test_readwrite self.assertEqual((tobj.expt, tobj.closed)[flag == select.POLLHUP], True) AssertionError: False != True make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jul 12 01:51:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 11 Jul 2008 23:51:47 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080711235147.CBEFE1E4034@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/753 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: josiah.carlson BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Sat Jul 12 01:57:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 11 Jul 2008 23:57:53 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080711235754.0AE451E4004@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/354 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asyncore ====================================================================== FAIL: test_readwrite (test.test_asyncore.HelperFunctionTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_asyncore.py", line 179, in test_readwrite self.assertEqual((tobj.expt, tobj.closed)[flag == select.POLLHUP], True) AssertionError: False != True make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Jul 12 02:11:56 2008 From: python-checkins at python.org (armin.ronacher) Date: Sat, 12 Jul 2008 02:11:56 +0200 (CEST) Subject: [Python-checkins] r64886 - doctools/trunk/sphinx/ext/autodoc.py Message-ID: <20080712001156.34ED21E4004@bag.python.org> Author: armin.ronacher Date: Sat Jul 12 02:11:55 2008 New Revision: 64886 Log: Fixed an bug with docstring outdenting in the autodoc extension Modified: doctools/trunk/sphinx/ext/autodoc.py Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Sat Jul 12 02:11:55 2008 @@ -172,11 +172,12 @@ lines[0] = lines[0].lstrip() if margin < sys.maxint: for i in range(1, len(lines)): lines[i] = lines[i][margin:] - # Remove any trailing or leading blank lines. - while lines and not lines[-1]: - lines.pop() + # Remove any leading blank lines. while lines and not lines[0]: lines.pop(0) + # make sure there is an empty line at the end + if lines and lines[-1]: + lines.append('') return lines From python-checkins at python.org Sat Jul 12 06:22:38 2008 From: python-checkins at python.org (thomas.lee) Date: Sat, 12 Jul 2008 06:22:38 +0200 (CEST) Subject: [Python-checkins] r64887 - in python/branches/tlee-ast-optimize: Doc/c-api/float.rst Doc/c-api/int.rst Doc/c-api/sequence.rst Doc/library/collections.rst Doc/library/gc.rst Doc/library/robotparser.rst Doc/library/shutil.rst Doc/library/sys.rst Doc/library/urllib2.rst Doc/library/urlparse.rst Doc/tools/sphinxext/opensearch.xml Doc/whatsnew/2.6.rst Include/floatobject.h Include/intobject.h Include/traceback.h Lib/SimpleHTTPServer.py Lib/asynchat.py Lib/asyncore.py Lib/bisect.py Lib/curses/textpad.py Lib/fractions.py Lib/httplib.py Lib/lib2to3 Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/tests/test_fixers.py Lib/optparse.py Lib/subprocess.py Lib/test/regrtest.py Lib/test/test_asyncore.py Lib/test/test_audioop.py Lib/test/test_bisect.py Lib/test/test_bz2.py Lib/test/test_exceptions.py Lib/test/test_float.py Lib/test/test_fractions.py Lib/test/test_lib2to3.py Lib/test/test_sys.py Lib/test/test_traceback.py Lib/unittest.py Lib/zipfile.py Misc/ACKS Misc/NEWS Modules/Setup.dist Modules/_bisectmodule.c Modules/_fileio.c Modules/_testcapimodule.c Modules/audioop.c Modules/bz2module.c Modules/cmathmodule.c Modules/gcmodule.c Modules/timemodule.c Objects/abstract.c Objects/bytearrayobject.c Objects/exceptions.c Objects/floatobject.c Objects/frameobject.c Objects/intobject.c Objects/longobject.c Objects/object.c Objects/setobject.c Objects/unicodeobject.c Python/_warnings.c Python/sysmodule.c Python/traceback.c Message-ID: <20080712042238.8F1E51E4004@bag.python.org> Author: thomas.lee Date: Sat Jul 12 06:22:35 2008 New Revision: 64887 Log: Merged revisions 64727-64886 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ................ r64729 | mark.dickinson | 2008-07-05 21:33:52 +1000 (Sat, 05 Jul 2008) | 5 lines Issue 3188: accept float('infinity') as well as float('inf'). This makes the float constructor behave in the same way as specified by various other language standards, including C99, IEEE 754r, and the IBM Decimal standard. ................ r64735 | mark.dickinson | 2008-07-06 01:25:48 +1000 (Sun, 06 Jul 2008) | 3 lines Minor rewrite of cmath_log to work around a Sun compiler bug. See issue #3168. ................ r64736 | martin.v.loewis | 2008-07-06 01:45:45 +1000 (Sun, 06 Jul 2008) | 20 lines Merged revisions 64285-64735 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r64493 | benjamin.peterson | 2008-06-24 04:14:14 +0200 (Di, 24 Jun 2008) | 1 line add a fix_import mapping for cPickle -> pickle ........ r64651 | brett.cannon | 2008-07-02 04:00:11 +0200 (Mi, 02 Jul 2008) | 3 lines Update fix_imports for urllib. Had to change the fixer itself to handle modules that are split across several renames in 3.0. ........ r64669 | brett.cannon | 2008-07-02 21:43:48 +0200 (Mi, 02 Jul 2008) | 4 lines Backing out last change until fix_imports is working again. Also re-enable the testing for fix_imports; if it is deemed that it takes too long to run then a random sample should be taken and used to test it. ........ ................ r64737 | martin.v.loewis | 2008-07-06 01:48:20 +1000 (Sun, 06 Jul 2008) | 2 lines Disable lib2to3 by default, unless run explicitly. ................ r64742 | benjamin.peterson | 2008-07-06 02:29:38 +1000 (Sun, 06 Jul 2008) | 1 line make regrtest aware of the lib2to3 resource ................ r64744 | georg.brandl | 2008-07-06 02:43:45 +1000 (Sun, 06 Jul 2008) | 2 lines Keep below 80 chars. ................ r64745 | facundo.batista | 2008-07-06 05:19:50 +1000 (Sun, 06 Jul 2008) | 3 lines Issue 3289. Removed two lines that ended doing nothing. ................ r64746 | facundo.batista | 2008-07-06 06:39:59 +1000 (Sun, 06 Jul 2008) | 4 lines Issue #3239. Differentiate the ascii call from the curses one and the builtin one. ................ r64753 | gregory.p.smith | 2008-07-06 13:35:58 +1000 (Sun, 06 Jul 2008) | 4 lines - Issue #2862: Make int and float freelist management consistent with other freelists. Changes their CompactFreeList apis into ClearFreeList apis and calls them via gc.collect(). ................ r64756 | gregory.p.smith | 2008-07-06 17:16:40 +1000 (Sun, 06 Jul 2008) | 3 lines - Issue #2113: Fix error in subprocess.Popen if the select system call is interrupted by a signal. ................ r64757 | benjamin.peterson | 2008-07-06 22:39:09 +1000 (Sun, 06 Jul 2008) | 1 line remove test_compact_freelists from test_sys ................ r64758 | gregory.p.smith | 2008-07-07 03:06:29 +1000 (Mon, 07 Jul 2008) | 2 lines fix issue3304 - remove an incorrect PyMem_Free in fileio_init ................ r64759 | georg.brandl | 2008-07-07 03:36:20 +1000 (Mon, 07 Jul 2008) | 2 lines Fix opensearch template. ................ r64760 | andrew.kuchling | 2008-07-07 03:43:16 +1000 (Mon, 07 Jul 2008) | 1 line Wording fix ................ r64761 | andrew.kuchling | 2008-07-07 03:44:17 +1000 (Mon, 07 Jul 2008) | 1 line Add two items; rewrap paragraph ................ r64762 | amaury.forgeotdarc | 2008-07-07 07:34:39 +1000 (Mon, 07 Jul 2008) | 8 lines Issue839496: SimpleHTTPServer should open all files in binary mode. Forward-port of 38255 (2005/01/15!) This was already fixed in 2.4, but never merged into trunk... py3k is already right, thanks to the bytes/str distinction! Should be backported to 2.5. ................ r64767 | gregory.p.smith | 2008-07-07 14:31:58 +1000 (Mon, 07 Jul 2008) | 4 lines - Issue #3309: Fix bz2.BZFile itererator to release its internal lock properly when raising an exception due to the bz2file being closed. Prevents a deadlock. ................ r64768 | josiah.carlson | 2008-07-07 14:51:46 +1000 (Mon, 07 Jul 2008) | 2 lines Fixed bugs 760475, 953599, and 1519. ................ r64769 | gregory.p.smith | 2008-07-07 14:54:31 +1000 (Mon, 07 Jul 2008) | 2 lines Add commented out #_sha256 and #_sha512 lines per issue 3183. ................ r64771 | gregory.p.smith | 2008-07-07 15:09:12 +1000 (Mon, 07 Jul 2008) | 4 lines - Issue #3094: httplib.HTTPSConnection Host: headers no longer include the redundant ":443" port number designation when the connection is using the default https port (443). ................ r64772 | skip.montanaro | 2008-07-07 21:16:14 +1000 (Mon, 07 Jul 2008) | 2 lines Correct grammar. ................ r64774 | andrew.kuchling | 2008-07-08 02:51:09 +1000 (Tue, 08 Jul 2008) | 1 line Fix example to match text ................ r64775 | facundo.batista | 2008-07-08 03:02:59 +1000 (Tue, 08 Jul 2008) | 3 lines Issue 3306. Better control for a lenght in findmax() function. ................ r64788 | georg.brandl | 2008-07-08 17:05:23 +1000 (Tue, 08 Jul 2008) | 2 lines Add missing ABCs to list. ................ r64791 | nick.coghlan | 2008-07-09 00:08:04 +1000 (Wed, 09 Jul 2008) | 1 line Issue 2517: Allow unicode messages in Exceptions again by correctly bypassing the instance dictionary when looking up __unicode__ on new-style classes ................ r64793 | nick.coghlan | 2008-07-09 00:21:42 +1000 (Wed, 09 Jul 2008) | 1 line Add missing NEWS and ACK entries for r64791 ................ r64835 | raymond.hettinger | 2008-07-10 19:31:08 +1000 (Thu, 10 Jul 2008) | 1 line Issue 3287: Raise correct exception for float inputs. ................ r64836 | raymond.hettinger | 2008-07-10 20:28:41 +1000 (Thu, 10 Jul 2008) | 1 line Use operator.index() instead of n.__index__(). ................ r64842 | robert.schuppenies | 2008-07-10 23:43:26 +1000 (Thu, 10 Jul 2008) | 2 lines Fixed Issue3122 and extended sys.getsizeof tests for built-in types. ................ r64845 | raymond.hettinger | 2008-07-11 00:03:19 +1000 (Fri, 11 Jul 2008) | 1 line Issue 3301: Bisect functions behaved badly when lo was negative. ................ r64846 | raymond.hettinger | 2008-07-11 00:34:57 +1000 (Fri, 11 Jul 2008) | 1 line Issue 3285: Fractions from_float() and from_decimal() accept Integral arguments. ................ r64849 | andrew.kuchling | 2008-07-11 00:43:31 +1000 (Fri, 11 Jul 2008) | 1 line Wording changes ................ r64853 | robert.schuppenies | 2008-07-11 01:24:04 +1000 (Fri, 11 Jul 2008) | 3 lines Added additional __sizeof__ implementations and addressed comments made in Issue3122. ................ r64854 | raymond.hettinger | 2008-07-11 01:37:08 +1000 (Fri, 11 Jul 2008) | 1 line Clear the -3 warnings in optparse.py ................ r64855 | raymond.hettinger | 2008-07-11 02:06:41 +1000 (Fri, 11 Jul 2008) | 1 line Suppress -3 warnings in unittest.py ................ r64856 | robert.schuppenies | 2008-07-11 03:13:55 +1000 (Fri, 11 Jul 2008) | 3 lines Added garbage collector overhead and optional default return value to sys.getsizeof. ................ r64858 | brett.cannon | 2008-07-11 10:10:49 +1000 (Fri, 11 Jul 2008) | 2 lines Removal an invalid entry as the fixer for urllib is under active development. ................ r64859 | brett.cannon | 2008-07-11 10:12:52 +1000 (Fri, 11 Jul 2008) | 3 lines Document the fact that urllib2 spans multiple modules with new names in Python 3.0. ................ r64861 | brett.cannon | 2008-07-11 10:16:30 +1000 (Fri, 11 Jul 2008) | 1 line Doc that urlparse is named urllib.parse in Python 3.0. ................ r64865 | brett.cannon | 2008-07-11 10:48:57 +1000 (Fri, 11 Jul 2008) | 1 line Doc that robotparse has been renamed urllib.robotparser in Python 3.0. ................ r64866 | brett.cannon | 2008-07-11 10:50:01 +1000 (Fri, 11 Jul 2008) | 1 line Fix a minor typo in the last entry made. ................ r64871 | raymond.hettinger | 2008-07-11 22:00:21 +1000 (Fri, 11 Jul 2008) | 1 line Add cautionary note on the use of PySequence_Fast_ITEMS. ................ r64880 | amaury.forgeotdarc | 2008-07-12 07:28:25 +1000 (Sat, 12 Jul 2008) | 5 lines #3317 in zipfile module, restore the previous names of global variables: some applications relied on them. Also remove duplicated lines. ................ r64881 | amaury.forgeotdarc | 2008-07-12 07:45:06 +1000 (Sat, 12 Jul 2008) | 3 lines #3342: In tracebacks, printed source lines were not indented since r62555. #3343: Py_DisplaySourceLine should be a private function. Rename it to _Py_DisplaySourceLine. ................ r64882 | josiah.carlson | 2008-07-12 08:17:14 +1000 (Sat, 12 Jul 2008) | 2 lines Fix for the AttributeError in test_asynchat. ................ r64885 | josiah.carlson | 2008-07-12 09:26:59 +1000 (Sat, 12 Jul 2008) | 2 lines Fixed test for asyncore. ................ Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/c-api/float.rst python/branches/tlee-ast-optimize/Doc/c-api/int.rst python/branches/tlee-ast-optimize/Doc/c-api/sequence.rst python/branches/tlee-ast-optimize/Doc/library/collections.rst python/branches/tlee-ast-optimize/Doc/library/gc.rst python/branches/tlee-ast-optimize/Doc/library/robotparser.rst python/branches/tlee-ast-optimize/Doc/library/shutil.rst python/branches/tlee-ast-optimize/Doc/library/sys.rst python/branches/tlee-ast-optimize/Doc/library/urllib2.rst python/branches/tlee-ast-optimize/Doc/library/urlparse.rst python/branches/tlee-ast-optimize/Doc/tools/sphinxext/opensearch.xml python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst python/branches/tlee-ast-optimize/Include/floatobject.h python/branches/tlee-ast-optimize/Include/intobject.h python/branches/tlee-ast-optimize/Include/traceback.h python/branches/tlee-ast-optimize/Lib/SimpleHTTPServer.py python/branches/tlee-ast-optimize/Lib/asynchat.py python/branches/tlee-ast-optimize/Lib/asyncore.py python/branches/tlee-ast-optimize/Lib/bisect.py python/branches/tlee-ast-optimize/Lib/curses/textpad.py python/branches/tlee-ast-optimize/Lib/fractions.py python/branches/tlee-ast-optimize/Lib/httplib.py python/branches/tlee-ast-optimize/Lib/lib2to3/ (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports.py python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py python/branches/tlee-ast-optimize/Lib/optparse.py python/branches/tlee-ast-optimize/Lib/subprocess.py python/branches/tlee-ast-optimize/Lib/test/regrtest.py python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py python/branches/tlee-ast-optimize/Lib/test/test_audioop.py python/branches/tlee-ast-optimize/Lib/test/test_bisect.py python/branches/tlee-ast-optimize/Lib/test/test_bz2.py python/branches/tlee-ast-optimize/Lib/test/test_exceptions.py python/branches/tlee-ast-optimize/Lib/test/test_float.py python/branches/tlee-ast-optimize/Lib/test/test_fractions.py python/branches/tlee-ast-optimize/Lib/test/test_lib2to3.py python/branches/tlee-ast-optimize/Lib/test/test_sys.py python/branches/tlee-ast-optimize/Lib/test/test_traceback.py python/branches/tlee-ast-optimize/Lib/unittest.py python/branches/tlee-ast-optimize/Lib/zipfile.py python/branches/tlee-ast-optimize/Misc/ACKS python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/Setup.dist python/branches/tlee-ast-optimize/Modules/_bisectmodule.c python/branches/tlee-ast-optimize/Modules/_fileio.c python/branches/tlee-ast-optimize/Modules/_testcapimodule.c python/branches/tlee-ast-optimize/Modules/audioop.c python/branches/tlee-ast-optimize/Modules/bz2module.c python/branches/tlee-ast-optimize/Modules/cmathmodule.c python/branches/tlee-ast-optimize/Modules/gcmodule.c python/branches/tlee-ast-optimize/Modules/timemodule.c python/branches/tlee-ast-optimize/Objects/abstract.c python/branches/tlee-ast-optimize/Objects/bytearrayobject.c python/branches/tlee-ast-optimize/Objects/exceptions.c python/branches/tlee-ast-optimize/Objects/floatobject.c python/branches/tlee-ast-optimize/Objects/frameobject.c python/branches/tlee-ast-optimize/Objects/intobject.c python/branches/tlee-ast-optimize/Objects/longobject.c python/branches/tlee-ast-optimize/Objects/object.c python/branches/tlee-ast-optimize/Objects/setobject.c python/branches/tlee-ast-optimize/Objects/unicodeobject.c python/branches/tlee-ast-optimize/Python/_warnings.c python/branches/tlee-ast-optimize/Python/sysmodule.c python/branches/tlee-ast-optimize/Python/traceback.c Modified: python/branches/tlee-ast-optimize/Doc/c-api/float.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/c-api/float.rst (original) +++ python/branches/tlee-ast-optimize/Doc/c-api/float.rst Sat Jul 12 06:22:35 2008 @@ -86,10 +86,9 @@ .. versionadded:: 2.6 -.. cfunction:: void PyFloat_CompactFreeList(size_t *bc, size_t *bf, size_t *sum) +.. cfunction:: int PyFloat_ClearFreeList(void) - Compact the float free list. *bc* is the number of allocated blocks before - blocks are freed, *bf* is the number of freed blocks and *sum* is the number - of remaining objects in the blocks. + Clear the float free list. Return the number of items that could not + be freed. .. versionadded:: 2.6 Modified: python/branches/tlee-ast-optimize/Doc/c-api/int.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/c-api/int.rst (original) +++ python/branches/tlee-ast-optimize/Doc/c-api/int.rst Sat Jul 12 06:22:35 2008 @@ -122,10 +122,9 @@ (:const:`LONG_MAX`, as defined in the system header files). -.. cfunction:: void PyInt_CompactFreeList(size_t *bc, size_t *bf, size_t *sum) +.. cfunction:: int PyInt_ClearFreeList(void) - Compact the integer free list. *bc* is the number of allocated blocks before - blocks are freed, *bf* is the number of freed blocks and *sum* is the number - of remaining objects in the blocks. + Clear the integer free list. Return the number of items that could not + be freed. .. versionadded:: 2.6 Modified: python/branches/tlee-ast-optimize/Doc/c-api/sequence.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/c-api/sequence.rst (original) +++ python/branches/tlee-ast-optimize/Doc/c-api/sequence.rst Sat Jul 12 06:22:35 2008 @@ -143,6 +143,10 @@ Return the underlying array of PyObject pointers. Assumes that *o* was returned by :cfunc:`PySequence_Fast` and *o* is not *NULL*. + + Note, if a list gets resized, the reallocation may relocate the items array. + So, only use the underlying array pointer in contexts where the sequence + cannot change. .. versionadded:: 2.4 Modified: python/branches/tlee-ast-optimize/Doc/library/collections.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/collections.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/collections.rst Sat Jul 12 06:22:35 2008 @@ -46,42 +46,50 @@ The collections module offers the following ABCs: -========================= ==================== ====================== ==================================================== -ABC Inherits Abstract Methods Mixin Methods -========================= ==================== ====================== ==================================================== -:class:`Container` ``__contains__`` -:class:`Hashable` ``__hash__`` -:class:`Iterable` ``__iter__`` -:class:`Iterator` :class:`Iterable` ``__next__`` ``__iter__`` -:class:`Sized` ``__len__`` - -:class:`Mapping` :class:`Sized`, ``__getitem__``, ``__contains__``, ``keys``, ``items``, ``values``, - :class:`Iterable`, ``__len__``. and ``get``, ``__eq__``, and ``__ne__`` - :class:`Container` ``__iter__`` - -:class:`MutableMapping` :class:`Mapping` ``__getitem__`` Inherited Mapping methods and - ``__setitem__``, ``pop``, ``popitem``, ``clear``, ``update``, - ``__delitem__``, and ``setdefault`` - ``__iter__``, and - ``__len__`` - -:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``. ``__iter__``, ``__reversed__``. - :class:`Iterable`, and ``__len__`` ``index``, and ``count`` - :class:`Container` - -:class:`MutableSequnce` :class:`Sequence` ``__getitem__`` Inherited Sequence methods and - ``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``, - ``insert``, ``remove``, and ``__iadd__`` - and ``__len__`` - -:class:`Set` :class:`Sized`, ``__len__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, - :class:`Iterable`, ``__iter__``, and ``__gt__``, ``__ge__``, ``__and__``, ``__or__`` - :class:`Container` ``__contains__`` ``__sub__``, ``__xor__``, and ``isdisjoint`` - -:class:`MutableSet` :class:`Set` ``add`` and Inherited Set methods and - ``discard`` ``clear``, ``pop``, ``remove``, ``__ior__``, - ``__iand__``, ``__ixor__``, and ``__isub__`` -========================= ==================== ====================== ==================================================== +========================= ===================== ====================== ==================================================== +ABC Inherits Abstract Methods Mixin Methods +========================= ===================== ====================== ==================================================== +:class:`Container` ``__contains__`` +:class:`Hashable` ``__hash__`` +:class:`Iterable` ``__iter__`` +:class:`Iterator` :class:`Iterable` ``__next__`` ``__iter__`` +:class:`Sized` ``__len__`` +:class:`Callable` ``__call__`` + +:class:`Sequence` :class:`Sized`, ``__getitem__`` ``__contains__``. ``__iter__``, ``__reversed__``. + :class:`Iterable`, and ``__len__`` ``index``, and ``count`` + :class:`Container` + +:class:`MutableSequnce` :class:`Sequence` ``__getitem__`` Inherited Sequence methods and + ``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``, + ``insert``, ``remove``, and ``__iadd__`` + and ``__len__`` + +:class:`Set` :class:`Sized`, ``__len__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, + :class:`Iterable`, ``__iter__``, and ``__gt__``, ``__ge__``, ``__and__``, ``__or__`` + :class:`Container` ``__contains__`` ``__sub__``, ``__xor__``, and ``isdisjoint`` + +:class:`MutableSet` :class:`Set` ``add`` and Inherited Set methods and + ``discard`` ``clear``, ``pop``, ``remove``, ``__ior__``, + ``__iand__``, ``__ixor__``, and ``__isub__`` + +:class:`Mapping` :class:`Sized`, ``__getitem__``, ``__contains__``, ``keys``, ``items``, ``values``, + :class:`Iterable`, ``__len__``. and ``get``, ``__eq__``, and ``__ne__`` + :class:`Container` ``__iter__`` + +:class:`MutableMapping` :class:`Mapping` ``__getitem__`` Inherited Mapping methods and + ``__setitem__``, ``pop``, ``popitem``, ``clear``, ``update``, + ``__delitem__``, and ``setdefault`` + ``__iter__``, and + ``__len__`` + +:class:`MappingView` :class:`Sized` ``__len__`` +:class:`KeysView` :class:`MappingView`, ``__contains__``, + :class:`Set` ``__iter__`` +:class:`ItemsView` :class:`MappingView`, ``__contains__``, + :class:`Set` ``__iter__`` +:class:`ValuesView` :class:`MappingView` ``__contains__``, ``__iter__`` +========================= ===================== ====================== ==================================================== These ABCs allow us to ask classes or instances if they provide particular functionality, for example:: Modified: python/branches/tlee-ast-optimize/Doc/library/gc.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/gc.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/gc.rst Sat Jul 12 06:22:35 2008 @@ -47,6 +47,12 @@ .. versionchanged:: 2.5 The optional *generation* argument was added. + .. versionchanged:: 2.6 + The free lists maintained for a number of builtin types are cleared + whenever a full collection or collection of the highest generation (2) + is run. Not all items in some free lists may be freed due to the + particular implementation, in particular :class:`int` and :class:`float`. + .. function:: set_debug(flags) Modified: python/branches/tlee-ast-optimize/Doc/library/robotparser.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/robotparser.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/robotparser.rst Sat Jul 12 06:22:35 2008 @@ -13,6 +13,12 @@ single: World Wide Web single: URL single: robots.txt + +.. note:: + The :mod:`robotparser` module has been renamed :mod:`urllib.robotparser` in + Python 3.0. + The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. This module provides a single class, :class:`RobotFileParser`, which answers questions about whether or not a particular user agent can fetch a URL on the Modified: python/branches/tlee-ast-optimize/Doc/library/shutil.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/shutil.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/shutil.rst Sat Jul 12 06:22:35 2008 @@ -82,7 +82,7 @@ This factory function creates a function that can be used as a callable for :func:`copytree`\'s *ignore* argument, ignoring files and directories that - match one the glob-style *patterns* provided. See the example below. + match one of the glob-style *patterns* provided. See the example below. .. versionadded:: 2.6 Modified: python/branches/tlee-ast-optimize/Doc/library/sys.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/sys.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/sys.rst Sat Jul 12 06:22:35 2008 @@ -58,22 +58,6 @@ A string containing the copyright pertaining to the Python interpreter. -.. function:: _compact_freelists() - - Compact the free lists of integers and floats by deallocating unused blocks. - It can reduce the memory usage of the Python process several tenth of - thousands of integers or floats have been allocated at once. - - The return value is a tuple of tuples each containing three elements, - amount of used objects, total block count before the blocks are deallocated - and amount of freed blocks. The first tuple refers to ints, the second to - floats. - - This function should be used for specialized purposes only. - - .. versionadded:: 2.6 - - .. function:: _clear_type_cache() Clear the internal type cache. The type cache is used to speed up attribute @@ -409,13 +393,20 @@ :func:`setrecursionlimit`. -.. function:: getsizeof(object) +.. function:: getsizeof(object[, default]) Return the size of an object in bytes. The object can be any type of object. All built-in objects will return correct results, but this - does not have to hold true for third-party extensions as it is implementation + does not have to hold true for third-party extensions as it is implementation specific. + The *default* argument allows to define a value which will be returned + if the object type does not provide means to retrieve the size and would + cause a `TypeError`. + + func:`getsizeof` calls the object's __sizeof__ method and adds an additional + garbage collector overhead if the object is managed by the garbage collector. + .. versionadded:: 2.6 Modified: python/branches/tlee-ast-optimize/Doc/library/urllib2.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/urllib2.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/urllib2.rst Sat Jul 12 06:22:35 2008 @@ -7,6 +7,13 @@ .. sectionauthor:: Moshe Zadka +.. note:: + The :mod:`urllib2` module has been split across several modules in + Python 3.0 named :mod:`urllib.request` and :mod:`urllib.error`. + The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. + + The :mod:`urllib2` module defines functions and classes which help in opening URLs (mostly HTTP) in a complex world --- basic and digest authentication, redirections, cookies and more. Modified: python/branches/tlee-ast-optimize/Doc/library/urlparse.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/urlparse.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/urlparse.rst Sat Jul 12 06:22:35 2008 @@ -12,6 +12,12 @@ pair: URL; parsing pair: relative; URL +.. note:: + The :mod:`urlparse` module is renamed to :mod:`urllib.parse` in Python 3.0. + The :term:`2to3` tool will automatically adapt imports when converting + your sources to 3.0. + + This module defines a standard interface to break Uniform Resource Locator (URL) strings up in components (addressing scheme, network location, path etc.), to combine the components back into a URL string, and to convert a "relative URL" Modified: python/branches/tlee-ast-optimize/Doc/tools/sphinxext/opensearch.xml ============================================================================== --- python/branches/tlee-ast-optimize/Doc/tools/sphinxext/opensearch.xml (original) +++ python/branches/tlee-ast-optimize/Doc/tools/sphinxext/opensearch.xml Sat Jul 12 06:22:35 2008 @@ -1,14 +1,4 @@ - - - Python Docs - Python Documentation - Search the Python documentation - utf-8 - - - - - - http://www.python.org/images/favicon16x16.ico - - +{% extends "!opensearch.xml" %} +{% block extra -%} +http://www.python.org/images/favicon16x16.ico +{%- endblock %} Modified: python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst (original) +++ python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst Sat Jul 12 06:22:35 2008 @@ -1681,6 +1681,11 @@ available, instead of restricting itself to protocol 1. (Contributed by W. Barnes; :issue:`1551443`.) +* The :mod:`cgi` module will now read variables from the query string of an + HTTP POST request. This makes it possible to use form actions with + URLs such as "/cgi-bin/add.py?category=1". (Contributed by + Alexandre Fiori and Nubis; :issue:`1817`.) + * The :mod:`cmath` module underwent an extensive set of revisions, thanks to Mark Dickinson and Christian Heimes, that added some new features and greatly improved the accuracy of the computations. @@ -2137,6 +2142,24 @@ * The :mod:`sets` module has been deprecated; it's better to use the built-in :class:`set` and :class:`frozenset` types. +* The :func:`shutil.copytree` function now has an optional **ignore** argument + that takes a callable object. This callable will receive each directory path + and a list of the directory's contents, and returns a list of names that + will be ignored, not copied. + + The :mod:`shutil` module also provides an :func:`ignore_patterns` + function for use with this new parameter. + :func:`ignore_patterns` takes an arbitrary number of glob-style patterns + and will ignore any files and directories that match this pattern. + The following example copies a directory tree, but skip both SVN's internal + :file:`.svn` directories and Emacs backup + files, which have names ending with '~':: + + shutil.copytree('Doc/library', '/tmp/library', + ignore=shutil.ignore_patterns('*~', '.svn')) + + (Contributed by Tarek Ziad?; :issue:`2663`.) + * Integrating signal handling with GUI handling event loops like those used by Tkinter or GTk+ has long been a problem; most software ends up polling, waking up every fraction of a second. @@ -2500,9 +2523,10 @@ ... ValueError: malformed string -The module also includes -:class:`NodeVisitor` and :class:`NodeTransformer` classes -for traversing and modifying an AST, and functions for common transformations such as changing line numbers. +The module also includes :class:`NodeVisitor` and +:class:`NodeTransformer` classes for traversing and modifying an AST, +and functions for common transformations such as changing line +numbers. .. ====================================================================== Modified: python/branches/tlee-ast-optimize/Include/floatobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/floatobject.h (original) +++ python/branches/tlee-ast-optimize/Include/floatobject.h Sat Jul 12 06:22:35 2008 @@ -113,7 +113,7 @@ PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le); /* free list api */ -PyAPI_FUNC(void) PyFloat_CompactFreeList(size_t *, size_t *, size_t *); +PyAPI_FUNC(int) PyFloat_ClearFreeList(void); /* Format the object based on the format_spec, as defined in PEP 3101 (Advanced String Formatting). */ Modified: python/branches/tlee-ast-optimize/Include/intobject.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/intobject.h (original) +++ python/branches/tlee-ast-optimize/Include/intobject.h Sat Jul 12 06:22:35 2008 @@ -60,7 +60,7 @@ PyAPI_FUNC(long) PyOS_strtol(char *, char **, int); /* free list api */ -PyAPI_FUNC(void) PyInt_CompactFreeList(size_t *, size_t *, size_t *); +PyAPI_FUNC(int) PyInt_ClearFreeList(void); /* Convert an integer to the given base. Returns a string. If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'. Modified: python/branches/tlee-ast-optimize/Include/traceback.h ============================================================================== --- python/branches/tlee-ast-optimize/Include/traceback.h (original) +++ python/branches/tlee-ast-optimize/Include/traceback.h Sat Jul 12 06:22:35 2008 @@ -19,7 +19,7 @@ PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); -PyAPI_FUNC(int) Py_DisplaySourceLine(PyObject *, const char *, int); +PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, const char *, int, int); /* Reveal traceback type so we can typecheck traceback objects */ PyAPI_DATA(PyTypeObject) PyTraceBack_Type; Modified: python/branches/tlee-ast-optimize/Lib/SimpleHTTPServer.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/SimpleHTTPServer.py (original) +++ python/branches/tlee-ast-optimize/Lib/SimpleHTTPServer.py Sat Jul 12 06:22:35 2008 @@ -79,12 +79,11 @@ else: return self.list_directory(path) ctype = self.guess_type(path) - if ctype.startswith('text/'): - mode = 'r' - else: - mode = 'rb' try: - f = open(path, mode) + # Always read in binary mode. Opening files in text mode may cause + # newline translations, making the actual size of the content + # transmitted *less* than the content-length! + f = open(path, 'rb') except IOError: self.send_error(404, "File not found") return None Modified: python/branches/tlee-ast-optimize/Lib/asynchat.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/asynchat.py (original) +++ python/branches/tlee-ast-optimize/Lib/asynchat.py Sat Jul 12 06:22:35 2008 @@ -59,7 +59,7 @@ ac_in_buffer_size = 4096 ac_out_buffer_size = 4096 - def __init__ (self, conn=None): + def __init__ (self, sock=None, map=None): # for string terminator matching self.ac_in_buffer = '' @@ -74,7 +74,7 @@ # we toss the use of the "simple producer" and replace it with # a pure deque, which the original fifo was a wrapping of self.producer_fifo = deque() - asyncore.dispatcher.__init__ (self, conn) + asyncore.dispatcher.__init__ (self, sock, map) def collect_incoming_data(self, data): raise NotImplementedError("must be implemented in subclass") Modified: python/branches/tlee-ast-optimize/Lib/asyncore.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/asyncore.py (original) +++ python/branches/tlee-ast-optimize/Lib/asyncore.py Sat Jul 12 06:22:35 2008 @@ -99,8 +99,10 @@ obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() - if flags & (select.POLLERR | select.POLLHUP | select.POLLNVAL): + if flags & (select.POLLERR | select.POLLNVAL): obj.handle_expt_event() + if flags & select.POLLHUP: + obj.handle_close() except (ExitNow, KeyboardInterrupt, SystemExit): raise except: @@ -467,7 +469,7 @@ ), 'error' ) - self.close() + self.handle_close() def handle_expt(self): self.log_info('unhandled exception', 'warning') Modified: python/branches/tlee-ast-optimize/Lib/bisect.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/bisect.py (original) +++ python/branches/tlee-ast-optimize/Lib/bisect.py Sat Jul 12 06:22:35 2008 @@ -9,6 +9,8 @@ slice of a to be searched. """ + if lo < 0: + raise ValueError('lo must be non-negative') if hi is None: hi = len(a) while lo < hi: @@ -30,6 +32,8 @@ slice of a to be searched. """ + if lo < 0: + raise ValueError('lo must be non-negative') if hi is None: hi = len(a) while lo < hi: @@ -49,6 +53,8 @@ slice of a to be searched. """ + if lo < 0: + raise ValueError('lo must be non-negative') if hi is None: hi = len(a) while lo < hi: @@ -69,6 +75,8 @@ slice of a to be searched. """ + if lo < 0: + raise ValueError('lo must be non-negative') if hi is None: hi = len(a) while lo < hi: Modified: python/branches/tlee-ast-optimize/Lib/curses/textpad.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/curses/textpad.py (original) +++ python/branches/tlee-ast-optimize/Lib/curses/textpad.py Sat Jul 12 06:22:35 2008 @@ -1,6 +1,7 @@ """Simple textbox editing widget with Emacs-like keybindings.""" -import curses, ascii +import curses +import curses.ascii def rectangle(win, uly, ulx, lry, lrx): """Draw a rectangle with corners at the provided upper-left @@ -54,7 +55,7 @@ returning the index of the last non-blank character.""" last = self.maxx while True: - if ascii.ascii(self.win.inch(y, last)) != ascii.SP: + if curses.ascii.ascii(self.win.inch(y, last)) != curses.ascii.SP: last = min(self.maxx, last+1) break elif last == 0: @@ -76,7 +77,7 @@ pass if self.insert_mode: (backy, backx) = self.win.getyx() - if ascii.isprint(oldch): + if curses.ascii.isprint(oldch): self._insert_printable_char(oldch) self.win.move(backy, backx) @@ -84,12 +85,12 @@ "Process a single editing command." (y, x) = self.win.getyx() self.lastcmd = ch - if ascii.isprint(ch): + if curses.ascii.isprint(ch): if y < self.maxy or x < self.maxx: self._insert_printable_char(ch) - elif ch == ascii.SOH: # ^a + elif ch == curses.ascii.SOH: # ^a self.win.move(y, 0) - elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE): + elif ch in (curses.ascii.STX,curses.KEY_LEFT, curses.ascii.BS,curses.KEY_BACKSPACE): if x > 0: self.win.move(y, x-1) elif y == 0: @@ -98,46 +99,46 @@ self.win.move(y-1, self._end_of_line(y-1)) else: self.win.move(y-1, self.maxx) - if ch in (ascii.BS, curses.KEY_BACKSPACE): + if ch in (curses.ascii.BS, curses.KEY_BACKSPACE): self.win.delch() - elif ch == ascii.EOT: # ^d + elif ch == curses.ascii.EOT: # ^d self.win.delch() - elif ch == ascii.ENQ: # ^e + elif ch == curses.ascii.ENQ: # ^e if self.stripspaces: self.win.move(y, self._end_of_line(y)) else: self.win.move(y, self.maxx) - elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f + elif ch in (curses.ascii.ACK, curses.KEY_RIGHT): # ^f if x < self.maxx: self.win.move(y, x+1) elif y == self.maxy: pass else: self.win.move(y+1, 0) - elif ch == ascii.BEL: # ^g + elif ch == curses.ascii.BEL: # ^g return 0 - elif ch == ascii.NL: # ^j + elif ch == curses.ascii.NL: # ^j if self.maxy == 0: return 0 elif y < self.maxy: self.win.move(y+1, 0) - elif ch == ascii.VT: # ^k + elif ch == curses.ascii.VT: # ^k if x == 0 and self._end_of_line(y) == 0: self.win.deleteln() else: # first undo the effect of self._end_of_line self.win.move(y, x) self.win.clrtoeol() - elif ch == ascii.FF: # ^l + elif ch == curses.ascii.FF: # ^l self.win.refresh() - elif ch in (ascii.SO, curses.KEY_DOWN): # ^n + elif ch in (curses.ascii.SO, curses.KEY_DOWN): # ^n if y < self.maxy: self.win.move(y+1, x) if x > self._end_of_line(y+1): self.win.move(y+1, self._end_of_line(y+1)) - elif ch == ascii.SI: # ^o + elif ch == curses.ascii.SI: # ^o self.win.insertln() - elif ch in (ascii.DLE, curses.KEY_UP): # ^p + elif ch in (curses.ascii.DLE, curses.KEY_UP): # ^p if y > 0: self.win.move(y-1, x) if x > self._end_of_line(y-1): @@ -155,7 +156,7 @@ for x in range(self.maxx+1): if self.stripspaces and x > stop: break - result = result + chr(ascii.ascii(self.win.inch(y, x))) + result = result + chr(curses.ascii.ascii(self.win.inch(y, x))) if self.maxy > 0: result = result + "\n" return result Modified: python/branches/tlee-ast-optimize/Lib/fractions.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/fractions.py (original) +++ python/branches/tlee-ast-optimize/Lib/fractions.py Sat Jul 12 06:22:35 2008 @@ -96,9 +96,8 @@ if denominator == 0: raise ZeroDivisionError('Fraction(%s, 0)' % numerator) - - numerator = numerator.__index__() - denominator = denominator.__index__() + numerator = operator.index(numerator) + denominator = operator.index(denominator) g = gcd(numerator, denominator) self._numerator = numerator // g self._denominator = denominator // g @@ -111,7 +110,9 @@ Beware that Fraction.from_float(0.3) != Fraction(3, 10). """ - if not isinstance(f, float): + if isinstance(f, numbers.Integral): + f = float(f) + elif not isinstance(f, float): raise TypeError("%s.from_float() only takes floats, not %r (%s)" % (cls.__name__, f, type(f).__name__)) if math.isnan(f) or math.isinf(f): @@ -122,7 +123,9 @@ def from_decimal(cls, dec): """Converts a finite Decimal instance to a rational number, exactly.""" from decimal import Decimal - if not isinstance(dec, Decimal): + if isinstance(dec, numbers.Integral): + dec = Decimal(int(dec)) + elif not isinstance(dec, Decimal): raise TypeError( "%s.from_decimal() only takes Decimals, not %r (%s)" % (cls.__name__, dec, type(dec).__name__)) Modified: python/branches/tlee-ast-optimize/Lib/httplib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/httplib.py (original) +++ python/branches/tlee-ast-optimize/Lib/httplib.py Sat Jul 12 06:22:35 2008 @@ -813,7 +813,7 @@ host_enc = self.host.encode("ascii") except UnicodeEncodeError: host_enc = self.host.encode("idna") - if self.port == HTTP_PORT: + if self.port == self.default_port: self.putheader('Host', host_enc) else: self.putheader('Host', "%s:%s" % (host_enc, self.port)) Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports.py Sat Jul 12 06:22:35 2008 @@ -19,6 +19,11 @@ # XXX: overhead to the fixer. MAPPING = {"StringIO": ("io", ["StringIO"]), "cStringIO": ("io", ["StringIO"]), + "cPickle": ("pickle", ['BadPickleGet', 'HIGHEST_PROTOCOL', + 'PickleError', 'Pickler', 'PicklingError', + 'UnpickleableError', 'Unpickler', 'UnpicklingError', + 'compatible_formats', 'dump', 'dumps', 'format_version', + 'load', 'loads']), "__builtin__" : ("builtins", builtin_names), 'copy_reg': ('copyreg', ['pickle', 'constructor', Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py Sat Jul 12 06:22:35 2008 @@ -1405,10 +1405,7 @@ s = "foo(xreadlines)" self.unchanged(s) -# Disable test, as it takes a too long time to run, and also -# fails in 2.6. -#class Test_imports(FixerTestCase): -class Test_imports: +class Test_imports(FixerTestCase): fixer = "imports" from ..fixes.fix_imports import MAPPING as modules Modified: python/branches/tlee-ast-optimize/Lib/optparse.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/optparse.py (original) +++ python/branches/tlee-ast-optimize/Lib/optparse.py Sat Jul 12 06:22:35 2008 @@ -602,7 +602,7 @@ def _set_attrs(self, attrs): for attr in self.ATTRS: - if attrs.has_key(attr): + if attr in attrs: setattr(self, attr, attrs[attr]) del attrs[attr] else: @@ -701,7 +701,7 @@ def _check_callback(self): if self.action == "callback": - if not callable(self.callback): + if not hasattr(self.callback, '__call__'): raise OptionError( "callback not callable: %r" % self.callback, self) if (self.callback_args is not None and @@ -817,12 +817,6 @@ SUPPRESS_HELP = "SUPPRESS"+"HELP" SUPPRESS_USAGE = "SUPPRESS"+"USAGE" -# For compatibility with Python 2.2 -try: - True, False -except NameError: - (True, False) = (1, 0) - try: basestring except NameError: @@ -860,7 +854,7 @@ are silently ignored. """ for attr in dir(self): - if dict.has_key(attr): + if attr in dict: dval = dict[attr] if dval is not None: setattr(self, attr, dval) @@ -980,10 +974,10 @@ def _check_conflict(self, option): conflict_opts = [] for opt in option._short_opts: - if self._short_opt.has_key(opt): + if opt in self._short_opt: conflict_opts.append((opt, self._short_opt[opt])) for opt in option._long_opts: - if self._long_opt.has_key(opt): + if opt in self._long_opt: conflict_opts.append((opt, self._long_opt[opt])) if conflict_opts: @@ -1029,7 +1023,7 @@ if option.dest is not None: # option has a dest, we need a default if option.default is not NO_DEFAULT: self.defaults[option.dest] = option.default - elif not self.defaults.has_key(option.dest): + elif option.dest not in self.defaults: self.defaults[option.dest] = None return option @@ -1045,8 +1039,8 @@ self._long_opt.get(opt_str)) def has_option(self, opt_str): - return (self._short_opt.has_key(opt_str) or - self._long_opt.has_key(opt_str)) + return (opt_str in self._short_opt or + opt_str in self._long_opt) def remove_option(self, opt_str): option = self._short_opt.get(opt_str) @@ -1664,7 +1658,7 @@ 'words', raise BadOptionError. """ # Is there an exact match? - if wordmap.has_key(s): + if s in wordmap: return s else: # Isolate all words with s as a prefix. Modified: python/branches/tlee-ast-optimize/Lib/subprocess.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/subprocess.py (original) +++ python/branches/tlee-ast-optimize/Lib/subprocess.py Sat Jul 12 06:22:35 2008 @@ -1158,7 +1158,12 @@ input_offset = 0 while read_set or write_set: - rlist, wlist, xlist = select.select(read_set, write_set, []) + try: + rlist, wlist, xlist = select.select(read_set, write_set, []) + except select.error, e: + if e.args[0] == errno.EINTR: + continue + raise if self.stdin in wlist: # When select has indicated that the file is writable, Modified: python/branches/tlee-ast-optimize/Lib/test/regrtest.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/regrtest.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/regrtest.py Sat Jul 12 06:22:35 2008 @@ -91,6 +91,8 @@ curses - Tests that use curses and will modify the terminal's state and output modes. + lib2to3 - Run the tests for 2to3 (They take a while.) + largefile - It is okay to run some test that may create huge files. These tests can take a long time and may consume >2GB of disk space temporarily. @@ -165,8 +167,8 @@ from test import test_support -RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb', - 'decimal', 'compiler', 'subprocess', 'urlfetch') +RESOURCE_NAMES = ('audio', 'curses', 'lib2to3', 'largefile', 'network', + 'bsddb', 'decimal', 'compiler', 'subprocess', 'urlfetch') def usage(code, msg=''): Modified: python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_asyncore.py Sat Jul 12 06:22:35 2008 @@ -38,6 +38,7 @@ raise asyncore.ExitNow() handle_write_event = handle_read_event + handle_close = handle_read_event handle_expt_event = handle_read_event class crashingdummy: @@ -48,6 +49,7 @@ raise Exception() handle_write_event = handle_read_event + handle_close = handle_read_event handle_expt_event = handle_read_event def handle_error(self): @@ -117,6 +119,7 @@ def __init__(self): self.read = False self.write = False + self.closed = False self.expt = False def handle_read_event(self): @@ -125,6 +128,9 @@ def handle_write_event(self): self.write = True + def handle_close(self): + self.closed = True + def handle_expt_event(self): self.expt = True @@ -167,9 +173,9 @@ for flag in (select.POLLERR, select.POLLHUP, select.POLLNVAL): tobj = testobj() - self.assertEqual(tobj.expt, False) + self.assertEqual((tobj.expt, tobj.closed)[flag == select.POLLHUP], False) asyncore.readwrite(tobj, flag) - self.assertEqual(tobj.expt, True) + self.assertEqual((tobj.expt, tobj.closed)[flag == select.POLLHUP], True) # check that ExitNow exceptions in the object handler method # bubbles all the way up through asyncore readwrite calls Modified: python/branches/tlee-ast-optimize/Lib/test/test_audioop.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_audioop.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_audioop.py Sat Jul 12 06:22:35 2008 @@ -161,6 +161,10 @@ self.assertEqual(audioop.getsample(data[1], 2, i), i) self.assertEqual(audioop.getsample(data[2], 4, i), i) + def test_negavitelen(self): + # from issue 3306, previously it segfaulted + self.assertRaises(audioop.error, + audioop.findmax, ''.join( chr(x) for x in xrange(256)), -2392392) def test_main(): run_unittest(TestAudioop) Modified: python/branches/tlee-ast-optimize/Lib/test/test_bisect.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_bisect.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_bisect.py Sat Jul 12 06:22:35 2008 @@ -114,6 +114,14 @@ self.assertEqual(func(data, elem), expected) self.assertEqual(func(UserList(data), elem), expected) + def test_negative_lo(self): + # Issue 3301 + mod = self.module + self.assertRaises(ValueError, mod.bisect_left, [1, 2, 3], 5, -1, 3), + self.assertRaises(ValueError, mod.bisect_right, [1, 2, 3], 5, -1, 3), + self.assertRaises(ValueError, mod.insort_left, [1, 2, 3], 5, -1, 3), + self.assertRaises(ValueError, mod.insort_right, [1, 2, 3], 5, -1, 3), + def test_random(self, n=25): from random import randrange for i in xrange(n): Modified: python/branches/tlee-ast-optimize/Lib/test/test_bz2.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_bz2.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_bz2.py Sat Jul 12 06:22:35 2008 @@ -112,6 +112,17 @@ self.assertEqual(list(iter(bz2f)), sio.readlines()) bz2f.close() + def testClosedIteratorDeadlock(self): + # "Test that iteration on a closed bz2file releases the lock." + # http://bugs.python.org/issue3309 + self.createTempFile() + bz2f = BZ2File(self.filename) + bz2f.close() + self.assertRaises(ValueError, bz2f.next) + # This call will deadlock of the above .next call failed to + # release the lock. + self.assertRaises(ValueError, bz2f.readlines) + def testXReadLines(self): # "Test BZ2File.xreadlines()" self.createTempFile() Modified: python/branches/tlee-ast-optimize/Lib/test/test_exceptions.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_exceptions.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_exceptions.py Sat Jul 12 06:22:35 2008 @@ -342,6 +342,7 @@ self.failUnless(unicode(Exception)) self.failUnless(str(Exception('a'))) self.failUnless(unicode(Exception(u'a'))) + self.failUnless(unicode(Exception(u'\xe1'))) def test_main(): Modified: python/branches/tlee-ast-optimize/Lib/test/test_float.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_float.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_float.py Sat Jul 12 06:22:35 2008 @@ -253,24 +253,36 @@ floats_file.close() # Beginning with Python 2.6 float has cross platform compatible -# ways to create and representate inf and nan +# ways to create and represent inf and nan class InfNanTest(unittest.TestCase): def test_inf_from_str(self): self.assert_(isinf(float("inf"))) self.assert_(isinf(float("+inf"))) self.assert_(isinf(float("-inf"))) + self.assert_(isinf(float("infinity"))) + self.assert_(isinf(float("+infinity"))) + self.assert_(isinf(float("-infinity"))) self.assertEqual(repr(float("inf")), "inf") self.assertEqual(repr(float("+inf")), "inf") self.assertEqual(repr(float("-inf")), "-inf") + self.assertEqual(repr(float("infinity")), "inf") + self.assertEqual(repr(float("+infinity")), "inf") + self.assertEqual(repr(float("-infinity")), "-inf") self.assertEqual(repr(float("INF")), "inf") self.assertEqual(repr(float("+Inf")), "inf") self.assertEqual(repr(float("-iNF")), "-inf") + self.assertEqual(repr(float("Infinity")), "inf") + self.assertEqual(repr(float("+iNfInItY")), "inf") + self.assertEqual(repr(float("-INFINITY")), "-inf") self.assertEqual(str(float("inf")), "inf") self.assertEqual(str(float("+inf")), "inf") self.assertEqual(str(float("-inf")), "-inf") + self.assertEqual(str(float("infinity")), "inf") + self.assertEqual(str(float("+infinity")), "inf") + self.assertEqual(str(float("-infinity")), "-inf") self.assertRaises(ValueError, float, "info") self.assertRaises(ValueError, float, "+info") @@ -278,6 +290,10 @@ self.assertRaises(ValueError, float, "in") self.assertRaises(ValueError, float, "+in") self.assertRaises(ValueError, float, "-in") + self.assertRaises(ValueError, float, "infinit") + self.assertRaises(ValueError, float, "+Infin") + self.assertRaises(ValueError, float, "-INFI") + self.assertRaises(ValueError, float, "infinitys") def test_inf_as_str(self): self.assertEqual(repr(1e300 * 1e300), "inf") Modified: python/branches/tlee-ast-optimize/Lib/test/test_fractions.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_fractions.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_fractions.py Sat Jul 12 06:22:35 2008 @@ -62,11 +62,11 @@ self.assertRaisesMessage(ZeroDivisionError, "Fraction(12, 0)", F, 12, 0) - self.assertRaises(AttributeError, F, 1.5) - self.assertRaises(AttributeError, F, 1.5 + 3j) + self.assertRaises(TypeError, F, 1.5) + self.assertRaises(TypeError, F, 1.5 + 3j) - self.assertRaises(AttributeError, F, F(1, 2), 3) - self.assertRaises(AttributeError, F, "3/2", 3) + self.assertRaises(TypeError, F, F(1, 2), 3) + self.assertRaises(TypeError, F, "3/2", 3) def testFromString(self): self.assertEquals((5, 1), _components(F("5"))) @@ -137,10 +137,8 @@ self.assertNotEquals(F(4, 2), r) def testFromFloat(self): - self.assertRaisesMessage( - TypeError, "Fraction.from_float() only takes floats, not 3 (int)", - F.from_float, 3) - + self.assertRaises(TypeError, F.from_float, 3+4j) + self.assertEquals((10, 1), _components(F.from_float(10))) self.assertEquals((0, 1), _components(F.from_float(-0.0))) self.assertEquals((10, 1), _components(F.from_float(10.0))) self.assertEquals((-5, 2), _components(F.from_float(-2.5))) @@ -164,10 +162,8 @@ F.from_float, nan) def testFromDecimal(self): - self.assertRaisesMessage( - TypeError, - "Fraction.from_decimal() only takes Decimals, not 3 (int)", - F.from_decimal, 3) + self.assertRaises(TypeError, F.from_decimal, 3+4j) + self.assertEquals(F(10, 1), F.from_decimal(10)) self.assertEquals(F(0), F.from_decimal(Decimal("-0"))) self.assertEquals(F(5, 10), F.from_decimal(Decimal("0.5"))) self.assertEquals(F(5, 1000), F.from_decimal(Decimal("5e-3"))) Modified: python/branches/tlee-ast-optimize/Lib/test/test_lib2to3.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_lib2to3.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_lib2to3.py Sat Jul 12 06:22:35 2008 @@ -2,7 +2,11 @@ # because of running from lib2to3.tests import test_fixers, test_pytree, test_util import unittest -from test.test_support import run_unittest +from test.test_support import run_unittest, requires + +# Don't run lib2to3 tests by default since they take too long +if __name__ != '__main__': + requires('lib2to3') def suite(): tests = unittest.TestSuite() Modified: python/branches/tlee-ast-optimize/Lib/test/test_sys.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_sys.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_sys.py Sat Jul 12 06:22:35 2008 @@ -367,25 +367,6 @@ def test_clear_type_cache(self): sys._clear_type_cache() - def test_compact_freelists(self): - sys._compact_freelists() - r = sys._compact_freelists() -## # freed blocks shouldn't change -## self.assertEqual(r[0][2], 0) -## self.assertEqual(r[1][2], 0) -## # fill freelists -## ints = list(range(10000)) -## floats = [float(i) for i in ints] -## del ints -## del floats -## # should free more than 200 blocks each -## r = sys._compact_freelists() -## self.assert_(r[0][1] > 100, r[0][1]) -## self.assert_(r[1][2] > 100, r[1][1]) -## -## self.assert_(r[0][2] > 100, r[0][2]) -## self.assert_(r[1][2] > 100, r[1][2]) - def test_ioencoding(self): import subprocess,os env = dict(os.environ) @@ -408,6 +389,9 @@ class SizeofTest(unittest.TestCase): + TPFLAGS_HAVE_GC = 1<<14 + TPFLAGS_HEAPTYPE = 1L<<9 + def setUp(self): self.c = len(struct.pack('c', ' ')) self.H = len(struct.pack('H', 0)) @@ -417,22 +401,26 @@ # due to missing size_t information from struct, it is assumed that # sizeof(Py_ssize_t) = sizeof(void*) self.header = 'PP' + self.vheader = self.header + 'P' if hasattr(sys, "gettotalrefcount"): self.header += '2P' + self.vheader += '2P' + import _testcapi + self.gc_headsize = _testcapi.SIZEOF_PYGC_HEAD self.file = open(test.test_support.TESTFN, 'wb') def tearDown(self): self.file.close() test.test_support.unlink(test.test_support.TESTFN) - def check_sizeof(self, o, size, size2=None): - """Check size of o. Possible are size and optionally size2).""" + def check_sizeof(self, o, size): result = sys.getsizeof(o) - msg = 'wrong size for %s: got %d, expected ' % (type(o), result) - if (size2 != None) and (result != size): - self.assertEqual(result, size2, msg + str(size2)) - else: - self.assertEqual(result, size, msg + str(size)) + if ((type(o) == type) and (o.__flags__ & self.TPFLAGS_HEAPTYPE) or\ + ((type(o) != type) and (type(o).__flags__ & self.TPFLAGS_HAVE_GC))): + size += self.gc_headsize + msg = 'wrong size for %s: got %d, expected %d' \ + % (type(o), result, size) + self.assertEqual(result, size, msg) def calcsize(self, fmt): """Wrapper around struct.calcsize which enforces the alignment of the @@ -443,44 +431,123 @@ """ return struct.calcsize(fmt + '0P') - def test_standardtypes(self): + def test_gc_head_size(self): + # Check that the gc header size is added to objects tracked by the gc. + h = self.header + size = self.calcsize + gc_header_size = self.gc_headsize + # bool objects are not gc tracked + self.assertEqual(sys.getsizeof(True), size(h + 'l')) + # but lists are + self.assertEqual(sys.getsizeof([]), size(h + 'P PP') + gc_header_size) + + def test_default(self): h = self.header size = self.calcsize + self.assertEqual(sys.getsizeof(True, -1), size(h + 'l')) + + def test_objecttypes(self): + # check all types defined in Objects/ + h = self.header + vh = self.vheader + size = self.calcsize + check = self.check_sizeof # bool - self.check_sizeof(True, size(h + 'l')) + check(True, size(h + 'l')) # buffer - self.check_sizeof(buffer(''), size(h + '2P2Pil')) + check(buffer(''), size(h + '2P2Pil')) + # builtin_function_or_method + check(len, size(h + '3P')) + # bytearray + samples = ['', 'u'*100000] + for sample in samples: + x = bytearray(sample) + check(x, size(vh + 'iPP') + x.__alloc__() * self.c) + # bytearray_iterator + check(iter(bytearray()), size(h + 'PP')) # cell def get_cell(): x = 42 def inner(): return x return inner - self.check_sizeof(get_cell().func_closure[0], size(h + 'P')) - # old-style class + check(get_cell().func_closure[0], size(h + 'P')) + # classobj (old-style class) class class_oldstyle(): def method(): pass - self.check_sizeof(class_oldstyle, size(h + '6P')) - # instance - self.check_sizeof(class_oldstyle(), size(h + '3P')) - # method - self.check_sizeof(class_oldstyle().method, size(h + '4P')) - # code - self.check_sizeof(get_cell().func_code, size(h + '4i8Pi2P')) + check(class_oldstyle, size(h + '6P')) + # instance (old-style class) + check(class_oldstyle(), size(h + '3P')) + # instancemethod (old-style class) + check(class_oldstyle().method, size(h + '4P')) # complex - self.check_sizeof(complex(0,1), size(h + '2d')) + check(complex(0,1), size(h + '2d')) + # code + check(get_cell().func_code, size(h + '4i8Pi2P')) + # BaseException + check(BaseException(), size(h + '3P')) + # UnicodeEncodeError + check(UnicodeEncodeError("", u"", 0, 0, ""), size(h + '5P2PP')) + # UnicodeDecodeError + check(UnicodeDecodeError("", "", 0, 0, ""), size(h + '5P2PP')) + # UnicodeTranslateError + check(UnicodeTranslateError(u"", 0, 1, ""), size(h + '5P2PP')) + # method_descriptor (descriptor object) + check(str.lower, size(h + '2PP')) + # classmethod_descriptor (descriptor object) + # XXX + # member_descriptor (descriptor object) + import datetime + check(datetime.timedelta.days, size(h + '2PP')) + # getset_descriptor (descriptor object) + import __builtin__ + check(__builtin__.file.closed, size(h + '2PP')) + # wrapper_descriptor (descriptor object) + check(int.__add__, size(h + '2P2P')) + # dictproxy + class C(object): pass + check(C.__dict__, size(h + 'P')) + # method-wrapper (descriptor object) + check({}.__iter__, size(h + '2P')) + # dict + check({}, size(h + '3P2P') + 8*size('P2P')) + x = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8} + check(x, size(h + '3P2P') + (8+16)*size('P2P')) + # dictionary-keyiterator + check({}.iterkeys(), size(h + 'P2PPP')) + # dictionary-valueiterator + check({}.itervalues(), size(h + 'P2PPP')) + # dictionary-itemiterator + check({}.iteritems(), size(h + 'P2PPP')) + # ellipses + check(Ellipsis, size(h + '')) + # EncodingMap + import codecs, encodings.iso8859_3 + x = codecs.charmap_build(encodings.iso8859_3.decoding_table) + check(x, size(h + '32B2iB')) # enumerate - self.check_sizeof(enumerate([]), size(h + 'l3P')) - # reverse - self.check_sizeof(reversed(''), size(h + 'PP')) + check(enumerate([]), size(h + 'l3P')) # file - self.check_sizeof(self.file, size(h + '4P2i4P3i3Pi')) + check(self.file, size(h + '4P2i4P3i3Pi')) # float - self.check_sizeof(float(0), size(h + 'd')) + check(float(0), size(h + 'd')) + # sys.floatinfo + check(sys.float_info, size(vh) + self.P * len(sys.float_info)) + # frame + import inspect + CO_MAXBLOCKS = 20 + x = inspect.currentframe() + ncells = len(x.f_code.co_cellvars) + nfrees = len(x.f_code.co_freevars) + extras = x.f_code.co_stacksize + x.f_code.co_nlocals +\ + ncells + nfrees - 1 + check(x, size(vh + '12P3i') +\ + CO_MAXBLOCKS*struct.calcsize('3i') +\ + self.P + extras*self.P) # function def func(): pass - self.check_sizeof(func, size(h + '9P')) + check(func, size(h + '9P')) class c(): @staticmethod def foo(): @@ -489,75 +556,146 @@ def bar(cls): pass # staticmethod - self.check_sizeof(foo, size(h + 'P')) + check(foo, size(h + 'P')) # classmethod - self.check_sizeof(bar, size(h + 'P')) + check(bar, size(h + 'P')) # generator def get_gen(): yield 1 - self.check_sizeof(get_gen(), size(h + 'Pi2P')) + check(get_gen(), size(h + 'Pi2P')) # integer - self.check_sizeof(1, size(h + 'l')) - # builtin_function_or_method - self.check_sizeof(abs, size(h + '3P')) + check(1, size(h + 'l')) + check(100, size(h + 'l')) + # iterator + check(iter('abc'), size(h + 'lP')) + # callable-iterator + import re + check(re.finditer('',''), size(h + '2P')) + # list + samples = [[], [1,2,3], ['1', '2', '3']] + for sample in samples: + check(sample, size(vh + 'PP') + len(sample)*self.P) + # sortwrapper (list) + # XXX + # cmpwrapper (list) + # XXX + # listiterator (list) + check(iter([]), size(h + 'lP')) + # listreverseiterator (list) + check(reversed([]), size(h + 'lP')) + # long + check(0L, size(vh + 'H') - self.H) + check(1L, size(vh + 'H')) + check(-1L, size(vh + 'H')) + check(32768L, size(vh + 'H') + self.H) + check(32768L*32768L-1, size(vh + 'H') + self.H) + check(32768L*32768L, size(vh + 'H') + 2*self.H) # module - self.check_sizeof(unittest, size(h + 'P')) - # xrange - self.check_sizeof(xrange(1), size(h + '3l')) + check(unittest, size(h + 'P')) + # None + check(None, size(h + '')) + # object + check(object(), size(h + '')) + # property (descriptor object) + class C(object): + def getx(self): return self.__x + def setx(self, value): self.__x = value + def delx(self): del self.__x + x = property(getx, setx, delx, "") + check(x, size(h + '4Pi')) + # PyCObject + # XXX + # rangeiterator + check(iter(xrange(1)), size(h + '4l')) + # reverse + check(reversed(''), size(h + 'PP')) + # set + # frozenset + PySet_MINSIZE = 8 + samples = [[], range(10), range(50)] + s = size(h + '3P2P') +\ + PySet_MINSIZE*struct.calcsize('lP') + self.l + self.P + for sample in samples: + minused = len(sample) + if minused == 0: tmp = 1 + # the computation of minused is actually a bit more complicated + # but this suffices for the sizeof test + minused = minused*2 + newsize = PySet_MINSIZE + while newsize <= minused: + newsize = newsize << 1 + if newsize <= 8: + check(set(sample), s) + check(frozenset(sample), s) + else: + check(set(sample), s + newsize*struct.calcsize('lP')) + check(frozenset(sample), s + newsize*struct.calcsize('lP')) + # setiterator + check(iter(set()), size(h + 'P3P')) # slice - self.check_sizeof(slice(0), size(h + '3P')) - - h += 'P' - # new-style class - class class_newstyle(object): - def method(): - pass - # type (PyTypeObject + PyNumberMethods + PyMappingMethods + - # PySequenceMethods + PyBufferProcs) - self.check_sizeof(class_newstyle, size('P2P15Pl4PP9PP11PI') +\ - size(h + '41P 10P 3P 6P')) - - def test_specialtypes(self): - h = self.header - size = self.calcsize - # dict - self.check_sizeof({}, size(h + '3P2P') + 8*size('P2P')) - longdict = {1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8} - self.check_sizeof(longdict, size(h + '3P2P') + (8+16)*size('P2P')) + check(slice(1), size(h + '3P')) + # str + check('', size(vh + 'lic')) + check('abc', size(vh + 'lic') + 3*self.c) + # super + check(super(int), size(h + '3P')) + # tuple + check((), size(vh)) + check((1,2,3), size(vh) + 3*self.P) + # tupleiterator + check(iter(()), size(h + 'lP')) + # type + # (PyTypeObject + PyNumberMethods + PyMappingMethods + + # PySequenceMethods + PyBufferProcs) + s = size('P2P15Pl4PP9PP11PI') + size(vh + '41P 10P 3P 6P') + class newstyleclass(object): + pass + check(newstyleclass, s) + # builtin type + check(int, s) + # NotImplementedType + import types + check(types.NotImplementedType, s) # unicode usize = len(u'\0'.encode('unicode-internal')) samples = [u'', u'1'*100] # we need to test for both sizes, because we don't know if the string # has been cached for s in samples: - basicsize = size(h + 'PPlP') + usize * (len(s) + 1) - self.check_sizeof(s, basicsize,\ - size2=basicsize + sys.getsizeof(str(s))) - # XXX trigger caching encoded version as Python string - s = samples[1] - try: - getattr(sys, s) - except AttributeError: - pass - finally: - self.check_sizeof(s, basicsize + sys.getsizeof(str(s))) + check(s, size(h + 'PPlP') + usize * (len(s) + 1)) + # weakref + import weakref + check(weakref.ref(int), size(h + '2Pl2P')) + # weakproxy + # XXX + # weakcallableproxy + check(weakref.proxy(int), size(h + '2Pl2P')) + # xrange + check(xrange(1), size(h + '3l')) + check(xrange(66000), size(h + '3l')) - h += 'P' - # list - self.check_sizeof([], size(h + 'PP')) - self.check_sizeof([1, 2, 3], size(h + 'PP') + 3*self.P) - # long - self.check_sizeof(0L, size(h + 'H')) - self.check_sizeof(1L, size(h + 'H')) - self.check_sizeof(-1L, size(h + 'H')) - self.check_sizeof(32768L, size(h + 'H') + self.H) - self.check_sizeof(32768L*32768L-1, size(h + 'H') + self.H) - self.check_sizeof(32768L*32768L, size(h + 'H') + 2*self.H) - # string - self.check_sizeof('', size(h + 'lic')) - self.check_sizeof('abc', size(h + 'lic') + 3*self.c) - # tuple - self.check_sizeof((), size(h)) - self.check_sizeof((1,2,3), size(h) + 3*self.P) + def test_pythontypes(self): + # check all types defined in Python/ + h = self.header + vh = self.vheader + size = self.calcsize + check = self.check_sizeof + # _ast.AST + import _ast + check(_ast.AST(), size(h + '')) + # imp.NullImporter + import imp + check(imp.NullImporter(self.file.name), size(h + '')) + try: + raise TypeError + except TypeError: + tb = sys.exc_info()[2] + # traceback + if tb != None: + check(tb, size(h + '2P2i')) + # symtable entry + # XXX + # sys.flags + check(sys.flags, size(vh) + self.P * len(sys.flags)) def test_main(): Modified: python/branches/tlee-ast-optimize/Lib/test/test_traceback.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_traceback.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_traceback.py Sat Jul 12 06:22:35 2008 @@ -177,7 +177,7 @@ banner, location, source_line = tb_lines self.assert_(banner.startswith('Traceback')) self.assert_(location.startswith(' File')) - self.assert_(source_line.startswith('raise')) + self.assert_(source_line.startswith(' raise')) def test_main(): Modified: python/branches/tlee-ast-optimize/Lib/unittest.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/unittest.py (original) +++ python/branches/tlee-ast-optimize/Lib/unittest.py Sat Jul 12 06:22:35 2008 @@ -68,7 +68,6 @@ # Backward compatibility ############################################################################## if sys.version_info[:2] < (2, 2): - False, True = 0, 1 def isinstance(obj, clsinfo): import __builtin__ if type(clsinfo) in (tuple, list): @@ -79,6 +78,14 @@ return 0 else: return __builtin__.isinstance(obj, clsinfo) +def _CmpToKey(mycmp): + 'Convert a cmp= function into a key= function' + class K(object): + def __init__(self, obj): + self.obj = obj + def __lt__(self, other): + return mycmp(self.obj, other.obj) == -1 + return K ############################################################################## # Test framework core @@ -429,7 +436,7 @@ def addTest(self, test): # sanity checks - if not callable(test): + if not hasattr(test, '__call__'): raise TypeError("the test to add must be callable") if (isinstance(test, (type, types.ClassType)) and issubclass(test, (TestCase, TestSuite))): @@ -584,7 +591,7 @@ return TestSuite([parent(obj.__name__)]) elif isinstance(obj, TestSuite): return obj - elif callable(obj): + elif hasattr(obj, '__call__'): test = obj() if isinstance(test, TestSuite): return test @@ -607,10 +614,10 @@ """Return a sorted sequence of method names found within testCaseClass """ def isTestMethod(attrname, testCaseClass=testCaseClass, prefix=self.testMethodPrefix): - return attrname.startswith(prefix) and callable(getattr(testCaseClass, attrname)) + return attrname.startswith(prefix) and hasattr(getattr(testCaseClass, attrname), '__call__') testFnNames = filter(isTestMethod, dir(testCaseClass)) if self.sortTestMethodsUsing: - testFnNames.sort(self.sortTestMethodsUsing) + testFnNames.sort(key=_CmpToKey(self.sortTestMethodsUsing)) return testFnNames Modified: python/branches/tlee-ast-optimize/Lib/zipfile.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/zipfile.py (original) +++ python/branches/tlee-ast-optimize/Lib/zipfile.py Sat Jul 12 06:22:35 2008 @@ -43,9 +43,9 @@ # The "end of central directory" structure, magic number, size, and indices # (section V.I in the format document) -structEndCentDir = "<4s4H2LH" -magicEndCentDir = "PK\005\006" -sizeEndCentDir = struct.calcsize(structEndCentDir) +structEndArchive = "<4s4H2LH" +stringEndArchive = "PK\005\006" +sizeEndCentDir = struct.calcsize(structEndArchive) _ECD_SIGNATURE = 0 _ECD_DISK_NUMBER = 1 @@ -63,37 +63,9 @@ # The "central directory" structure, magic number, size, and indices # of entries in the structure (section V.F in the format document) structCentralDir = "<4s4B4HL2L5H2L" -magicCentralDir = "PK\001\002" +stringCentralDir = "PK\001\002" sizeCentralDir = struct.calcsize(structCentralDir) -# The "local file header" structure, magic number, size, and indices -# (section V.A in the format document) -structFileHeader = "<4s2B4HL2L2H" -magicFileHeader = "PK\003\004" -sizeFileHeader = struct.calcsize(structFileHeader) - -# The "Zip64 end of central directory locator" structure, magic number, and size -structEndCentDir64Locator = "<4sLQL" -magicEndCentDir64Locator = "PK\x06\x07" -sizeEndCentDir64Locator = struct.calcsize(structEndCentDir64Locator) - -# The "Zip64 end of central directory" record, magic number, size, and indices -# (section V.G in the format document) -structEndCentDir64 = "<4sQ2H2L4Q" -magicEndCentDir64 = "PK\x06\x06" -sizeEndCentDir64 = struct.calcsize(structEndCentDir64) - -_CD64_SIGNATURE = 0 -_CD64_DIRECTORY_RECSIZE = 1 -_CD64_CREATE_VERSION = 2 -_CD64_EXTRACT_VERSION = 3 -_CD64_DISK_NUMBER = 4 -_CD64_DISK_NUMBER_START = 5 -_CD64_NUMBER_ENTRIES_THIS_DISK = 6 -_CD64_NUMBER_ENTRIES_TOTAL = 7 -_CD64_DIRECTORY_SIZE = 8 -_CD64_OFFSET_START_CENTDIR = 9 - # indexes of entries in the central directory structure _CD_SIGNATURE = 0 _CD_CREATE_VERSION = 1 @@ -118,7 +90,7 @@ # The "local file header" structure, magic number, size, and indices # (section V.A in the format document) structFileHeader = "<4s2B4HL2L2H" -magicFileHeader = "PK\003\004" +stringFileHeader = "PK\003\004" sizeFileHeader = struct.calcsize(structFileHeader) _FH_SIGNATURE = 0 @@ -135,15 +107,15 @@ _FH_EXTRA_FIELD_LENGTH = 11 # The "Zip64 end of central directory locator" structure, magic number, and size -structEndCentDir64Locator = "<4sLQL" -magicEndCentDir64Locator = "PK\x06\x07" -sizeEndCentDir64Locator = struct.calcsize(structEndCentDir64Locator) +structEndArchive64Locator = "<4sLQL" +stringEndArchive64Locator = "PK\x06\x07" +sizeEndCentDir64Locator = struct.calcsize(structEndArchive64Locator) # The "Zip64 end of central directory" record, magic number, size, and indices # (section V.G in the format document) -structEndCentDir64 = "<4sQ2H2L4Q" -magicEndCentDir64 = "PK\x06\x06" -sizeEndCentDir64 = struct.calcsize(structEndCentDir64) +structEndArchive64 = "<4sQ2H2L4Q" +stringEndArchive64 = "PK\x06\x06" +sizeEndCentDir64 = struct.calcsize(structEndArchive64) _CD64_SIGNATURE = 0 _CD64_DIRECTORY_RECSIZE = 1 @@ -174,8 +146,8 @@ """ fpin.seek(offset - sizeEndCentDir64Locator, 2) data = fpin.read(sizeEndCentDir64Locator) - sig, diskno, reloff, disks = struct.unpack(structEndCentDir64Locator, data) - if sig != magicEndCentDir64Locator: + sig, diskno, reloff, disks = struct.unpack(structEndArchive64Locator, data) + if sig != stringEndArchive64Locator: return endrec if diskno != 0 or disks != 1: @@ -186,8 +158,8 @@ data = fpin.read(sizeEndCentDir64) sig, sz, create_version, read_version, disk_num, disk_dir, \ dircount, dircount2, dirsize, diroffset = \ - struct.unpack(structEndCentDir64, data) - if sig != magicEndCentDir64: + struct.unpack(structEndArchive64, data) + if sig != stringEndArchive64: return endrec # Update the original endrec using data from the ZIP64 record @@ -215,9 +187,9 @@ # file if this is the case). fpin.seek(-sizeEndCentDir, 2) data = fpin.read() - if data[0:4] == magicEndCentDir and data[-2:] == "\000\000": + if data[0:4] == stringEndArchive and data[-2:] == "\000\000": # the signature is correct and there's no comment, unpack structure - endrec = struct.unpack(structEndCentDir, data) + endrec = struct.unpack(structEndArchive, data) endrec=list(endrec) # Append a blank comment and record start offset @@ -239,11 +211,11 @@ maxCommentStart = max(filesize - (1 << 16) - sizeEndCentDir, 0) fpin.seek(maxCommentStart, 0) data = fpin.read() - start = data.rfind(magicEndCentDir) + start = data.rfind(stringEndArchive) if start >= 0: # found the magic number; attempt to unpack and interpret recData = data[start:start+sizeEndCentDir] - endrec = list(struct.unpack(structEndCentDir, recData)) + endrec = list(struct.unpack(structEndArchive, recData)) comment = data[start+sizeEndCentDir:] # check that comment length is correct if endrec[_ECD_COMMENT_SIZE] == len(comment): @@ -350,7 +322,7 @@ self.create_version = max(45, self.extract_version) filename, flag_bits = self._encodeFilenameFlags() - header = struct.pack(structFileHeader, magicFileHeader, + header = struct.pack(structFileHeader, stringFileHeader, self.extract_version, self.reserved, flag_bits, self.compress_type, dostime, dosdate, CRC, compress_size, file_size, @@ -779,7 +751,7 @@ total = 0 while total < size_cd: centdir = fp.read(sizeCentralDir) - if centdir[0:4] != magicCentralDir: + if centdir[0:4] != stringCentralDir: raise BadZipfile, "Bad magic number for central directory" centdir = struct.unpack(structCentralDir, centdir) if self.debug > 2: @@ -885,7 +857,7 @@ # Skip the file header: fheader = zef_file.read(sizeFileHeader) - if fheader[0:4] != magicFileHeader: + if fheader[0:4] != stringFileHeader: raise BadZipfile, "Bad magic number for file header" fheader = struct.unpack(structFileHeader, fheader) @@ -1173,7 +1145,7 @@ try: filename, flag_bits = zinfo._encodeFilenameFlags() centdir = struct.pack(structCentralDir, - magicCentralDir, create_version, + stringCentralDir, create_version, zinfo.create_system, extract_version, zinfo.reserved, flag_bits, zinfo.compress_type, dostime, dosdate, zinfo.CRC, compress_size, file_size, @@ -1201,13 +1173,13 @@ if pos1 > ZIP64_LIMIT: # Need to write the ZIP64 end-of-archive records zip64endrec = struct.pack( - structEndCentDir64, magicEndCentDir64, + structEndArchive64, stringEndArchive64, 44, 45, 45, 0, 0, count, count, pos2 - pos1, pos1) self.fp.write(zip64endrec) zip64locrec = struct.pack( - structEndCentDir64Locator, - magicEndCentDir64Locator, 0, pos2, 1) + structEndArchive64Locator, + stringEndArchive64Locator, 0, pos2, 1) self.fp.write(zip64locrec) centDirOffset = 0xFFFFFFFF @@ -1218,7 +1190,7 @@ % ZIP_MAX_COMMENT self.comment = self.comment[:ZIP_MAX_COMMENT] - endrec = struct.pack(structEndCentDir, magicEndCentDir, + endrec = struct.pack(structEndArchive, stringEndArchive, 0, 0, count % ZIP_FILECOUNT_LIMIT, count % ZIP_FILECOUNT_LIMIT, pos2 - pos1, centDirOffset, len(self.comment)) Modified: python/branches/tlee-ast-optimize/Misc/ACKS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/ACKS (original) +++ python/branches/tlee-ast-optimize/Misc/ACKS Sat Jul 12 06:22:35 2008 @@ -146,6 +146,7 @@ Matthew Dixon Cowles Christopher A. Craig Laura Creighton +Simon Cross Drew Csillag John Cugini Tom Culliton Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Sat Jul 12 06:22:35 2008 @@ -10,6 +10,11 @@ Core and Builtins ----------------- + +- Issue #2517: Allow unicode messages in Exceptions again by correctly + bypassing the instance dictionary when looking up __unicode__ on + new-style classes. + - Issue #3242: Fix a crash inside the print statement, if sys.stdout is set to a custom object whose write() method happens to install another file in sys.stdout. @@ -26,12 +31,26 @@ 10, -1). - Issue #3219: Calling a function with repeated keyword arguments, f(a=2, a=23), - would not cause a syntax error. This was regression from 2.4 caused by the + would not cause a syntax error. This was a regression from 2.4 caused by the switch to the new compiler. +- Issue #2862: Make int and float freelist management consistent with other + freelists. Changes their CompactFreeList apis into ClearFreeList apis and + calls them via gc.collect(). + Library ------- +- Issue #3285: Fractions from_float() and from_decimal() accept Integral arguments. + +- Issue #3301: Bisect module behaved badly when lo was negative. + +- Issue #839496: SimpleHTTPServer used to open text files in text mode. This is + both unnecessary (HTTP allows text content to be sent in several forms) and + wrong because the actual transmitted size could differ from the + content-length. The problem had been corrected in the 2.4 branch, but never + merged into trunk. + - Issue #2663: add filtering capability to shutil.copytree(). - Issue #1622: Correct interpretation of various ZIP header fields. @@ -42,8 +61,8 @@ archives with comments over 4k were flagged as invalid). Allow writing Zip files with archives by setting the 'comment' attribute of a ZipFile. -- Issue #449227: Now with the rlcompleter module, callable objects are added - "(" when completed. +- Issue #449227: The rlcompleter module now adds "(" to callable objects + when completed. - Issue #3190: Pydoc now hides the automatic module attribute __package__ (the handling is now the same as that of other special attributes like __name__). @@ -51,9 +70,16 @@ - Issue #2885 (partial): The urllib.urlopen() function has been deprecated for removal in Python 3.0 in favor of urllib2.urlopen(). -- Issue #2885 (partial): lib2to3 has been updated to handle the renaming of the - urllib module in Python 3.0 to urllib.request, urllib.parse, and - urllib.error. +- Issue #2113: Fix error in subprocess.Popen if the select system call is + interrupted by a signal. + +- Issue #3309: Fix bz2.BZFile iterator to release its internal lock + properly when raising an exception due to the bz2file being closed. + Prevents a deadlock. + +- Issue #3094: httplib.HTTPSConnection Host: headers no longer include the + redundant ":443" port number designation when the connection is using the + default https port (443). Build ----- @@ -61,6 +87,21 @@ - Issue #3215: Build sqlite3 as sqlite3.dll, not sqlite3.pyd. +Documentation +------------- + +- Document that robotparser has been renamed to urllib.robotparser in + Python 3.0. + +- Document that urlparse has been renamed to urllib.parse in Python 3.0. + +- Document that urllib2 is split across multiple modules and renamed in + Python 3.0. + +- Document that urllib is split across multiple modules and renamed in + Python 3.0. + + What's New in Python 2.6 beta 1? ================================ Modified: python/branches/tlee-ast-optimize/Modules/Setup.dist ============================================================================== --- python/branches/tlee-ast-optimize/Modules/Setup.dist (original) +++ python/branches/tlee-ast-optimize/Modules/Setup.dist Sat Jul 12 06:22:35 2008 @@ -246,9 +246,11 @@ #_md5 md5module.c md5.c -# The _sha module implements the SHA checksum algorithm. -# (NIST's Secure Hash Algorithm.) +# The _sha module implements the SHA checksum algorithms. +# (NIST's Secure Hash Algorithms.) #_sha shamodule.c +#_sha256 sha256module.c +#_sha512 sha512module.c # SGI IRIX specific modules -- off by default. Modified: python/branches/tlee-ast-optimize/Modules/_bisectmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_bisectmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_bisectmodule.c Sat Jul 12 06:22:35 2008 @@ -11,6 +11,10 @@ PyObject *litem; Py_ssize_t mid, res; + if (lo < 0) { + PyErr_SetString(PyExc_ValueError, "lo must be non-negative"); + return -1; + } if (hi == -1) { hi = PySequence_Size(list); if (hi < 0) @@ -108,6 +112,10 @@ PyObject *litem; int mid, res; + if (lo < 0) { + PyErr_SetString(PyExc_ValueError, "lo must be non-negative"); + return -1; + } if (hi == -1) { hi = PySequence_Size(list); if (hi < 0) Modified: python/branches/tlee-ast-optimize/Modules/_fileio.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_fileio.c (original) +++ python/branches/tlee-ast-optimize/Modules/_fileio.c Sat Jul 12 06:22:35 2008 @@ -278,7 +278,6 @@ ret = -1; done: - PyMem_Free(name); return ret; } Modified: python/branches/tlee-ast-optimize/Modules/_testcapimodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_testcapimodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/_testcapimodule.c Sat Jul 12 06:22:35 2008 @@ -967,6 +967,7 @@ PyModule_AddObject(m, "ULLONG_MAX", PyLong_FromUnsignedLongLong(PY_ULLONG_MAX)); PyModule_AddObject(m, "PY_SSIZE_T_MAX", PyInt_FromSsize_t(PY_SSIZE_T_MAX)); PyModule_AddObject(m, "PY_SSIZE_T_MIN", PyInt_FromSsize_t(PY_SSIZE_T_MIN)); + PyModule_AddObject(m, "SIZEOF_PYGC_HEAD", PyInt_FromSsize_t(sizeof(PyGC_Head))); TestError = PyErr_NewException("_testcapi.error", NULL, NULL); Py_INCREF(TestError); Modified: python/branches/tlee-ast-optimize/Modules/audioop.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/audioop.c (original) +++ python/branches/tlee-ast-optimize/Modules/audioop.c Sat Jul 12 06:22:35 2008 @@ -575,7 +575,7 @@ } len1 >>= 1; - if ( len1 < len2 ) { + if ( len2 < 0 || len1 < len2 ) { PyErr_SetString(AudioopError, "Input sample should be longer"); return 0; } Modified: python/branches/tlee-ast-optimize/Modules/bz2module.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/bz2module.c (original) +++ python/branches/tlee-ast-optimize/Modules/bz2module.c Sat Jul 12 06:22:35 2008 @@ -1451,6 +1451,7 @@ PyStringObject* ret; ACQUIRE_LOCK(self); if (self->mode == MODE_CLOSED) { + RELEASE_LOCK(self); PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); return NULL; Modified: python/branches/tlee-ast-optimize/Modules/cmathmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/cmathmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/cmathmodule.c Sat Jul 12 06:22:35 2008 @@ -839,8 +839,10 @@ errno = 0; PyFPE_START_PROTECT("complex function", return 0) x = c_log(x); - if (PyTuple_GET_SIZE(args) == 2) - x = c_quot(x, c_log(y)); + if (PyTuple_GET_SIZE(args) == 2) { + y = c_log(y); + x = c_quot(x, y); + } PyFPE_END_PROTECT(x) if (errno != 0) return math_error(); Modified: python/branches/tlee-ast-optimize/Modules/gcmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/gcmodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/gcmodule.c Sat Jul 12 06:22:35 2008 @@ -736,6 +736,8 @@ (void)PyCFunction_ClearFreeList(); (void)PyTuple_ClearFreeList(); (void)PyUnicode_ClearFreeList(); + (void)PyInt_ClearFreeList(); + (void)PyFloat_ClearFreeList(); } /* This is the main function. Read this to understand how the Modified: python/branches/tlee-ast-optimize/Modules/timemodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/timemodule.c (original) +++ python/branches/tlee-ast-optimize/Modules/timemodule.c Sat Jul 12 06:22:35 2008 @@ -600,8 +600,6 @@ { struct tm buf; time_t tt; - tt = time(&tt); - buf = *localtime(&tt); if (!gettmarg(tup, &buf)) return NULL; tt = mktime(&buf); Modified: python/branches/tlee-ast-optimize/Objects/abstract.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/abstract.c (original) +++ python/branches/tlee-ast-optimize/Objects/abstract.c Sat Jul 12 06:22:35 2008 @@ -1946,7 +1946,7 @@ return m->sq_item(s, i); } - return type_error("'%.200s' object is unindexable", s); + return type_error("'%.200s' object does not support indexing", s); } PyObject * Modified: python/branches/tlee-ast-optimize/Objects/bytearrayobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/bytearrayobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/bytearrayobject.c Sat Jul 12 06:22:35 2008 @@ -3106,6 +3106,19 @@ return Py_BuildValue("(O(Ns)N)", Py_TYPE(self), latin1, "latin-1", dict); } +PyDoc_STRVAR(sizeof_doc, +"B.__sizeof__() -> int\n\ + \n\ +Returns the size of B in memory, in bytes"); +static PyObject * +bytes_sizeof(PyByteArrayObject *self) +{ + Py_ssize_t res; + + res = sizeof(PyByteArrayObject) + self->ob_alloc * sizeof(char); + return PyInt_FromSsize_t(res); +} + static PySequenceMethods bytes_as_sequence = { (lenfunc)bytes_length, /* sq_length */ (binaryfunc)PyByteArray_Concat, /* sq_concat */ @@ -3138,6 +3151,7 @@ bytes_methods[] = { {"__alloc__", (PyCFunction)bytes_alloc, METH_NOARGS, alloc_doc}, {"__reduce__", (PyCFunction)bytes_reduce, METH_NOARGS, reduce_doc}, + {"__sizeof__", (PyCFunction)bytes_sizeof, METH_NOARGS, sizeof_doc}, {"append", (PyCFunction)bytes_append, METH_O, append__doc__}, {"capitalize", (PyCFunction)stringlib_capitalize, METH_NOARGS, _Py_capitalize__doc__}, Modified: python/branches/tlee-ast-optimize/Objects/exceptions.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/exceptions.c (original) +++ python/branches/tlee-ast-optimize/Objects/exceptions.c Sat Jul 12 06:22:35 2008 @@ -117,6 +117,28 @@ return out; } +#ifdef Py_USING_UNICODE +static PyObject * +BaseException_unicode(PyBaseExceptionObject *self) +{ + PyObject *out; + + switch (PyTuple_GET_SIZE(self->args)) { + case 0: + out = PyUnicode_FromString(""); + break; + case 1: + out = PyObject_Unicode(PyTuple_GET_ITEM(self->args, 0)); + break; + default: + out = PyObject_Unicode(self->args); + break; + } + + return out; +} +#endif + static PyObject * BaseException_repr(PyBaseExceptionObject *self) { @@ -181,6 +203,9 @@ static PyMethodDef BaseException_methods[] = { {"__reduce__", (PyCFunction)BaseException_reduce, METH_NOARGS }, {"__setstate__", (PyCFunction)BaseException_setstate, METH_O }, +#ifdef Py_USING_UNICODE + {"__unicode__", (PyCFunction)BaseException_unicode, METH_NOARGS }, +#endif {NULL, NULL, 0, NULL}, }; Modified: python/branches/tlee-ast-optimize/Objects/floatobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/floatobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/floatobject.c Sat Jul 12 06:22:35 2008 @@ -246,6 +246,9 @@ if (PyOS_strnicmp(p, "inf", 4) == 0) { Py_RETURN_INF(sign); } + if (PyOS_strnicmp(p, "infinity", 9) == 0) { + Py_RETURN_INF(sign); + } #ifdef Py_NAN if(PyOS_strnicmp(p, "nan", 4) == 0) { Py_RETURN_NAN; @@ -1605,30 +1608,28 @@ PyStructSequence_InitType(&FloatInfoType, &floatinfo_desc); } -void -PyFloat_CompactFreeList(size_t *pbc, size_t *pbf, size_t *bsum) +int +PyFloat_ClearFreeList(void) { PyFloatObject *p; PyFloatBlock *list, *next; - unsigned i; - size_t bc = 0, bf = 0; /* block count, number of freed blocks */ - size_t fsum = 0; /* total unfreed ints */ - int frem; /* remaining unfreed ints per block */ + int i; + int u; /* remaining unfreed ints per block */ + int freelist_size = 0; list = block_list; block_list = NULL; free_list = NULL; while (list != NULL) { - bc++; - frem = 0; + u = 0; for (i = 0, p = &list->objects[0]; i < N_FLOATOBJECTS; i++, p++) { if (PyFloat_CheckExact(p) && Py_REFCNT(p) != 0) - frem++; + u++; } next = list->next; - if (frem) { + if (u) { list->next = block_list; block_list = list; for (i = 0, p = &list->objects[0]; @@ -1643,15 +1644,12 @@ } } else { - PyMem_FREE(list); /* XXX PyObject_FREE ??? */ - bf++; + PyMem_FREE(list); } - fsum += frem; + freelist_size += u; list = next; } - *pbc = bc; - *pbf = bf; - *bsum = fsum; + return freelist_size; } void @@ -1659,25 +1657,21 @@ { PyFloatObject *p; PyFloatBlock *list; - unsigned i; - size_t bc, bf; /* block count, number of freed blocks */ - size_t fsum; /* total unfreed floats per block */ + int i; + int u; /* total unfreed floats per block */ - PyFloat_CompactFreeList(&bc, &bf, &fsum); + u = PyFloat_ClearFreeList(); if (!Py_VerboseFlag) return; fprintf(stderr, "# cleanup floats"); - if (!fsum) { + if (!u) { fprintf(stderr, "\n"); } else { fprintf(stderr, - ": %" PY_FORMAT_SIZE_T "d unfreed float%s in %" - PY_FORMAT_SIZE_T "d out of %" - PY_FORMAT_SIZE_T "d block%s\n", - fsum, fsum == 1 ? "" : "s", - bc - bf, bc, bc == 1 ? "" : "s"); + ": %d unfreed float%s\n", + u, u == 1 ? "" : "s"); } if (Py_VerboseFlag > 1) { list = block_list; Modified: python/branches/tlee-ast-optimize/Objects/frameobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/frameobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/frameobject.c Sat Jul 12 06:22:35 2008 @@ -508,6 +508,29 @@ } } +static PyObject * +frame_sizeof(PyFrameObject *f) +{ + Py_ssize_t res, extras, ncells, nfrees; + + ncells = PyTuple_GET_SIZE(f->f_code->co_cellvars); + nfrees = PyTuple_GET_SIZE(f->f_code->co_freevars); + extras = f->f_code->co_stacksize + f->f_code->co_nlocals + + ncells + nfrees; + // subtract one as it is already included in PyFrameObject + res = sizeof(PyFrameObject) + (extras-1) * sizeof(PyObject *); + + return PyInt_FromSsize_t(res); +} + +PyDoc_STRVAR(sizeof__doc__, +"F.__sizeof__() -> size of F in memory, in bytes"); + +static PyMethodDef frame_methods[] = { + {"__sizeof__", (PyCFunction)frame_sizeof, METH_NOARGS, + sizeof__doc__}, + {NULL, NULL} /* sentinel */ +}; PyTypeObject PyFrame_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) @@ -537,7 +560,7 @@ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - 0, /* tp_methods */ + frame_methods, /* tp_methods */ frame_memberlist, /* tp_members */ frame_getsetlist, /* tp_getset */ 0, /* tp_base */ Modified: python/branches/tlee-ast-optimize/Objects/intobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/intobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/intobject.c Sat Jul 12 06:22:35 2008 @@ -1296,35 +1296,33 @@ return 1; } -void -PyInt_CompactFreeList(size_t *pbc, size_t *pbf, size_t *bsum) +int +PyInt_ClearFreeList(void) { PyIntObject *p; PyIntBlock *list, *next; - unsigned int ctr; - size_t bc = 0, bf = 0; /* block count, number of freed blocks */ - size_t isum = 0; /* total unfreed ints */ - int irem; /* remaining unfreed ints per block */ + int i; + int u; /* remaining unfreed ints per block */ + int freelist_size = 0; list = block_list; block_list = NULL; free_list = NULL; while (list != NULL) { - bc++; - irem = 0; - for (ctr = 0, p = &list->objects[0]; - ctr < N_INTOBJECTS; - ctr++, p++) { + u = 0; + for (i = 0, p = &list->objects[0]; + i < N_INTOBJECTS; + i++, p++) { if (PyInt_CheckExact(p) && p->ob_refcnt != 0) - irem++; + u++; } next = list->next; - if (irem) { + if (u) { list->next = block_list; block_list = list; - for (ctr = 0, p = &list->objects[0]; - ctr < N_INTOBJECTS; - ctr++, p++) { + for (i = 0, p = &list->objects[0]; + i < N_INTOBJECTS; + i++, p++) { if (!PyInt_CheckExact(p) || p->ob_refcnt == 0) { Py_TYPE(p) = (struct _typeobject *) @@ -1345,15 +1343,12 @@ } else { PyMem_FREE(list); - bf++; } - isum += irem; + freelist_size += u; list = next; } - *pbc = bc; - *pbf = bf; - *bsum = isum; + return freelist_size; } void @@ -1361,12 +1356,10 @@ { PyIntObject *p; PyIntBlock *list; - unsigned int ctr; - size_t bc, bf; /* block count, number of freed blocks */ - size_t isum; /* total unfreed ints per block */ + int i; + int u; /* total unfreed ints per block */ #if NSMALLNEGINTS + NSMALLPOSINTS > 0 - int i; PyIntObject **q; i = NSMALLNEGINTS + NSMALLPOSINTS; @@ -1376,27 +1369,24 @@ *q++ = NULL; } #endif - PyInt_CompactFreeList(&bc, &bf, &isum); + u = PyInt_ClearFreeList(); if (!Py_VerboseFlag) return; fprintf(stderr, "# cleanup ints"); - if (!isum) { + if (!u) { fprintf(stderr, "\n"); } else { fprintf(stderr, - ": %" PY_FORMAT_SIZE_T "d unfreed int%s in %" - PY_FORMAT_SIZE_T "d out of %" - PY_FORMAT_SIZE_T "d block%s\n", - isum, isum == 1 ? "" : "s", - bc - bf, bc, bc == 1 ? "" : "s"); + ": %d unfreed int%s\n", + u, u == 1 ? "" : "s"); } if (Py_VerboseFlag > 1) { list = block_list; while (list != NULL) { - for (ctr = 0, p = &list->objects[0]; - ctr < N_INTOBJECTS; - ctr++, p++) { + for (i = 0, p = &list->objects[0]; + i < N_INTOBJECTS; + i++, p++) { if (PyInt_CheckExact(p) && p->ob_refcnt != 0) /* XXX(twouters) cast refcount to long until %zd is universally Modified: python/branches/tlee-ast-optimize/Objects/longobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/longobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/longobject.c Sat Jul 12 06:22:35 2008 @@ -3441,9 +3441,9 @@ { Py_ssize_t res; - res = sizeof(PyLongObject) + abs(v->ob_size) * sizeof(digit); + res = v->ob_type->tp_basicsize; if (v->ob_size != 0) - res -= sizeof(digit); + res += abs(v->ob_size) * sizeof(digit); return PyInt_FromSsize_t(res); } Modified: python/branches/tlee-ast-optimize/Objects/object.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/object.c (original) +++ python/branches/tlee-ast-optimize/Objects/object.c Sat Jul 12 06:22:35 2008 @@ -458,6 +458,7 @@ PyObject *res; PyObject *func; PyObject *str; + int unicode_method_found = 0; static PyObject *unicodestr; if (v == NULL) { @@ -471,26 +472,46 @@ Py_INCREF(v); return v; } - /* XXX As soon as we have a tp_unicode slot, we should - check this before trying the __unicode__ - method. */ + + /* Try the __unicode__ method */ if (unicodestr == NULL) { unicodestr= PyString_InternFromString("__unicode__"); if (unicodestr == NULL) return NULL; } - func = PyObject_GetAttr(v, unicodestr); - if (func != NULL) { - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); + if (PyInstance_Check(v)) { + /* We're an instance of a classic class */ + /* Try __unicode__ from the instance -- alas we have no type */ + func = PyObject_GetAttr(v, unicodestr); + if (func != NULL) { + unicode_method_found = 1; + res = PyObject_CallFunctionObjArgs(func, NULL); + Py_DECREF(func); + } + else { + PyErr_Clear(); + } } else { - PyErr_Clear(); + /* Not a classic class instance, try __unicode__ from type */ + /* _PyType_Lookup doesn't create a reference */ + func = _PyType_Lookup(Py_TYPE(v), unicodestr); + if (func != NULL) { + unicode_method_found = 1; + res = PyObject_CallFunctionObjArgs(func, v, NULL); + } + else { + PyErr_Clear(); + } + } + + /* Didn't find __unicode__ */ + if (!unicode_method_found) { if (PyUnicode_Check(v)) { /* For a Unicode subtype that's didn't overwrite __unicode__, return a true Unicode object with the same data. */ return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(v), - PyUnicode_GET_SIZE(v)); + PyUnicode_GET_SIZE(v)); } if (PyString_CheckExact(v)) { Py_INCREF(v); @@ -503,6 +524,7 @@ res = PyObject_Repr(v); } } + if (res == NULL) return NULL; if (!PyUnicode_Check(res)) { Modified: python/branches/tlee-ast-optimize/Objects/setobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/setobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/setobject.c Sat Jul 12 06:22:35 2008 @@ -1956,6 +1956,18 @@ PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); +static PyObject * +set_sizeof(PySetObject *so) +{ + Py_ssize_t res; + + res = sizeof(PySetObject); + if (so->table != so->smalltable) + res = res + (so->mask + 1) * sizeof(setentry); + return PyInt_FromSsize_t(res); +} + +PyDoc_STRVAR(sizeof_doc, "S.__sizeof__() -> size of S in memory, in bytes"); static int set_init(PySetObject *self, PyObject *args, PyObject *kwds) { @@ -2023,6 +2035,8 @@ reduce_doc}, {"remove", (PyCFunction)set_remove, METH_O, remove_doc}, + {"__sizeof__", (PyCFunction)set_sizeof, METH_NOARGS, + sizeof_doc}, {"symmetric_difference",(PyCFunction)set_symmetric_difference, METH_O, symmetric_difference_doc}, {"symmetric_difference_update",(PyCFunction)set_symmetric_difference_update, METH_O, @@ -2144,6 +2158,8 @@ issuperset_doc}, {"__reduce__", (PyCFunction)set_reduce, METH_NOARGS, reduce_doc}, + {"__sizeof__", (PyCFunction)set_sizeof, METH_NOARGS, + sizeof_doc}, {"symmetric_difference",(PyCFunction)set_symmetric_difference, METH_O, symmetric_difference_doc}, {"union", (PyCFunction)set_union, METH_VARARGS, Modified: python/branches/tlee-ast-optimize/Objects/unicodeobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/unicodeobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/unicodeobject.c Sat Jul 12 06:22:35 2008 @@ -7898,20 +7898,8 @@ static PyObject * unicode__sizeof__(PyUnicodeObject *v) { - PyObject *res = NULL, *defsize = NULL; - - res = PyInt_FromSsize_t(sizeof(PyUnicodeObject) + - sizeof(Py_UNICODE) * (v->length + 1)); - if (v->defenc) { - defsize = PyObject_CallMethod(v->defenc, "__sizeof__", NULL); - if (defsize == NULL) { - Py_DECREF(res); - return NULL; - } - res = PyNumber_Add(res, defsize); - Py_DECREF(defsize); - } - return res; + return PyInt_FromSsize_t(sizeof(PyUnicodeObject) + + sizeof(Py_UNICODE) * (v->length + 1)); } PyDoc_STRVAR(sizeof__doc__, Modified: python/branches/tlee-ast-optimize/Python/_warnings.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/_warnings.c (original) +++ python/branches/tlee-ast-optimize/Python/_warnings.c Sat Jul 12 06:22:35 2008 @@ -256,7 +256,6 @@ Py_XDECREF(name); /* Print " source_line\n" */ - PyFile_WriteString(" ", f_stderr); if (sourceline) { char *source_line_str = PyString_AS_STRING(sourceline); while (*source_line_str == ' ' || *source_line_str == '\t' || @@ -267,7 +266,8 @@ PyFile_WriteString("\n", f_stderr); } else - Py_DisplaySourceLine(f_stderr, PyString_AS_STRING(filename), lineno); + _Py_DisplaySourceLine(f_stderr, PyString_AS_STRING(filename), + lineno, 2); PyErr_Clear(); } Modified: python/branches/tlee-ast-optimize/Python/sysmodule.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/sysmodule.c (original) +++ python/branches/tlee-ast-optimize/Python/sysmodule.c Sat Jul 12 06:22:35 2008 @@ -640,9 +640,16 @@ #endif /* USE_MALLOPT */ static PyObject * -sys_getsizeof(PyObject *self, PyObject *args) +sys_getsizeof(PyObject *self, PyObject *args, PyObject *kwds) { - static PyObject * str__sizeof__ = NULL; + PyObject *res = NULL; + static PyObject *str__sizeof__, *gc_head_size = NULL; + static char *kwlist[] = {"object", "default", 0}; + PyObject *o, *dflt = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:getsizeof", + kwlist, &o, &dflt)) + return NULL; /* Initialize static variable needed by _PyType_Lookup */ if (str__sizeof__ == NULL) { @@ -651,30 +658,54 @@ return NULL; } - /* Type objects */ - if (PyType_Check(args)){ - PyObject *method = _PyType_Lookup(Py_TYPE(args), + /* Initialize static variable for GC head size */ + if (gc_head_size == NULL) { + gc_head_size = PyInt_FromSsize_t(sizeof(PyGC_Head)); + if (gc_head_size == NULL) + return NULL; + } + + /* Make sure the type is initialized. float gets initialized late */ + if (PyType_Ready(Py_TYPE(o)) < 0) + return NULL; + + /* Instance of old-style class */ + if (PyInstance_Check(o)) + res = PyInt_FromSsize_t(PyInstance_Type.tp_basicsize); + /* all other objects */ + else { + PyObject *method = _PyType_Lookup(Py_TYPE(o), str__sizeof__); - if (method == NULL) { + if (method == NULL) PyErr_Format(PyExc_TypeError, "Type %.100s doesn't define __sizeof__", - Py_TYPE(args)->tp_name); - return NULL; - } - return PyObject_CallFunctionObjArgs(method, args, NULL); - } - /* Instance of old-style classes */ - else if (PyInstance_Check(args)) - return PyInt_FromSsize_t(PyInstance_Type.tp_basicsize); - /* Old-style classes */ - else if (PyClass_Check(args)) - return PyInt_FromSsize_t(PyClass_Type.tp_basicsize); - else - return PyObject_CallMethod(args, "__sizeof__", NULL); + Py_TYPE(o)->tp_name); + else + res = PyObject_CallFunctionObjArgs(method, o, NULL); + } + + /* Has a default value been given? */ + if ((res == NULL) && (dflt != NULL) && + PyErr_ExceptionMatches(PyExc_TypeError)) + { + PyErr_Clear(); + Py_INCREF(dflt); + return dflt; + } + else if (res == NULL) + return res; + + /* add gc_head size */ + if (PyObject_IS_GC(o)) { + PyObject *tmp = res; + res = PyNumber_Add(tmp, gc_head_size); + Py_DECREF(tmp); + } + return res; } PyDoc_STRVAR(getsizeof_doc, -"getsizeof(object) -> int\n\ +"getsizeof(object, default) -> int\n\ \n\ Return the size of object in bytes."); @@ -829,32 +860,12 @@ Clear the internal type lookup cache."); -static PyObject * -sys_compact_freelists(PyObject* self, PyObject* args) -{ - size_t isum, ibc, ibf; - size_t fsum, fbc, fbf; - - PyInt_CompactFreeList(&ibc, &ibf, &isum); - PyFloat_CompactFreeList(&fbc, &fbf, &fsum); - - return Py_BuildValue("(kkk)(kkk)", isum, ibc, ibf, - fsum, fbc, fbf); - -} - -PyDoc_STRVAR(sys_compact_freelists__doc__, -"_compact_freelists() -> ((remaing_objects, total_blocks, freed_blocks), ...)\n\ -Compact the free lists of ints and floats."); - static PyMethodDef sys_methods[] = { /* Might as well keep this in alphabetic order */ {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS, callstats_doc}, {"_clear_type_cache", sys_clear_type_cache, METH_NOARGS, sys_clear_type_cache__doc__}, - {"_compact_freelists", sys_compact_freelists, METH_NOARGS, - sys_compact_freelists__doc__}, {"_current_frames", sys_current_frames, METH_NOARGS, current_frames_doc}, {"displayhook", sys_displayhook, METH_O, displayhook_doc}, @@ -889,7 +900,8 @@ {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc}, {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, getrecursionlimit_doc}, - {"getsizeof", sys_getsizeof, METH_O, getsizeof_doc}, + {"getsizeof", (PyCFunction)sys_getsizeof, + METH_VARARGS | METH_KEYWORDS, getsizeof_doc}, {"_getframe", sys_getframe, METH_VARARGS, getframe_doc}, #ifdef MS_WINDOWS {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS, Modified: python/branches/tlee-ast-optimize/Python/traceback.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/traceback.c (original) +++ python/branches/tlee-ast-optimize/Python/traceback.c Sat Jul 12 06:22:35 2008 @@ -123,7 +123,7 @@ } int -Py_DisplaySourceLine(PyObject *f, const char *filename, int lineno) +_Py_DisplaySourceLine(PyObject *f, const char *filename, int lineno, int indent) { int err = 0; FILE *xfp = NULL; @@ -197,12 +197,27 @@ } while (*pLastChar != '\0' && *pLastChar != '\n'); } if (i == lineno) { + char buf[11]; char *p = linebuf; while (*p == ' ' || *p == '\t' || *p == '\014') p++; - err = PyFile_WriteString(p, f); - if (err == 0 && strchr(p, '\n') == NULL) - err = PyFile_WriteString("\n", f); + + /* Write some spaces before the line */ + strcpy(buf, " "); + assert (strlen(buf) == 10); + while (indent > 0) { + if(indent < 10) + buf[indent] = '\0'; + err = PyFile_WriteString(buf, f); + if (err != 0) + break; + indent -= 10; + } + + if (err == 0) + err = PyFile_WriteString(p, f); + if (err == 0 && strchr(p, '\n') == NULL) + err = PyFile_WriteString("\n", f); } fclose(xfp); return err; @@ -222,7 +237,7 @@ err = PyFile_WriteString(linebuf, f); if (err != 0) return err; - return Py_DisplaySourceLine(f, filename, lineno); + return _Py_DisplaySourceLine(f, filename, lineno, 4); } static int From buildbot at python.org Sat Jul 12 08:38:42 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 12 Jul 2008 06:38:42 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20080712063842.C23C51E4004@bag.python.org> The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/1309 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: 5 tests failed: test_bsddb3 test_ctypes test_lib2to3 test_site test_ssl ====================================================================== ERROR: test01_badpointer (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 33, in test01_badpointer dbs = dbshelve.open(self.filename) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\dbshelve.py", line 91, in open d.open(filename, dbname, filetype, flags, mode) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\dbshelve.py", line 152, in open self.db.open(*args, **kwargs) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test03_repr_closed_db (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 45, in test03_repr_closed_db db = hashopen(self.filename) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\__init__.py", line 324, in hashopen d.open(file, db.DB_HASH, flags, mode) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test04_double_free_make_key_dbt (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 68, in test04_double_free_make_key_dbt os.unlink(self.filename) WindowsError: [Error 2] The system cannot find the file specified: 'MiscTestCase.db' ====================================================================== ERROR: test05_key_with_null_bytes (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 87, in test05_key_with_null_bytes os.unlink(self.filename) WindowsError: [Error 2] The system cannot find the file specified: 'MiscTestCase.db' ====================================================================== ERROR: test_DB_set_flags_persists (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 115, in test_DB_set_flags_persists os.unlink(self.filename) WindowsError: [Error 2] The system cannot find the file specified: 'MiscTestCase.db' ====================================================================== FAIL: test03_lock_timeout (bsddb.test.test_lock.LockingTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_lock.py", line 131, in test03_lock_timeout self.assertTrue((end_time-start_time) >= 0.1) AssertionError ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 19, in dumps return pickle.dumps(item) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest_1) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 71, in dumps return pickle.dumps(item, 1) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest_2) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 75, in dumps return pickle.dumps(item, 2) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1427, in test_import_from self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1416, in test_import_module self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' ====================================================================== ERROR: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_site.py", line 115, in test_s_option env=env) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 444, in call return Popen(*popenargs, **kwargs).wait() File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 595, in __init__ errread, errwrite) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 817, in _execute_child startupinfo) TypeError: environment can only contain strings sincerely, -The Buildbot From python-checkins at python.org Sat Jul 12 09:51:48 2008 From: python-checkins at python.org (matthias.klose) Date: Sat, 12 Jul 2008 09:51:48 +0200 (CEST) Subject: [Python-checkins] r64888 - python/trunk/Tools/faqwiz/move-faqwiz.sh Message-ID: <20080712075148.CDB391E4014@bag.python.org> Author: matthias.klose Date: Sat Jul 12 09:51:48 2008 New Revision: 64888 Log: - Fix bashisms in Tools/faqwiz/move-faqwiz.sh Modified: python/trunk/Tools/faqwiz/move-faqwiz.sh Modified: python/trunk/Tools/faqwiz/move-faqwiz.sh ============================================================================== --- python/trunk/Tools/faqwiz/move-faqwiz.sh (original) +++ python/trunk/Tools/faqwiz/move-faqwiz.sh Sat Jul 12 09:51:48 2008 @@ -9,7 +9,7 @@ # blackjesus:~> ./move-faqwiz.sh 2\.1 3\.2 # Moving FAQ question 02.001 to 03.002 -if [ x$2 == x ]; then +if [ x$2 = x ]; then echo "Need 2 args: original_version final_version." exit 2 fi @@ -19,7 +19,7 @@ exit 2 fi -function cut_n_pad() { +cut_n_pad() { t=`echo $1 | cut -d. -f $2` export $3=`echo $t | awk "{ tmp = \\$0; l = length(tmp); for (i = 0; i < $2-l+1; i++) { tmp = "0".tmp } print tmp }"` } @@ -28,7 +28,13 @@ cut_n_pad $1 2 suffix1 cut_n_pad $2 1 prefix2 cut_n_pad $2 2 suffix2 -tmpfile=tmp$RANDOM.tmp +if which tempfile >/dev/null; then + tmpfile=$(tempfile -d .) +elif [ -n "$RANDOM" ]; then + tmpfile=tmp$RANDOM.tmp +else + tmpfile=tmp$$.tmp +fi file1=faq$prefix1.$suffix1.htp file2=faq$prefix2.$suffix2.htp From python-checkins at python.org Sat Jul 12 10:03:16 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 12 Jul 2008 10:03:16 +0200 (CEST) Subject: [Python-checkins] r64889 - tracker/instances/board Message-ID: <20080712080316.2DF711E4004@bag.python.org> Author: martin.v.loewis Date: Sat Jul 12 10:03:15 2008 New Revision: 64889 Log: Create board tracker. Added: tracker/instances/board/ - copied from r64888, /tracker/instances/python-dev/ From python-checkins at python.org Sat Jul 12 10:03:36 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 12 Jul 2008 10:03:36 +0200 (CEST) Subject: [Python-checkins] r64890 - tracker/instances/security Message-ID: <20080712080336.669251E4004@bag.python.org> Author: martin.v.loewis Date: Sat Jul 12 10:03:36 2008 New Revision: 64890 Log: Create security tracker. Added: tracker/instances/security/ - copied from r64889, /tracker/instances/python-dev/ From buildbot at python.org Sat Jul 12 10:34:28 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 12 Jul 2008 08:34:28 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20080712083428.2CE1C1E4004@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%20trunk/builds/1135 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 523, in __bootstrap_inner self.run() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 478, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 289, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbutils.py", line 62, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_lib2to3 ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1427, in test_import_from self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1416, in test_import_module self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 50, in check tree = self._check(before, after) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/lib2to3/tests/test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Jul 12 10:46:10 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 12 Jul 2008 10:46:10 +0200 (CEST) Subject: [Python-checkins] r64891 - in tracker/instances/board: config.ini.template detectors/autoassign.py detectors/changes_xml_writer.py detectors/cia.py detectors/no_texthtml.py detectors/patches.py detectors/severityauditor.py detectors/spambayes.py html/issue.index.html html/issue.item.html initial_data.py schema.py Message-ID: <20080712084610.6E3E71E4004@bag.python.org> Author: martin.v.loewis Date: Sat Jul 12 10:46:09 2008 New Revision: 64891 Log: Configure board tracker. Removed: tracker/instances/board/detectors/autoassign.py tracker/instances/board/detectors/changes_xml_writer.py tracker/instances/board/detectors/cia.py tracker/instances/board/detectors/no_texthtml.py tracker/instances/board/detectors/patches.py tracker/instances/board/detectors/severityauditor.py tracker/instances/board/detectors/spambayes.py Modified: tracker/instances/board/config.ini.template tracker/instances/board/html/issue.index.html tracker/instances/board/html/issue.item.html tracker/instances/board/initial_data.py tracker/instances/board/schema.py Modified: tracker/instances/board/config.ini.template ============================================================================== --- tracker/instances/board/config.ini.template (original) +++ tracker/instances/board/config.ini.template Sat Jul 12 10:46:09 2008 @@ -115,7 +115,7 @@ # Default: NO DEFAULT #web = NO DEFAULT #web = http://psf.upfronthosting.co.za/roundup/tracker/ -web = http://localhost:9999/python-dev/ +web = http://localhost:9999/board/ # Email address that mail to roundup should go to. # Default: issue_tracker @@ -160,7 +160,7 @@ # Name of the database to use. # Default: roundup -name = roundup +name = roundup_board # Database server host. # Default: localhost Deleted: tracker/instances/board/detectors/autoassign.py ============================================================================== --- tracker/instances/board/detectors/autoassign.py Sat Jul 12 10:46:09 2008 +++ (empty file) @@ -1,28 +0,0 @@ -# Auditor to automatically assign issues to a user when -# the component field gets set - -def autoassign(db, cl, nodeid, newvalues): - try: - components = newvalues['components'] - except KeyError: - # Without components, nothing needs to be auto-assigned - return - if newvalues.has_key('assignee'): - # If there is an explicit assignee in the new values - # (even if it is None, in the case unassignment): - # do nothing - return - # If the issue is already assigned, do nothing - if nodeid and db.issue.get(nodeid, 'assignee'): - return - for component in components: - user = db.component.get(component, 'assign_to') - if user: - # If there would be multiple auto-assigned users - # arbitrarily pick the first one we find - newvalues['assignee'] = user - return - -def init(db): - db.issue.audit('create', autoassign) - db.issue.audit('set', autoassign) Deleted: tracker/instances/board/detectors/changes_xml_writer.py ============================================================================== --- tracker/instances/board/detectors/changes_xml_writer.py Sat Jul 12 10:46:09 2008 +++ (empty file) @@ -1,194 +0,0 @@ -# -# changes.xml writer detector. -# -# Copyright (c) 2007 Michal Kwiatkowski -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the name of the author nor the names of his contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -"""changes.xml writer detector -- save each database change to an XML file. - -Root element is called `changes` and it has at most `ChangesXml.max_items` -children, each called a `change`. Each `change` has the following attributes: - -:date: date in RFC2822 format when the change was made -:id: unique identifier of this change (note: not an integer) -:type: type of this change (see below) - -A structure of a `change` depends on its `type`. Currently implemented -change types and their formats are listed below. - -* type = `file-added` - - Describes a new file attached to an existing issue. Child elements: - - :file-id: unique integer identifier of the file - :file-name: name of the uploaded file - :file-type: MIME type of the file content - :file-url: permanent URL of the file - :issue-id: unique integer identifier of an issue this file is attached to -""" - -import os -import urllib -from xml.dom import minidom -from xml.parsers.expat import ExpatError -from time import gmtime, strftime - -# Relative to tracker home directory. -FILENAME = os.path.join('%(TEMPLATES)s', 'recent-changes.xml') - - -def tracker_url(db): - return str(db.config.options[('tracker', 'web')]) - -def changes_xml_path(db): - return os.path.join(db.config.HOME, FILENAME % db.config.options) - -def rfc2822_date(): - return strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()) - -class File(object): - def __init__(self, db, id, issue_id): - self.db = db - self.id = id - self.issue_id = issue_id - - self.name = db.file.get(id, 'name') - self.type = db.file.get(id, 'type') - # Based on roundup.cgi.templating._HTMLItem.download_url(). - self.download_url = tracker_url(self.db) +\ - urllib.quote('%s%s/%s' % ('file', self.id, self.name)) - -class ChangesXml(object): - # Maximum number of changes stored in a file. - max_items = 20 - - def __init__(self, filename): - self.filename = filename - self._read_document() - self.modified = False - - def save(self): - if not self.modified: - return - - self._trim_to_max_items() - - fd = open(self.filename, 'w') - self.document.writexml(fd, encoding="UTF-8") - fd.close() - - def add_file(self, file): - change = self._change("file%s-added-to-issue%s" % (file.id, file.issue_id), - "file-added") - - change.appendChild(self._element_with_text("file-id", file.id)) - change.appendChild(self._element_with_text("file-name", file.name)) - change.appendChild(self._element_with_text("file-type", file.type)) - change.appendChild(self._element_with_text("file-url", file.download_url)) - change.appendChild(self._element_with_text("issue-id", file.issue_id)) - - self.root.appendChild(change) - self.modified = True - - def add_files(self, files): - for file in files: - self.add_file(file) - - def _change(self, id, type): - """Return new 'change' element of a given type. - - """ - change = self.document.createElement("change") - change.setAttribute("id", id) - change.setAttribute("type", type) - change.setAttribute("date", rfc2822_date()) - return change - - def _element_with_text(self, name, value): - """Return new element with given name and text node as a value. - value - """ - element = self.document.createElement(name) - text = self.document.createTextNode(str(value)) - element.appendChild(text) - return element - - def _trim_to_max_items(self): - """Remove changes exceeding self.max_items. - """ - # Assumes that changes are stored sequentially from oldest to newest. - # Will do for now. - for change in self.root.getElementsByTagName("change")[0:-self.max_items]: - self.root.removeChild(change) - - def _read_document(self): - try: - self.document = minidom.parse(self.filename) - self.root = self.document.firstChild - except IOError, e: - # File not found, create a new one then. - if e.errno != 2: - raise - self._create_new_document() - except ExpatError: - # File has been damaged, forget about it and create a new one. - self._create_new_document() - - def _create_new_document(self): - self.document = minidom.Document() - self.root = self.document.createElement("changes") - self.document.appendChild(self.root) - -def get_new_files_ids(issue_now, issue_then): - """Return ids of files added between `now` and `then`. - """ - files_now = set(issue_now['files']) - if issue_then: - files_then = set(issue_then['files']) - else: - files_then = set() - return map(int, files_now - files_then) - -def file_added_to_issue(db, cl, issue_id, olddata): - try: - changes = ChangesXml(changes_xml_path(db)) - issue = db.issue.getnode(issue_id) - new_files = [ File(db, id, issue_id) for id in get_new_files_ids(issue, olddata) ] - - changes.add_files(new_files) - changes.save() - except: - # We can't mess up with a database commit. - pass - - -def init(db): - db.issue.react('create', file_added_to_issue) - db.issue.react('set', file_added_to_issue) Deleted: tracker/instances/board/detectors/cia.py ============================================================================== --- tracker/instances/board/detectors/cia.py Sat Jul 12 10:46:09 2008 +++ (empty file) @@ -1,86 +0,0 @@ -# Reactor for sending changes to CIA.vc -import xmlrpclib -import cgi - -server = "http://CIA.vc" - -parameters = { - 'name':'Roundup Reactor for CIA', - 'revision': "$Revision$"[11:-2], - 'project': 'Python', - 'branch': 'roundup', - 'urlprefix': 'http://bugs.python.org/issue', -} - -max_content = 150 - -TEMPLATE = """ - - - Roundup Reactor for CIA - %(revision)s - - - %(project)s - #%(nodeid)s - %(branch)s - - - - %(author)s - %(file)s - %(log)s - %(urlprefix)s%(nodeid)s - - - -""" - - -def sendcia(db, cl, nodeid, oldvalues): - messages = set(cl.get(nodeid, 'messages')) - if oldvalues: - messages -= set(oldvalues.get('messages',())) - if not messages: - return - messages = list(messages) - - if oldvalues: - oldstatus = oldvalues['status'] - else: - oldstatus = None - newstatus = db.issue.get(nodeid, 'status') - if oldstatus != newstatus: - if oldvalues: - status = db.status.get(newstatus, 'name') - else: - status = 'new' - log = '[' + status + '] ' - else: - log = '' - for msg in messages: - log += db.msg.get(msg, 'content') - if len(log) > max_content: - log = log[:max_content-4] + ' ...' - log = log.replace('\n', ' ') - - params = parameters.copy() - params['file'] = cgi.escape(db.issue.get(nodeid, 'title')) - params['nodeid'] = nodeid - params['author'] = db.user.get(db.getuid(), 'username') - params['log'] = cgi.escape(log) - - payload = TEMPLATE % params - - try: - rpc = xmlrpclib.ServerProxy(server) - rpc.hub.deliver(payload) - except: - # Ignore any errors in sending the CIA; - # if the server is down, that's just bad luck - # XXX might want to do some logging here - pass - -def init(db): - db.issue.react('create', sendcia) - db.issue.react('set', sendcia) Deleted: tracker/instances/board/detectors/no_texthtml.py ============================================================================== --- tracker/instances/board/detectors/no_texthtml.py Sat Jul 12 10:46:09 2008 +++ (empty file) @@ -1,9 +0,0 @@ - -def audit_html_files(db, cl, nodeid, newvalues): - if newvalues.has_key('type') and newvalues['type'] == 'text/html': - newvalues['type'] = 'text/plain' - - -def init(db): - db.file.audit('set', audit_html_files) - db.file.audit('create', audit_html_files) Deleted: tracker/instances/board/detectors/patches.py ============================================================================== --- tracker/instances/board/detectors/patches.py Sat Jul 12 10:46:09 2008 +++ (empty file) @@ -1,45 +0,0 @@ -# Auditor for patch files -# Patches should be declared as text/plain (also .py files), -# independent of what the browser says, and -# the "patch" keyword should get set automatically. - -import posixpath - -patchtypes = ('.diff', '.patch') -sourcetypes = ('.diff', '.patch', '.py') - -def ispatch(file, types): - return posixpath.splitext(file)[1] in types - -def patches_text_plain(db, cl, nodeid, newvalues): - if ispatch(newvalues['name'], sourcetypes): - newvalues['type'] = 'text/plain' - -def patches_keyword(db, cl, nodeid, newvalues): - # Check whether there are any new files - newfiles = set(newvalues.get('files',())) - if nodeid: - newfiles -= set(db.issue.get(nodeid, 'files')) - # Check whether any of these is a patch - newpatch = False - for fileid in newfiles: - if ispatch(db.file.get(fileid, 'name'), patchtypes): - newpatch = True - break - if newpatch: - # Add the patch keyword if its not already there - patchid = db.keyword.lookup("patch") - oldkeywords = [] - if nodeid: - oldkeywords = db.issue.get(nodeid, 'keywords') - if patchid in oldkeywords: - # This is already marked as a patch - return - if not newvalues.has_key('keywords'): - newvalues['keywords'] = oldkeywords - newvalues['keywords'].append(patchid) - -def init(db): - db.file.audit('create', patches_text_plain) - db.issue.audit('create', patches_keyword) - db.issue.audit('set', patches_keyword) Deleted: tracker/instances/board/detectors/severityauditor.py ============================================================================== --- tracker/instances/board/detectors/severityauditor.py Sat Jul 12 10:46:09 2008 +++ (empty file) @@ -1,11 +0,0 @@ - -def init_severity(db, cl, nodeid, newvalues): - """Make sure severity is set on new issues""" - if newvalues.has_key('severity') and newvalues['severity']: - return - - normal = db.severity.lookup('normal') - newvalues['severity'] = normal - -def init(db): - db.issue.audit('create', init_severity) Deleted: tracker/instances/board/detectors/spambayes.py ============================================================================== --- tracker/instances/board/detectors/spambayes.py Sat Jul 12 10:46:09 2008 +++ (empty file) @@ -1 +0,0 @@ -link ../../spambayes_integration/detectors/spambayes.py \ No newline at end of file Modified: tracker/instances/board/html/issue.index.html ============================================================================== --- tracker/instances/board/html/issue.index.html (original) +++ tracker/instances/board/html/issue.index.html Sat Jul 12 10:46:09 2008 @@ -23,16 +23,13 @@
    - - - @@ -50,8 +47,6 @@ - @@ -65,12 +60,8 @@ - - - -
    Severity ID Creation Activity Actor Title ComponentsVersions StatusResolution Creator Assigned To Keywords
                  : components - : - versions
    @@ -88,8 +84,6 @@ : status - Resolution: - resolution Modified: tracker/instances/board/initial_data.py ============================================================================== --- tracker/instances/board/initial_data.py (original) +++ tracker/instances/board/initial_data.py Sat Jul 12 10:46:09 2008 @@ -5,51 +5,10 @@ # issue_type = db.getclass('issue_type') -issue_type.create(name='crash', order='1') -issue_type.create(name='compile error', order='2') -issue_type.create(name='resource usage', order='3') -issue_type.create(name='security', order='4') -issue_type.create(name='behavior', order='5') -issue_type.create(name='rfe', order='6') +issue_type.create(name='todo', order='1') component = db.getclass('component') -component.create(name="Build", order="1") -component.create(name="Demos and Tools", order="2") -component.create(name="Distutils", order="3") -component.create(name="Documentation", order="4") -component.create(name="Extension Modules", order="5") -component.create(name="IDLE", order="6") -component.create(name="Installation", order="7") -component.create(name="Interpreter Core", order="8") -component.create(name="Library (Lib)", order="9") -component.create(name="Macintosh", order="10") -component.create(name="Regular Expressions", order="11") -component.create(name="Tests", order="12") -component.create(name="Tkinter", order="13") -component.create(name="Unicode", order="14") -component.create(name="Windows", order="15") -component.create(name="XML", order="16") - -version = db.getclass('version') -version.create(name='Python 2.6', order='1') -version.create(name='Python 2.5', order='2') -version.create(name='Python 2.4', order='3') -version.create(name='Python 2.3', order='4') -version.create(name='Python 2.2.3', order='5') -version.create(name='Python 2.2.2', order='6') -version.create(name='Python 2.2.1', order='7') -version.create(name='Python 2.2', order='8') -version.create(name='Python 2.1.2', order='9') -version.create(name='Python 2.1.1', order='10') -version.create(name='3rd party', order='11') - - -severity = db.getclass('severity') -severity.create(name='critical', order='1') -severity.create(name='urgent', order='2') -severity.create(name='major', order='3') -severity.create(name='normal', order='4') -severity.create(name='minor', order='5') +component.create(name="Conference", order="1") priority = db.getclass('priority') priority.create(name='immediate', order='1') @@ -63,22 +22,9 @@ status.create(name='closed', order='2') status.create(name='pending', description='user feedback required', order='3') -resolution = db.getclass('resolution') -resolution.create(name='accepted', order='1') -resolution.create(name='duplicate', order='2') -resolution.create(name='fixed', order='3') -resolution.create(name='invalid', order='4') -resolution.create(name='later', order='5') -resolution.create(name='out of date', order='6') -resolution.create(name='postponed', order='7') -resolution.create(name='rejected', order='8') -resolution.create(name='remind', order='9') -resolution.create(name='wont fix', order='10') -resolution.create(name='works for me', order='11') - -keyword = db.getclass("keyword") -keyword.create(name="py3k", description="Python 3000 bugs") -keyword.create(name="patch", description="Contains patch") +#keyword = db.getclass("keyword") +#keyword.create(name="py3k", description="Python 3000 bugs") +#keyword.create(name="patch", description="Contains patch") # # create the two default users Modified: tracker/instances/board/schema.py ============================================================================== --- tracker/instances/board/schema.py (original) +++ tracker/instances/board/schema.py Sat Jul 12 10:46:09 2008 @@ -25,18 +25,18 @@ component.setkey('name') # Version -version = Class(db, 'version', - name=String(), - description=String(), - order=Number()) -version.setkey('name') +#version = Class(db, 'version', +# name=String(), +# description=String(), +# order=Number()) +#version.setkey('name') # Severity -severity = Class(db, 'severity', - name=String(), - description=String(), - order=Number()) -severity.setkey('name') +#severity = Class(db, 'severity', +# name=String(), +# description=String(), +# order=Number()) +#severity.setkey('name') # Priority priority = Class(db, 'priority', @@ -52,13 +52,6 @@ order=Number()) status.setkey("name") -# Resolution -resolution = Class(db, "resolution", - name=String(), - description=String(), - order=Number()) -resolution.setkey('name') - # Keyword keyword = Class(db, "keyword", name=String(), @@ -117,13 +110,13 @@ issue = IssueClass(db, "issue", type=Link('issue_type'), components=Multilink('component'), - versions=Multilink('version'), - severity=Link('severity'), +# versions=Multilink('version'), +# severity=Link('severity'), priority=Link('priority'), dependencies=Multilink('issue'), assignee=Link('user'), status=Link('status'), - resolution=Link('resolution'), +# resolution=Link('resolution'), superseder=Link('issue'), keywords=Multilink("keyword")) @@ -133,17 +126,14 @@ # See the configuration and customisation document for information # about security setup. -db.security.addRole(name='Developer', description='A developer') +db.security.addRole(name='Board', description='A board member') db.security.addRole(name='Coordinator', description='A coordinator') -db.security.addPermission(name="SB: May Classify") -db.security.addPermission(name="SB: May Report Misclassified") - # # REGULAR USERS # # Give the regular users access to the web and email interface -for r in 'User', 'Developer', 'Coordinator': +for r in 'User', 'Board', 'Coordinator': db.security.addPermissionToRole(r, 'Web Access') db.security.addPermissionToRole(r, 'Email Access') @@ -151,11 +141,12 @@ # User permissions ########################## -for cl in ('issue_type', 'severity', 'component', - 'version', 'priority', 'status', 'resolution', +for cl in ('issue_type', 'component', +# 'version', 'resolution', 'severity', + 'priority', 'status', 'issue', 'keyword'): db.security.addPermissionToRole('User', 'View', cl) - db.security.addPermissionToRole('Anonymous', 'View', cl) + #db.security.addPermissionToRole('Anonymous', 'View', cl) class may_view_spam: def __init__(self, klassname): @@ -188,7 +179,7 @@ 'description', )) - db.security.addPermissionToRole('Anonymous', p) + #db.security.addPermissionToRole('Anonymous', p) db.security.addPermissionToRole('User', p) db.security.addPermissionToRole('User', 'Create', cl) @@ -204,7 +195,7 @@ properties=('content', 'summary'), check=may_view_spam(cl)) - db.security.addPermissionToRole('Anonymous', spamcheck) + #db.security.addPermissionToRole('Anonymous', spamcheck) def may_edit_file(db, userid, itemid): return userid == db.file.get(itemid, "creator") @@ -212,54 +203,51 @@ description="User is allowed to remove their own files") db.security.addPermissionToRole('User', p) -p = db.security.addPermission(name='Create', klass='issue', - properties=('title', 'type', - 'components', 'versions', - 'severity', - 'messages', 'files', 'nosy'), - description='User can report and discuss issues') -db.security.addPermissionToRole('User', p) - -p = db.security.addPermission(name='Edit', klass='issue', - properties=('title', 'type', - 'components', 'versions', - 'severity', - 'messages', 'files', 'nosy'), - description='User can report and discuss issues') -db.security.addPermissionToRole('User', p) - -db.security.addPermissionToRole('User', 'SB: May Report Misclassified') - +#p = db.security.addPermission(name='Create', klass='issue', +# properties=('title', 'type', +# 'components', 'versions', +# 'severity', +# 'messages', 'files', 'nosy'), +# description='User can report and discuss issues') +#db.security.addPermissionToRole('User', p) + +#p = db.security.addPermission(name='Edit', klass='issue', +# properties=('title', 'type', +# 'components', 'versions', +# 'severity', +# 'messages', 'files', 'nosy'), +# description='User can report and discuss issues') +#db.security.addPermissionToRole('User', p) ########################## -# Developer permissions +# Board permissions ########################## -for cl in ('issue_type', 'severity', 'component', - 'version', 'priority', 'status', 'resolution', +for cl in ('issue_type', 'component', +# 'severity', 'version', 'resolution', + 'priority', 'status', 'issue', 'file', 'msg', 'keyword'): - db.security.addPermissionToRole('Developer', 'View', cl) + db.security.addPermissionToRole('Board', 'View', cl) for cl in ('issue', 'file', 'msg', 'keyword'): - db.security.addPermissionToRole('Developer', 'Edit', cl) - db.security.addPermissionToRole('Developer', 'Create', cl) + db.security.addPermissionToRole('Board', 'Edit', cl) + db.security.addPermissionToRole('Board', 'Create', cl) ########################## # Coordinator permissions ########################## -for cl in ('issue_type', 'severity', 'component', - 'version', 'priority', 'status', 'resolution', 'issue', 'file', 'msg'): +for cl in ('issue_type', 'component', +# 'severity', 'version', 'resolution', + 'priority', 'status', 'issue', 'file', 'msg'): db.security.addPermissionToRole('Coordinator', 'View', cl) db.security.addPermissionToRole('Coordinator', 'Edit', cl) db.security.addPermissionToRole('Coordinator', 'Create', cl) -db.security.addPermissionToRole('Coordinator', 'SB: May Classify') - # May users view other user information? Comment these lines out # if you don't want them to db.security.addPermissionToRole('User', 'View', 'user') -db.security.addPermissionToRole('Developer', 'View', 'user') +db.security.addPermissionToRole('Board', 'View', 'user') db.security.addPermissionToRole('Coordinator', 'View', 'user') # Allow Coordinator to edit any user, including their roles. @@ -273,7 +261,7 @@ return userid == itemid p = db.security.addPermission(name='View', klass='user', check=own_record, description="User is allowed to view their own user details") -for r in 'User', 'Developer', 'Coordinator': +for r in 'User', 'Board', 'Coordinator': db.security.addPermissionToRole(r, p) p = db.security.addPermission(name='Edit', klass='user', check=own_record, description="User is allowed to edit their own user details", @@ -283,7 +271,7 @@ 'alternate_addresses', 'queries', 'timezone')) # Note: 'roles' excluded - users should not be able to edit their own roles. -for r in 'User', 'Developer': +for r in 'User', 'Board': db.security.addPermissionToRole(r, p) # Users should be able to edit and view their own queries. They should also @@ -297,15 +285,15 @@ return userid == db.query.get(itemid, 'creator') p = db.security.addPermission(name='View', klass='query', check=view_query, description="User is allowed to view their own and public queries") -for r in 'User', 'Developer', 'Coordinator': +for r in 'User', 'Board', 'Coordinator': db.security.addPermissionToRole(r, p) p = db.security.addPermission(name='Edit', klass='query', check=edit_query, description="User is allowed to edit their queries") -for r in 'User', 'Developer', 'Coordinator': +for r in 'User', 'Board', 'Coordinator': db.security.addPermissionToRole(r, p) p = db.security.addPermission(name='Create', klass='query', description="User is allowed to create queries") -for r in 'User', 'Developer', 'Coordinator': +for r in 'User', 'Board', 'Coordinator': db.security.addPermissionToRole(r, p) @@ -327,15 +315,15 @@ # Assign the appropriate permissions to the anonymous user's Anonymous # Role. Choices here are: # - Allow anonymous users to register -db.security.addPermissionToRole('Anonymous', 'Create', 'user') +#db.security.addPermissionToRole('Anonymous', 'Create', 'user') # Allow anonymous users access to view issues (and the related, linked # information). # Note permissions settings for file and msg above (due to spambayes # integration). -for cl in 'issue', 'severity', 'status', 'resolution': - db.security.addPermissionToRole('Anonymous', 'View', cl) +#for cl in 'issue', 'severity', 'status', 'resolution': +# db.security.addPermissionToRole('Anonymous', 'View', cl) # [OPTIONAL] # Allow anonymous users access to create or edit "issue" items (and the From python-checkins at python.org Sat Jul 12 17:21:50 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 12 Jul 2008 17:21:50 +0200 (CEST) Subject: [Python-checkins] r64892 - in sandbox/trunk/ttk-gsoc/src/idlelib: AutoCompleteWindow.py CallTipWindow.py ColorDelegator.py Debugger.py FileList.py GrepDialog.py MultiStatusBar.py OutputWindow.py ReplaceDialog.py ScrolledList.py SearchDialog.py SearchDialogBase.py SearchEngine.py TreeWidget.py UndoDelegator.py WidgetRedirector.py WindowList.py aboutDialog.py configDialog.py configHelpSourceEdit.py configSectionNameDialog.py keybindingDialog.py tabbedpages_new.py tabbedpages_old.py textView.py Message-ID: <20080712152150.E1C601E4004@bag.python.org> Author: guilherme.polo Date: Sat Jul 12 17:21:49 2008 New Revision: 64892 Log: Removed "from Tkinter import *" usage from almost all modules, and removed string module usage where appropriate Modified: sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py sandbox/trunk/ttk-gsoc/src/idlelib/ColorDelegator.py sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py sandbox/trunk/ttk-gsoc/src/idlelib/FileList.py sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py sandbox/trunk/ttk-gsoc/src/idlelib/OutputWindow.py sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py sandbox/trunk/ttk-gsoc/src/idlelib/SearchEngine.py sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py sandbox/trunk/ttk-gsoc/src/idlelib/UndoDelegator.py sandbox/trunk/ttk-gsoc/src/idlelib/WidgetRedirector.py sandbox/trunk/ttk-gsoc/src/idlelib/WindowList.py sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py sandbox/trunk/ttk-gsoc/src/idlelib/textView.py Modified: sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/AutoCompleteWindow.py Sat Jul 12 17:21:49 2008 @@ -1,13 +1,15 @@ """ An auto-completion window for IDLE, used by the AutoComplete extension """ -from Tkinter import * -from MultiCall import MC_SHIFT +from Tkinter import Toplevel, Listbox, Scrollbar, TclError +from Tkconstants import END, LEFT, RIGHT, BOTH, VERTICAL, Y + import AutoComplete -from idlelib.configHandler import idleConf +from MultiCall import MC_SHIFT +from configHandler import idleConf if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): - from ttk import * + from ttk import Scrollbar HIDE_VIRTUAL_EVENT_NAME = "<>" HIDE_SEQUENCES = ("", "") Modified: sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/CallTipWindow.py Sat Jul 12 17:21:49 2008 @@ -4,11 +4,13 @@ Used by the CallTips IDLE extension. """ -from Tkinter import * -from idlelib.configHandler import idleConf +from Tkinter import Toplevel, Label, TclError +from Tkconstants import SOLID, LEFT + +from configHandler import idleConf if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): - from ttk import * + from ttk import Label HIDE_VIRTUAL_EVENT_NAME = "<>" HIDE_SEQUENCES = ("", "") @@ -146,6 +148,8 @@ # class container: # Conceptually an editor_window def __init__(self): + from Tkinter import Tk, Text + from Tkconstants import BOTH root = Tk() text = self.text = Text(root) text.pack(side=LEFT, fill=BOTH, expand=1) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/ColorDelegator.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/ColorDelegator.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/ColorDelegator.py Sat Jul 12 17:21:49 2008 @@ -1,8 +1,8 @@ -import time import re +import time import keyword import __builtin__ -from Tkinter import * + from Delegator import Delegator from configHandler import idleConf @@ -248,6 +248,7 @@ self.tag_remove(tag, "1.0", "end") def main(): + from Tkinter import Tk, Text from Percolator import Percolator root = Tk() root.wm_protocol("WM_DELETE_WINDOW", root.quit) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/Debugger.py Sat Jul 12 17:21:49 2008 @@ -1,14 +1,17 @@ import os import bdb import types -from Tkinter import * +from Tkinter import Frame, Button, Entry, Checkbutton, Label, Scrollbar, \ + Canvas, BooleanVar +from Tkconstants import W, LEFT, DISABLED, X, Y, BOTH, NW, GROOVE, RIGHT + +import macosxSupport from WindowList import ListedToplevel from ScrolledList import ScrolledList from configHandler import idleConf -import macosxSupport if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): - from ttk import Scrollbar, Button, Radiobutton + from ttk import Frame, Button, Entry, Checkbutton, Label, Scrollbar class Idb(bdb.Bdb): @@ -95,7 +98,7 @@ self.top.bind("", self.close) # self.bframe = bframe = Frame(top) - self.bframe.pack(anchor="w") + self.bframe.pack(anchor=W) self.buttons = bl = [] # self.bcont = b = Button(bframe, text="Go", command=self.cont) @@ -110,11 +113,11 @@ bl.append(b) # for b in bl: - b.configure(state="disabled") - b.pack(side="left") + b.configure(state=DISABLED) + b.pack(side=LEFT) # self.cframe = cframe = Frame(bframe) - self.cframe.pack(side="left") + self.cframe.pack(side=LEFT) # if not self.vstack: self.__class__.vstack = BooleanVar(top) @@ -139,18 +142,18 @@ text="Globals", command=self.show_globals, variable=self.vglobals) self.bglobals.grid(row=1, column=1) # - self.status = Label(top, anchor="w") - self.status.pack(anchor="w") - self.error = Label(top, anchor="w") - self.error.pack(anchor="w", fill="x") + self.status = Label(top, anchor=W) + self.status.pack(anchor=W) + self.error = Label(top, anchor=W) + self.error.pack(anchor=X, fill=X) self.errorbg = self.error.cget("background") # self.fstack = Frame(top, height=1) - self.fstack.pack(expand=1, fill="both") + self.fstack.pack(expand=1, fill=BOTH) self.flocals = Frame(top) - self.flocals.pack(expand=1, fill="both") + self.flocals.pack(expand=1, fill=BOTH) self.fglobals = Frame(top, height=1) - self.fglobals.pack(expand=1, fill="both") + self.fglobals.pack(expand=1, fill=BOTH) # if self.vstack.get(): self.show_stack() @@ -352,8 +355,7 @@ funcname = code.co_name import linecache sourceline = linecache.getline(filename, lineno) - import string - sourceline = string.strip(sourceline) + sourceline = sourceline.strip() if funcname in ("?", "", None): item = "%s, line %d: %s" % (modname, lineno, sourceline) else: @@ -423,19 +425,19 @@ self.repr.maxstring = 60 self.repr.maxother = 60 self.frame = frame = Frame(master) - self.frame.pack(expand=1, fill="both") - self.label = Label(frame, text=title, borderwidth=2, relief="groove") - self.label.pack(fill="x") + self.frame.pack(expand=1, fill=BOTH) + self.label = Label(frame, text=title, borderwidth=2, relief=GROOVE) + self.label.pack(fill=X) self.vbar = vbar = Scrollbar(frame, name="vbar") - vbar.pack(side="right", fill="y") + vbar.pack(side=RIGHT, fill=Y) self.canvas = canvas = Canvas(frame, height=min(300, max(40, height)), scrollregion=(0, 0, width, height)) - canvas.pack(side="left", fill="both", expand=1) + canvas.pack(side=LEFT, fill=BOTH, expand=1) vbar["command"] = canvas.yview canvas["yscrollcommand"] = vbar.set self.subframe = subframe = Frame(canvas) - self.sfid = canvas.create_window(0, 0, window=subframe, anchor="nw") + self.sfid = canvas.create_window(0, 0, window=subframe, anchor=NW) self.load_dict(dict) dict = -1 @@ -463,10 +465,10 @@ if rpc_client: svalue = svalue[1:-1] l = Label(subframe, text=name) - l.grid(row=row, column=0, sticky="nw") + l.grid(row=row, column=0, sticky=NW) l = Entry(subframe, width=0, borderwidth=0) l.insert(0, svalue) - l.grid(row=row, column=1, sticky="nw") + l.grid(row=row, column=1, sticky=NW) row = row+1 self.dict = dict # XXX Could we use a callback for the following? Modified: sandbox/trunk/ttk-gsoc/src/idlelib/FileList.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/FileList.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/FileList.py Sat Jul 12 17:21:49 2008 @@ -1,5 +1,4 @@ import os -from Tkinter import * import tkMessageBox @@ -106,8 +105,9 @@ def _test(): - from EditorWindow import fixwordbreaks import sys + from Tkinter import Tk + from EditorWindow import fixwordbreaks root = Tk() fixwordbreaks(root) root.withdraw() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/GrepDialog.py Sat Jul 12 17:21:49 2008 @@ -1,13 +1,14 @@ import os -import fnmatch import sys -from Tkinter import * +import fnmatch +from Tkinter import StringVar, BooleanVar, Checkbutton + import SearchEngine from SearchDialogBase import SearchDialogBase -from idlelib.configHandler import idleConf +from configHandler import idleConf if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): - from ttk import * + from ttk import Checkbutton def grep(text, io=None, flist=None): root = text._root() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/MultiStatusBar.py Sat Jul 12 17:21:49 2008 @@ -1,5 +1,7 @@ -from Tkinter import * -from idlelib.configHandler import idleConf +from Tkinter import Tk, Frame, Label +from Tkconstants import LEFT, SUNKEN, W + +from configHandler import idleConf if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): from ttk import Frame, Label @@ -22,6 +24,8 @@ label.config(text=text) def _test(): + from Tkinter import Text + from Tkconstants import TOP, BOTTOM, X b = Frame() c = Text(b) c.pack(side=TOP) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/OutputWindow.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/OutputWindow.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/OutputWindow.py Sat Jul 12 17:21:49 2008 @@ -1,8 +1,8 @@ -from Tkinter import * -from EditorWindow import EditorWindow import re import tkMessageBox + import IOBinding +from EditorWindow import EditorWindow class OutputWindow(EditorWindow): Modified: sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/ReplaceDialog.py Sat Jul 12 17:21:49 2008 @@ -1,4 +1,5 @@ -from Tkinter import * +from Tkinter import StringVar, TclError + import SearchEngine from SearchDialogBase import SearchDialogBase Modified: sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/ScrolledList.py Sat Jul 12 17:21:49 2008 @@ -1,8 +1,8 @@ -from Tkinter import * +from Tkinter import Frame, Menu, Listbox, Scrollbar from idlelib.configHandler import idleConf if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): - from ttk import * + from ttk import Frame, Scrollbar class ScrolledList: @@ -124,6 +124,7 @@ def test(): + from Tkinter import Tk root = Tk() root.protocol("WM_DELETE_WINDOW", root.destroy) class MyScrolledList(ScrolledList): Modified: sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialog.py Sat Jul 12 17:21:49 2008 @@ -1,8 +1,8 @@ -from Tkinter import * +from Tkinter import TclError + import SearchEngine from SearchDialogBase import SearchDialogBase - def _setup(text): root = text._root() engine = SearchEngine.get(root) @@ -12,7 +12,7 @@ def find(text): pat = text.get("sel.first", "sel.last") - return _setup(text).open(text,pat) + return _setup(text).open(text, pat) def find_again(text): return _setup(text).find_again(text) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/SearchDialogBase.py Sat Jul 12 17:21:49 2008 @@ -1,8 +1,10 @@ -from Tkinter import * -from idlelib.configHandler import idleConf +from Tkinter import Toplevel, Frame, Label, Entry, Button, Checkbutton, \ + Radiobutton + +from configHandler import idleConf if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): - from ttk import * + from ttk import Frame, Label, Entry, Button, Checkbutton, Radiobutton class SearchDialogBase: @@ -43,7 +45,7 @@ top.protocol("WM_DELETE_WINDOW", self.close) top.wm_title(self.title) top.wm_iconname(self.icon) - top.resizable(height=FALSE,width=FALSE) + top.resizable(height=False, width=False) self.ttop = top self.top = Frame(top) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/SearchEngine.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/SearchEngine.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/SearchEngine.py Sat Jul 12 17:21:49 2008 @@ -1,5 +1,5 @@ import re -from Tkinter import * +from Tkinter import StringVar, BooleanVar, TclError import tkMessageBox def get(root): Modified: sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/TreeWidget.py Sat Jul 12 17:21:49 2008 @@ -15,17 +15,15 @@ # - optimize tree redraw after expand of subnode import os -from Tkinter import * -import imp +from Tkinter import Tk, Label, Entry, Frame, Canvas, Scrollbar, PhotoImage +from Tkconstants import ALL, END import ZoomHeight from configHandler import idleConf -from idlelib.configHandler import idleConf - TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') if TTK: - from ttk import * + from ttk import Label, Entry, Frame, Scrollbar ICONDIR = "Icons" @@ -462,6 +460,7 @@ # XXX Can't run these tests def test(): + from Tkinter import Toplevel import PyShell root = Toplevel(PyShell.root) root.configure(bd=0, bg="yellow") Modified: sandbox/trunk/ttk-gsoc/src/idlelib/UndoDelegator.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/UndoDelegator.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/UndoDelegator.py Sat Jul 12 17:21:49 2008 @@ -1,5 +1,5 @@ import string -from Tkinter import * + from Delegator import Delegator #$ event <> @@ -336,6 +336,7 @@ return self.depth def main(): + from Tkinter import Tk, Text from Percolator import Percolator root = Tk() root.wm_protocol("WM_DELETE_WINDOW", root.quit) Modified: sandbox/trunk/ttk-gsoc/src/idlelib/WidgetRedirector.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/WidgetRedirector.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/WidgetRedirector.py Sat Jul 12 17:21:49 2008 @@ -1,4 +1,4 @@ -from Tkinter import * +from Tkinter import TclError class WidgetRedirector: @@ -105,6 +105,7 @@ def main(): + from Tkinter import Tk, Text root = Tk() root.wm_protocol("WM_DELETE_WINDOW", root.quit) text = Text() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/WindowList.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/WindowList.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/WindowList.py Sat Jul 12 17:21:49 2008 @@ -1,4 +1,4 @@ -from Tkinter import * +from Tkinter import Toplevel, TclError class WindowList: @@ -45,8 +45,8 @@ try: callback() except: - print "warning: callback failed in WindowList", \ - sys.exc_type, ":", sys.exc_value + print ("warning: callback failed in WindowList", + sys.exc_type, ":", sys.exc_value) registry = WindowList() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/aboutDialog.py Sat Jul 12 17:21:49 2008 @@ -1,16 +1,17 @@ """About Dialog for IDLE""" -from Tkinter import * import os -import os.path -import textView -import idlever +import sys +from Tkinter import Toplevel, Frame, Button, Label, TkVersion +from Tkconstants import LEFT, NSEW, SUNKEN, EW, W, BOTH, TOP, BOTTOM -from idlelib.stylist import PoorManStyle -from idlelib.configHandler import idleConf +import idlever +import textView +from stylist import PoorManStyle +from configHandler import idleConf TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') if TTK: - from ttk import * + from ttk import Frame, Button, Label, Style class AboutDialog(Toplevel): """Modal about dialog for idle @@ -27,7 +28,7 @@ self.SetupStyles() self.CreateWidgets() - self.resizable(height=FALSE, width=FALSE) + self.resizable(height=False, width=False) self.title(title) self.transient(parent) self.grab_set() @@ -55,11 +56,11 @@ frameMain = Frame(self, borderwidth=2, relief=SUNKEN) frameButtons = Frame(self) frameButtons.pack(side=BOTTOM, pady=3) - frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) + frameMain.pack(side=TOP, expand=True, fill=BOTH) self.buttonOk = Button(frameButtons, text='Close', command=self.Ok) self.buttonOk.pack() frameBg = Frame(frameMain) - frameBg.pack(expand=TRUE, fill=BOTH) + frameBg.pack(expand=True, fill=BOTH) labelTitle = Label(frameBg, text='IDLE', font=('courier', 24, 'bold')) labelTitle.grid(row=0, column=0, sticky=W, padx=10, pady=10) byline = "Python's Integrated DeveLopment Environment" + 5*'\n' @@ -159,9 +160,9 @@ if __name__ == '__main__': # test the dialog + from Tkinter import Tk root = Tk() def run(): - import aboutDialog - aboutDialog.AboutDialog(root, 'About') + AboutDialog(root, 'About') Button(root, text='Dialog', command=run).pack() root.mainloop() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/configDialog.py Sat Jul 12 17:21:49 2008 @@ -8,21 +8,26 @@ Note that tab width in IDLE is currently fixed at eight due to Tk issues. Refer to comments in EditorWindow autoindent code for details. """ -from Tkinter import * +from Tkinter import Toplevel, Frame, Button, Scale, Label, LabelFrame, Text, \ + Listbox, Scrollbar, Checkbutton, Radiobutton, Entry, \ + StringVar, BooleanVar, IntVar +from Tkconstants import LEFT, RIGHT, BOTTOM, TOP, BOTH, GROOVE, SOLID, NONE, \ + END, DISABLED, NSEW, Y, X, W, E, HORIZONTAL, NS, EW, \ + ANCHOR, NORMAL import tkMessageBox, tkColorChooser, tkFont -import string -from configHandler import idleConf -from dynOptionMenuWidget import DynOptionMenu +from stylist import PoorManStyle from tabbedpages import TabbedPageSet +from configHandler import idleConf from keybindingDialog import GetKeysDialog -from configSectionNameDialog import GetCfgSectionNameDialog +from dynOptionMenuWidget import DynOptionMenu from configHelpSourceEdit import GetHelpSourceDialog -from stylist import PoorManStyle +from configSectionNameDialog import GetCfgSectionNameDialog TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') if TTK: - from ttk import * + from ttk import Frame, Button, Checkbutton, LabelFrame, LabeledScale, \ + Combobox, Entry, Radiobutton, Scrollbar, Label, Style class ConfigDialog(Toplevel): @@ -31,8 +36,8 @@ self.wm_withdraw() self.configure(borderwidth=5) - self.geometry("+%d+%d" % (parent.winfo_rootx()+20, - parent.winfo_rooty()+30)) + self.geometry("+%d+%d" % (parent.winfo_rootx() + 20, + parent.winfo_rooty() + 30)) #Theme Elements. Each theme element key is its display name. #The first value of the tuple is the sample area tag name. #The second value is the display name list sort index. @@ -53,7 +58,7 @@ self.ResetChangedItems() #load initial values in changed items dict self.SetupStyles() self.CreateWidgets() - self.resizable(height=FALSE,width=FALSE) + self.resizable(height=False, width=False) self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.Cancel) @@ -86,17 +91,17 @@ def CreateWidgets(self): self.tabPages = TabbedPageSet(self, - page_names=['Fonts/Tabs','Highlighting','Keys','General']) + page_names=['Fonts/Tabs','Highlighting','Keys','General']) frameActionButtons = Frame(self) #action buttons self.buttonHelp = Button(frameActionButtons,text='Help', - command=self.Help, takefocus=FALSE) + command=self.Help, takefocus=False) self.buttonOk = Button(frameActionButtons, text='Ok', - command=self.Ok, takefocus=FALSE) + command=self.Ok, takefocus=False) self.buttonApply = Button(frameActionButtons, text='Apply', - command=self.Apply, takefocus=FALSE) + command=self.Apply, takefocus=False) self.buttonCancel = Button(frameActionButtons, text='Cancel', - command=self.Cancel, takefocus=FALSE) + command=self.Cancel, takefocus=False) # Apply styles s = self.style @@ -114,9 +119,9 @@ self.buttonApply.pack(side=RIGHT, pady=6) self.buttonOk.pack(side=RIGHT, padx=6, pady=6) self.buttonCancel.pack(side=RIGHT, pady=6) - frameActionButtons.pack(side=BOTTOM, fill=X, expand=TRUE) + frameActionButtons.pack(side=BOTTOM, fill=X, expand=True) Frame(self, height=2, borderwidth=0).pack(side=BOTTOM) - self.tabPages.pack(side=TOP,expand=TRUE,fill=BOTH) + self.tabPages.pack(side=TOP,expand=True,fill=BOTH) def CreatePageFontTab(self): #tkVars @@ -138,8 +143,8 @@ frameFontParam=Frame(frameFont) labelFontNameTitle=Label(frameFontName,justify=LEFT, text='Font Face :') - self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE, - exportselection=FALSE) + self.listFontName=Listbox(frameFontName,height=5,takefocus=False, + exportselection=False) self.listFontName.bind('',self.OnListFontButtonRelease) scrollFont=Scrollbar(frameFontName) scrollFont.config(command=self.listFontName.yview) @@ -159,18 +164,18 @@ text='Python Standard: 4 Spaces!') #widget packing #body - frameFont.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH) + frameFont.pack(side=LEFT,padx=5,pady=5,expand=True,fill=BOTH) frameIndent.pack(side=LEFT,padx=5,pady=5,fill=Y) #frameFont frameFontName.pack(side=TOP,padx=5,pady=5,fill=X) frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X) labelFontNameTitle.pack(side=TOP,anchor=W) - self.listFontName.pack(side=LEFT,expand=TRUE,fill=X) + self.listFontName.pack(side=LEFT,expand=True,fill=X) scrollFont.pack(side=LEFT,fill=Y) labelFontSizeTitle.pack(side=LEFT,anchor=W) self.optMenuFontSize.pack(side=LEFT,anchor=W) checkFontBold.pack(side=LEFT,anchor=W,padx=20) - frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) + frameFontSample.pack(side=TOP,padx=5,pady=5,expand=True,fill=BOTH) self.labelFontSample.pack(expand=1, fill=Y) #frameIndent frameIndentSize.pack(side=TOP,fill=X) @@ -206,7 +211,7 @@ #frameCustom self.textHighlightSample=Text(frameCustom,relief=SOLID,borderwidth=1, font=('courier',12,''), cursor='hand2', width=21, height=11, - takefocus=FALSE,highlightthickness=0,wrap=NONE) + takefocus=False,highlightthickness=0,wrap=NONE) text=self.textHighlightSample text.bind('',lambda e: 'break') text.bind('',lambda e: 'break') @@ -258,15 +263,15 @@ command=self.DeleteCustomTheme) ##widget packing #body - frameCustom.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH) + frameCustom.pack(side=LEFT,padx=5,pady=5,expand=True,fill=BOTH) frameTheme.pack(side=LEFT,padx=5,pady=5,fill=Y) #frameCustom - self.frameColourSet.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=X) + self.frameColourSet.pack(side=TOP,padx=5,pady=5,expand=True,fill=X) frameFgBg.pack(side=TOP,padx=5,pady=0) - self.textHighlightSample.pack(side=TOP,padx=5,pady=5,expand=TRUE, + self.textHighlightSample.pack(side=TOP,padx=5,pady=5,expand=True, fill=BOTH) - buttonSetColour.pack(side=TOP,expand=TRUE,fill=X,padx=8,pady=4) - self.optMenuHighlightTarget.pack(side=TOP,expand=TRUE,fill=X,padx=8,pady=3) + buttonSetColour.pack(side=TOP,expand=True,fill=X,padx=8,pady=4) + self.optMenuHighlightTarget.pack(side=TOP,expand=True,fill=X,padx=8,pady=3) self.radioFg.pack(side=LEFT,anchor=E) self.radioBg.pack(side=RIGHT,anchor=W) buttonSaveCustomTheme.pack(side=BOTTOM,fill=X,padx=5,pady=5) @@ -299,8 +304,8 @@ labelTargetTitle=Label(frameTarget,text='Action - Key(s)') scrollTargetY=Scrollbar(frameTarget) scrollTargetX=Scrollbar(frameTarget,orient=HORIZONTAL) - self.listBindings=Listbox(frameTarget,takefocus=FALSE, - exportselection=FALSE) + self.listBindings=Listbox(frameTarget,takefocus=False, + exportselection=False) self.listBindings.bind('',self.KeyBindingSelected) scrollTargetY.config(command=self.listBindings.yview) scrollTargetX.config(command=self.listBindings.xview) @@ -328,11 +333,11 @@ text='Save as New Custom Key Set',command=self.SaveAsNewKeySet) ##widget packing #body - frameCustom.pack(side=BOTTOM,padx=5,pady=5,expand=TRUE,fill=BOTH) + frameCustom.pack(side=BOTTOM,padx=5,pady=5,expand=True,fill=BOTH) frameKeySets.pack(side=BOTTOM,padx=5,pady=5,fill=BOTH) #frameCustom self.buttonNewKeys.pack(side=BOTTOM,fill=X,padx=5,pady=5) - frameTarget.pack(side=LEFT,padx=5,pady=5,expand=TRUE,fill=BOTH) + frameTarget.pack(side=LEFT,padx=5,pady=5,expand=True,fill=BOTH) #frame target frameTarget.columnconfigure(0,weight=1) frameTarget.rowconfigure(1,weight=1) @@ -420,8 +425,8 @@ frameHelpList=Frame(frameHelp) frameHelpListButtons=Frame(frameHelpList) scrollHelpList=Scrollbar(frameHelpList) - self.listHelp=Listbox(frameHelpList,height=5,takefocus=FALSE, - exportselection=FALSE) + self.listHelp=Listbox(frameHelpList,height=5,takefocus=False, + exportselection=False) scrollHelpList.config(command=self.listHelp.yview) self.listHelp.config(yscrollcommand=scrollHelpList.set) self.listHelp.bind('',self.HelpSourceSelected) @@ -440,7 +445,7 @@ frameEncoding.pack(side=TOP,padx=5,pady=5,fill=X) if TTK: frameTheme.pack(side=TOP, padx=5, pady=5, fill=X) - frameHelp.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) + frameHelp.pack(side=TOP,padx=5,pady=5,expand=True,fill=BOTH) #frameRun labelRunChoiceTitle.pack(side=LEFT,anchor=W,padx=5,pady=5) radioStartupShell.pack(side=RIGHT,anchor=W,padx=5,pady=5) @@ -469,9 +474,9 @@ comboTheme.pack(side=RIGHT, anchor=E, padx=5, pady=5) #frameHelp frameHelpListButtons.pack(side=RIGHT,padx=5,pady=5,fill=Y) - frameHelpList.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) + frameHelpList.pack(side=TOP,padx=5,pady=5,expand=True,fill=BOTH) scrollHelpList.pack(side=RIGHT,anchor=W,fill=Y) - self.listHelp.pack(side=LEFT,anchor=E,expand=TRUE,fill=BOTH) + self.listHelp.pack(side=LEFT,anchor=E,expand=True,fill=BOTH) self.buttonHelpListEdit.pack(side=TOP,anchor=W,pady=5) self.buttonHelpListAdd.pack(side=TOP,anchor=W) self.buttonHelpListRemove.pack(side=TOP,anchor=W,pady=5) @@ -709,7 +714,7 @@ newKeys={} for event in prevKeys.keys(): #add key set to changed items eventName=event[2:-2] #trim off the angle brackets - binding=string.join(prevKeys[event]) + binding=' '.join(prevKeys[event]) newKeys[eventName]=binding #handle any unsaved changes to prev key set if prevKeySetName in self.changedItems['keys'].keys(): @@ -736,7 +741,7 @@ bindNames.sort() self.listBindings.delete(0,END) for bindName in bindNames: - key=string.join(keySet[bindName]) #make key(s) into a string + key=' '.join(keySet[bindName]) #make key(s) into a string bindName=bindName[2:-2] #trim off the angle brackets if keySetName in self.changedItems['keys'].keys(): #handle any unsaved changes to this key set @@ -974,7 +979,7 @@ self.changedItems['main']['HelpFiles'] = {} for num in range(1,len(self.userHelpList)+1): self.AddChangedItem('main','HelpFiles',str(num), - string.join(self.userHelpList[num-1][:2],';')) + ';'.join(self.userHelpList[num - 1][:2])) def LoadFontCfg(self): ##base editor font selection list @@ -1204,6 +1209,7 @@ pass if __name__ == '__main__': + from Tkinter import Tk #test the dialog root=Tk() Button(root,text='Dialog', Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/configHelpSourceEdit.py Sat Jul 12 17:21:49 2008 @@ -1,15 +1,16 @@ "Dialog to specify or edit the parameters for a user configured help source." import os import sys -from Tkinter import * +from Tkinter import Toplevel, Frame, Entry, Button, Label, StringVar +from Tkconstants import GROOVE, LEFT, RIGHT, W, ACTIVE, X, BOTH, TOP, BOTTOM import tkMessageBox import tkFileDialog -from idlelib.configHandler import idleConf +from configHandler import idleConf TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') if TTK: - from ttk import * + from ttk import Frame, Entry, Button, Label class GetHelpSourceDialog(Toplevel): def __init__(self, parent, title, menuItem='', filePath=''): @@ -22,7 +23,7 @@ """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) - self.resizable(height=FALSE, width=FALSE) + self.resizable(height=False, width=False) self.title(title) self.transient(parent) self.grab_set() @@ -68,7 +69,7 @@ self.entryMenu.focus_set() - self.frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) + self.frameMain.pack(side=TOP, expand=True, fill=BOTH) labelMenu.pack(anchor=W, padx=5, pady=3) self.entryMenu.pack(anchor=W, padx=5, pady=3, fill=X) labelPath.pack(anchor=W, padx=5, pady=3) @@ -167,6 +168,7 @@ self.destroy() if __name__ == '__main__': + from Tkinter import Tk #test the dialog root = Tk() def run(): Modified: sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/configSectionNameDialog.py Sat Jul 12 17:21:49 2008 @@ -2,14 +2,15 @@ Dialog that allows user to specify a new config file section name. Used to get new highlight theme and keybinding set names. """ -from Tkinter import * +from Tkinter import Toplevel, Entry, Frame, Label, Button, StringVar +from Tkconstants import TOP, BOTTOM, RIGHT, BOTH, SUNKEN, X import tkMessageBox -from idlelib.configHandler import idleConf +from configHandler import idleConf TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') if TTK: - from ttk import * + from ttk import Entry, Frame, Label, Button class GetCfgSectionNameDialog(Toplevel): def __init__(self, parent, title, message, usedNames): @@ -19,7 +20,7 @@ """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) - self.resizable(height=FALSE, width=FALSE) + self.resizable(height=False, width=False) self.title(title) self.transient(parent) self.grab_set() @@ -52,7 +53,7 @@ entryName.focus_set() - self.frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) + self.frameMain.pack(side=TOP, expand=True, fill=BOTH) self.messageInfo.pack(padx=5, pady=5) entryName.pack(padx=5, pady=5) frameButtons.pack(side=BOTTOM, fill=X) @@ -98,11 +99,12 @@ self.destroy() if __name__ == '__main__': + from Tkinter import Tk #test the dialog def run(): keySeq = '' dlg = GetCfgSectionNameDialog(root, 'Get Name', - 'The information here should need to be word wrapped. Test.') + 'The information here should need to be word wrapped. Test.', []) print dlg.result root=Tk() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/keybindingDialog.py Sat Jul 12 17:21:49 2008 @@ -1,15 +1,17 @@ """ Dialog for building Tkinter accelerator key bindings """ -from Tkinter import * +from Tkinter import Toplevel, Frame, Entry, Button, Checkbutton, Label, \ + Listbox, Scrollbar, StringVar +from Tkconstants import TOP, BOTH, BOTTOM, X, NSEW, SUNKEN, LEFT, GROOVE, W, \ + END, EW, NS, SINGLE, VERTICAL, ANCHOR, MOVETO import tkMessageBox import string from idlelib.configHandler import idleConf - TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') if TTK: - from ttk import * + from ttk import Frame, Entry, Button, Checkbutton, Label, Scrollbar class GetKeysDialog(Toplevel): def __init__(self,parent,title,action,currentKeySequences): @@ -21,7 +23,7 @@ """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) - self.resizable(height=FALSE,width=FALSE) + self.resizable(height=False, width=False) self.title(title) self.transient(parent) self.grab_set() @@ -52,10 +54,10 @@ self.wait_window() def CreateWidgets(self): - frameMain = Frame(self,borderwidth=2,relief=SUNKEN) - frameMain.pack(side=TOP,expand=TRUE,fill=BOTH) + frameMain = Frame(self, borderwidth=2, relief=SUNKEN) + frameMain.pack(side=TOP, expand=True, fill=BOTH) frameButtons=Frame(self) - frameButtons.pack(side=BOTTOM,fill=X) + frameButtons.pack(side=BOTTOM, fill=X) self.buttonOK = Button(frameButtons,text='OK', width=8,command=self.OK) self.buttonOK.grid(row=0,column=0,padx=5,pady=5) @@ -172,7 +174,7 @@ if finalKey: finalKey = self.TranslateKey(finalKey, modifiers) keyList.append(finalKey) - self.keyString.set('<' + string.join(keyList,'-') + '>') + self.keyString.set('<%s>' % '-'.join(keyList)) def GetModifiers(self): modList = [variable.get() for variable in self.modifier_vars] @@ -267,6 +269,7 @@ return keysOK if __name__ == '__main__': + from Tkinter import Tk #test the dialog root=Tk() def run(): Modified: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_new.py Sat Jul 12 17:21:49 2008 @@ -2,8 +2,7 @@ TabbedPageSet -- A custom ttk.Notebook used by IDLE. """ -from Tkinter import * -from ttk import * +from ttk import Frame, Notebook class InvalidNameError(Exception): pass class AlreadyExistsError(Exception): pass @@ -64,12 +63,15 @@ self.event_generate('') if __name__ == '__main__': + from Tkinter import Tk + from Tkconstants import TOP, BOTH + from ttk import Label, Entry, Button, Style # test dialog root=Tk() style = Style() style.configure('C.TLabel', padding=20) tabPage=TabbedPageSet(root, page_names=['Foobar','Baz']) - tabPage.pack(side=TOP, expand=TRUE, fill=BOTH) + tabPage.pack(side=TOP, expand=True, fill=BOTH) Label(tabPage.pages['Foobar'].frame, text='Foo', style='C.TLabel').pack() Label(tabPage.pages['Foobar'].frame, text='Bar', style='C.TLabel').pack() Label(tabPage.pages['Baz'].frame, text='Baz').pack() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/tabbedpages_old.py Sat Jul 12 17:21:49 2008 @@ -7,7 +7,8 @@ TabSet -- A widget containing tabs (buttons) in one or more rows. """ -from Tkinter import * +from Tkinter import Frame, Radiobutton +from Tkconstants import BOTH, TOP, X, RAISED, NSEW, FLAT, LEFT class InvalidNameError(Exception): pass class AlreadyExistsError(Exception): pass @@ -78,7 +79,7 @@ def remove_tab(self, tab_name): """Remove the tab named """ if not tab_name in self._tab_names: - raise KeyError("No such Tab: '%s" % page_name) + raise KeyError("No such Tab: '%s" % tab_name) self._tab_names.remove(tab_name) self._arrange_tabs() @@ -88,7 +89,7 @@ if tab_name == self._selected_tab: return if tab_name is not None and tab_name not in self._tabs: - raise KeyError("No such Tab: '%s" % page_name) + raise KeyError("No such Tab: '%s" % tab_name) # deselect the current selected tab if self._selected_tab is not None: @@ -195,7 +196,7 @@ self.button = Radiobutton( self, text=name, command=self._select_event, - padx=5, pady=1, takefocus=FALSE, indicatoron=FALSE, + padx=5, pady=1, takefocus=False, indicatoron=False, highlightthickness=0, selectcolor='', borderwidth=0) self.button.pack(side=LEFT, fill=X, expand=True) @@ -468,12 +469,13 @@ self._tab_set.set_selected_tab(page_name) if __name__ == '__main__': + from Tkinter import Tk, Label, Entry, Button # test dialog root=Tk() tabPage=TabbedPageSet(root, page_names=['Foobar','Baz'], n_rows=0, expand_tabs=False, ) - tabPage.pack(side=TOP, expand=TRUE, fill=BOTH) + tabPage.pack(side=TOP, expand=True, fill=BOTH) Label(tabPage.pages['Foobar'].frame, text='Foo', pady=20).pack() Label(tabPage.pages['Foobar'].frame, text='Bar', pady=20).pack() Label(tabPage.pages['Baz'].frame, text='Baz').pack() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/textView.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/textView.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/textView.py Sat Jul 12 17:21:49 2008 @@ -1,12 +1,15 @@ """Simple text browser for IDLE""" import tkMessageBox -from Tkinter import * -from idlelib.configHandler import idleConf +from Tkinter import Toplevel, Frame, Button, Scrollbar, Text +from Tkconstants import DISABLED, SUNKEN, VERTICAL, WORD, RIGHT, Y, TOP, \ + LEFT, BOTH, BOTTOM + +from configHandler import idleConf TTK = idleConf.GetOption('main', 'General', 'use-ttk', type='int') if TTK: - from ttk import * + from ttk import Frame, Button, Scrollbar class TextViewer(Toplevel): """A simple text viewer dialog for IDLE @@ -43,18 +46,18 @@ frameText = Frame(self, relief=SUNKEN, height=700) frameButtons = Frame(self) self.buttonOk = Button(frameButtons, text='Close', - command=self.Ok, takefocus=FALSE) + command=self.Ok, takefocus=False) self.scrollbarView = Scrollbar(frameText, orient=VERTICAL, - takefocus=FALSE) + takefocus=False) self.textView = Text(frameText, wrap=WORD, fg=self.fg, bg=self.bg, highlightthickness=0) self.scrollbarView.config(command=self.textView.yview) self.textView.config(yscrollcommand=self.scrollbarView.set) self.buttonOk.pack() self.scrollbarView.pack(side=RIGHT,fill=Y) - self.textView.pack(side=LEFT,expand=TRUE,fill=BOTH) + self.textView.pack(side=LEFT,expand=True,fill=BOTH) frameButtons.pack(side=BOTTOM) - frameText.pack(side=TOP,expand=TRUE,fill=BOTH) + frameText.pack(side=TOP,expand=True,fill=BOTH) if TTK: frameButtons['style'] = 'RootColor.TFrame' @@ -74,7 +77,6 @@ else: textFile = open(filename, 'r') except IOError: - import tkMessageBox tkMessageBox.showerror(title='File Load Error', message='Unable to load file %r .' % filename, parent=parent) @@ -83,6 +85,7 @@ if __name__ == '__main__': + from Tkinter import Tk #test the dialog root=Tk() root.title('textView test') From python-checkins at python.org Sat Jul 12 17:26:31 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 12 Jul 2008 17:26:31 +0200 (CEST) Subject: [Python-checkins] r64893 - in sandbox/trunk/ttk-gsoc/src/idlelib: IOBinding.py Percolator.py PyShell.py Message-ID: <20080712152631.B63231E4004@bag.python.org> Author: guilherme.polo Date: Sat Jul 12 17:26:22 2008 New Revision: 64893 Log: Removed "from Tkinter import *" from the remaining modules (except EditorWindow) and reorganized PyShell imports Modified: sandbox/trunk/ttk-gsoc/src/idlelib/IOBinding.py sandbox/trunk/ttk-gsoc/src/idlelib/Percolator.py sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py Modified: sandbox/trunk/ttk-gsoc/src/idlelib/IOBinding.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/IOBinding.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/IOBinding.py Sat Jul 12 17:26:22 2008 @@ -6,20 +6,20 @@ # which will only understand the local convention. import os -import types +import re import sys +import types import codecs import tempfile import tkFileDialog import tkMessageBox -import re -from Tkinter import * +from Tkinter import Toplevel, Entry, Frame, Button, Label +from Tkconstants import W, X, TOP, LEFT, BOTH from SimpleDialog import SimpleDialog from configHandler import idleConf - if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): - from ttk import * + from ttk import Entry, Frame, Button, Label try: from codecs import BOM_UTF8 @@ -96,11 +96,11 @@ # For some reason, the text is not selectable anymore if the # widget is disabled. # l2['state'] = DISABLED - l2.pack(side=TOP, anchor = W, fill=X) + l2.pack(side=TOP, anchor=W, fill=X) l3 = Label(top, text="to your file\n" "Choose OK to save this file as %s\n" "Edit your general options to silence this warning" % enc) - l3.pack(side=TOP, anchor = W) + l3.pack(side=TOP, anchor=W) buttons = Frame(top) buttons.pack(side=TOP, fill=X) @@ -566,6 +566,7 @@ self.editwin.update_recent_files_list(filename) def test(): + from Tkinter import Tk, Text root = Tk() class MyEditWin: def __init__(self, text): Modified: sandbox/trunk/ttk-gsoc/src/idlelib/Percolator.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/Percolator.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/Percolator.py Sat Jul 12 17:26:22 2008 @@ -1,5 +1,5 @@ -from WidgetRedirector import WidgetRedirector from Delegator import Delegator +from WidgetRedirector import WidgetRedirector class Percolator: @@ -81,5 +81,5 @@ root.mainloop() if __name__ == "__main__": - from Tkinter import * + from Tkinter import Tk, Text main() Modified: sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/PyShell.py Sat Jul 12 17:26:22 2008 @@ -1,29 +1,25 @@ #! /usr/bin/env python - import os -import os.path +import re import sys +import time +import types import string import getopt -import re import socket -import time -import threading -import traceback -import types -import macosxSupport - import linecache +import threading from code import InteractiveInterpreter try: - from Tkinter import * + from Tkinter import Tk, TclError + from Tkconstants import END except ImportError: print>>sys.__stderr__, "** IDLE can't import Tkinter. " \ "Your Python may not be configured for Tk. **" sys.exit(1) try: - from ttk import * + from ttk import Style TTK = 1 except ImportError: print >> sys.stderr, "** IDLE can't import ttk." @@ -31,22 +27,22 @@ import tkMessageBox +import macosxSupport from configHandler import idleConf # store ttk availability idleConf.SetOption('main', 'General', 'use-ttk', str(TTK)) idleConf.SaveUserCfgFiles() -from EditorWindow import EditorWindow, fixwordbreaks -from FileList import FileList -from ColorDelegator import ColorDelegator -from UndoDelegator import UndoDelegator -from OutputWindow import OutputWindow -import idlever - import rpc +import idlever import Debugger import RemoteDebugger +from FileList import FileList +from OutputWindow import OutputWindow +from EditorWindow import EditorWindow, fixwordbreaks +from UndoDelegator import UndoDelegator +from ColorDelegator import ColorDelegator IDENTCHARS = string.ascii_letters + string.digits + "_" LOCALHOST = '127.0.0.1' From python-checkins at python.org Sat Jul 12 17:49:00 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 12 Jul 2008 17:49:00 +0200 (CEST) Subject: [Python-checkins] r64894 - sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py Message-ID: <20080712154900.5E4451E4004@bag.python.org> Author: guilherme.polo Date: Sat Jul 12 17:49:00 2008 New Revision: 64894 Log: Removed 'from Tkinter import *' usage; Moved imports to top (except ColorDelegator import); Reorganized imports; Replaced itertools.count usage by enumerate; Modified: sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py Modified: sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py (original) +++ sandbox/trunk/ttk-gsoc/src/idlelib/EditorWindow.py Sat Jul 12 17:49:00 2008 @@ -1,27 +1,36 @@ -import sys import os import re +import sys import imp -from itertools import count -from Tkinter import * -import tkSimpleDialog +import traceback +import webbrowser import tkMessageBox -from MultiCall import MultiCallCreator +import tkSimpleDialog +from Tkinter import Frame, Text, Menu, Scrollbar, TclError, BooleanVar +from Tkconstants import INSERT, END, RIGHT, BOTTOM, TOP, X, Y, BOTH, LEFT -import webbrowser import idlever +import textView +import aboutDialog +import configDialog +import macosxSupport +import PyParse +import Bindings +import GrepDialog import WindowList +import PathBrowser +import ClassBrowser import SearchDialog -import GrepDialog import ReplaceDialog -import PyParse from configHandler import idleConf -import aboutDialog, textView, configDialog -import macosxSupport +from MultiCall import MultiCallCreator +from IOBinding import IOBinding, filesystemencoding, encoding +from Percolator import Percolator +from UndoDelegator import UndoDelegator +from MultiStatusBar import MultiStatusBar if idleConf.GetOption('main', 'General', 'use-ttk', type='int'): - from ttk import Scrollbar - + from ttk import Frame, Scrollbar # The default tab setting for a Text widget, in average-width characters. TK_TABWIDTH_DEFAULT = 8 @@ -44,14 +53,7 @@ return file, filename, descr class EditorWindow(object): - from Percolator import Percolator from ColorDelegator import ColorDelegator - from UndoDelegator import UndoDelegator - from IOBinding import IOBinding, filesystemencoding, encoding - import Bindings - from Tkinter import Toplevel - from MultiStatusBar import MultiStatusBar - help_url = None def __init__(self, flist=None, filename=None, key=None, root=None): @@ -218,16 +220,16 @@ # Making the initial values larger slows things down more often. self.num_context_lines = 50, 500, 5000000 - self.per = per = self.Percolator(text) + self.per = per = Percolator(text) - self.undo = undo = self.UndoDelegator() + self.undo = undo = UndoDelegator() per.insertfilter(undo) text.undo_block_start = undo.undo_block_start text.undo_block_stop = undo.undo_block_stop undo.set_saved_change_hook(self.saved_change_hook) # IOBinding implements file I/O and printing functionality - self.io = io = self.IOBinding(self) + self.io = io = IOBinding(self) io.set_filename_change_hook(self.filename_change_hook) # Create the recent files submenu @@ -272,11 +274,11 @@ return filename else: try: - return filename.decode(self.filesystemencoding) + return filename.decode(filesystemencoding) except UnicodeDecodeError: # XXX try: - return filename.decode(self.encoding) + return filename.decode(encoding) except UnicodeDecodeError: # byte-to-byte conversion return filename.decode('iso8859-1') @@ -331,7 +333,7 @@ return "break" def set_status_bar(self): - self.status_bar = self.MultiStatusBar(self.top) + self.status_bar = MultiStatusBar(self.top) if macosxSupport.runningAsOSXApp(): # Insert some padding to avoid obscuring some of the statusbar # by the resize widget. @@ -567,11 +569,9 @@ return None head, tail = os.path.split(filename) base, ext = os.path.splitext(tail) - import ClassBrowser ClassBrowser.ClassBrowser(self.flist, base, [head]) def open_path_browser(self, event=None): - import PathBrowser PathBrowser.PathBrowser(self.flist) def gotoline(self, lineno): @@ -658,7 +658,7 @@ def RemoveKeybindings(self): "Remove the keybindings before they are changed." # Called from configDialog.py - self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet() + Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet() for event, keylist in keydefs.items(): self.text.event_delete(event, *keylist) for extensionName in self.get_standard_extension_names(): @@ -670,7 +670,7 @@ def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py - self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet() + Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): xkeydefs = idleConf.GetExtensionBindings(extensionName) @@ -678,7 +678,7 @@ self.apply_bindings(xkeydefs) #update menu accelerators menuEventDict = {} - for menu in self.Bindings.menudefs: + for menu in Bindings.menudefs: menuEventDict[menu[0]] = {} for item in menu[1]: if item: @@ -765,7 +765,7 @@ for instance in self.top.instance_dict.keys(): menu = instance.recent_files_menu menu.delete(1, END) # clear, and rebuild: - for i, file in zip(count(), rf_list): + for i, file in enumerate(rf_list): file_name = file[0:-1] # zap \n # make unicode string to display non-ASCII chars correctly ufile_name = self._filename_to_unicode(file_name) @@ -903,7 +903,6 @@ self.load_extension(name) except: print "Failed to load extension", repr(name) - import traceback traceback.print_exc() def get_standard_extension_names(self): @@ -935,7 +934,7 @@ def apply_bindings(self, keydefs=None): if keydefs is None: - keydefs = self.Bindings.default_keydefs + keydefs = Bindings.default_keydefs text = self.text text.keydefs = keydefs for event, keylist in keydefs.items(): @@ -948,9 +947,9 @@ Menus that are absent or None in self.menudict are ignored. """ if menudefs is None: - menudefs = self.Bindings.menudefs + menudefs = Bindings.menudefs if keydefs is None: - keydefs = self.Bindings.default_keydefs + keydefs = Bindings.default_keydefs menudict = self.menudict text = self.text for mname, entrylist in menudefs: From python-checkins at python.org Sat Jul 12 17:51:59 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 12 Jul 2008 17:51:59 +0200 (CEST) Subject: [Python-checkins] r64895 - sandbox/trunk/ttk-gsoc/src/idlelib/ToolTip.py Message-ID: <20080712155159.99F501E4004@bag.python.org> Author: guilherme.polo Date: Sat Jul 12 17:51:59 2008 New Revision: 64895 Log: Removed ToolTip.py since it is not used Removed: sandbox/trunk/ttk-gsoc/src/idlelib/ToolTip.py Deleted: sandbox/trunk/ttk-gsoc/src/idlelib/ToolTip.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/idlelib/ToolTip.py Sat Jul 12 17:51:59 2008 +++ (empty file) @@ -1,90 +0,0 @@ -# general purpose 'tooltip' routines - currently unused in idlefork -# (although the 'calltips' extension is partly based on this code) -# may be useful for some purposes in (or almost in ;) the current project scope -# Ideas gleaned from PySol - -from Tkinter import END, Listbox, Tk, Toplevel -from ttk import Button, Label - -class ToolTipBase: - - def __init__(self, button): - self.button = button - self.tipwindow = None - self.id = None - self.x = self.y = 0 - self._id1 = self.button.bind("", self.enter) - self._id2 = self.button.bind("", self.leave) - self._id3 = self.button.bind("", self.leave) - - def enter(self, event=None): - self.schedule() - - def leave(self, event=None): - self.unschedule() - self.hidetip() - - def schedule(self): - self.unschedule() - self.id = self.button.after(1500, self.showtip) - - def unschedule(self): - id = self.id - self.id = None - if id: - self.button.after_cancel(id) - - def showtip(self): - if self.tipwindow: - return - # The tip window must be completely outside the button; - # otherwise when the mouse enters the tip window we get - # a leave event and it disappears, and then we get an enter - # event and it reappears, and so on forever :-( - x = self.button.winfo_rootx() + 20 - y = self.button.winfo_rooty() + self.button.winfo_height() + 1 - self.tipwindow = tw = Toplevel(self.button) - tw.wm_overrideredirect(1) - tw.wm_geometry("+%d+%d" % (x, y)) - self.showcontents() - - def showcontents(self, text="Your text here"): - # Override this in derived class - label = Label(self.tipwindow, text=text, justify=LEFT, - background="#ffffe0", relief=SOLID, borderwidth=1) - label.pack() - - def hidetip(self): - tw = self.tipwindow - self.tipwindow = None - if tw: - tw.destroy() - -class ToolTip(ToolTipBase): - def __init__(self, button, text): - ToolTipBase.__init__(self, button) - self.text = text - def showcontents(self): - ToolTipBase.showcontents(self, self.text) - -class ListboxToolTip(ToolTipBase): - def __init__(self, button, items): - ToolTipBase.__init__(self, button) - self.items = items - def showcontents(self): - listbox = Listbox(self.tipwindow, background="#ffffe0") - listbox.pack() - for item in self.items: - listbox.insert(END, item) - -def main(): - # Test code - root = Tk() - b = Button(root, text="Hello", command=root.destroy) - b.pack() - root.update() - tip = ListboxToolTip(b, ["Hello", "world"]) - root.mainloop() - -if __name__ == '__main__': - main() From python-checkins at python.org Sat Jul 12 22:16:20 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 12 Jul 2008 22:16:20 +0200 (CEST) Subject: [Python-checkins] r64897 - in python/trunk/Doc: c-api/conversion.rst extending/windows.rst library/__future__.rst library/ftplib.rst library/functions.rst library/imputil.rst library/macosa.rst library/multiprocessing.rst library/operator.rst library/select.rst library/stdtypes.rst library/string.rst library/tix.rst library/turtle.rst library/urllib2.rst library/wsgiref.rst library/xmlrpclib.rst tutorial/stdlib2.rst using/windows.rst whatsnew/2.6.rst Message-ID: <20080712201620.3290B1E4006@bag.python.org> Author: benjamin.peterson Date: Sat Jul 12 22:16:19 2008 New Revision: 64897 Log: fix various doc typos #3320 Modified: python/trunk/Doc/c-api/conversion.rst python/trunk/Doc/extending/windows.rst python/trunk/Doc/library/__future__.rst python/trunk/Doc/library/ftplib.rst python/trunk/Doc/library/functions.rst python/trunk/Doc/library/imputil.rst python/trunk/Doc/library/macosa.rst python/trunk/Doc/library/multiprocessing.rst python/trunk/Doc/library/operator.rst python/trunk/Doc/library/select.rst python/trunk/Doc/library/stdtypes.rst python/trunk/Doc/library/string.rst python/trunk/Doc/library/tix.rst python/trunk/Doc/library/turtle.rst python/trunk/Doc/library/urllib2.rst python/trunk/Doc/library/wsgiref.rst python/trunk/Doc/library/xmlrpclib.rst python/trunk/Doc/tutorial/stdlib2.rst python/trunk/Doc/using/windows.rst python/trunk/Doc/whatsnew/2.6.rst Modified: python/trunk/Doc/c-api/conversion.rst ============================================================================== --- python/trunk/Doc/c-api/conversion.rst (original) +++ python/trunk/Doc/c-api/conversion.rst Sat Jul 12 22:16:19 2008 @@ -89,15 +89,15 @@ .. cfunction:: char * PyOS_stricmp(char *s1, char *s2) - Case insensitive comparsion of strings. The functions works almost - identical to :cfunc:`strcmp` except that it ignores the case. + Case insensitive comparison of strings. The function works almost + identically to :cfunc:`strcmp` except that it ignores the case. .. versionadded:: 2.6 .. cfunction:: char * PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size) - Case insensitive comparsion of strings. The functions works almost - identical to :cfunc:`strncmp` except that it ignores the case. + Case insensitive comparison of strings. The function works almost + identically to :cfunc:`strncmp` except that it ignores the case. .. versionadded:: 2.6 Modified: python/trunk/Doc/extending/windows.rst ============================================================================== --- python/trunk/Doc/extending/windows.rst (original) +++ python/trunk/Doc/extending/windows.rst Sat Jul 12 22:16:19 2008 @@ -23,7 +23,7 @@ This chapter mentions a number of filenames that include an encoded Python version number. These filenames are represented with the version number shown - as ``XY``; in practive, ``'X'`` will be the major version number and ``'Y'`` + as ``XY``; in practice, ``'X'`` will be the major version number and ``'Y'`` will be the minor version number of the Python release you're working with. For example, if you are using Python 2.2.1, ``XY`` will actually be ``22``. Modified: python/trunk/Doc/library/__future__.rst ============================================================================== --- python/trunk/Doc/library/__future__.rst (original) +++ python/trunk/Doc/library/__future__.rst Sat Jul 12 22:16:19 2008 @@ -16,7 +16,7 @@ * To document when incompatible changes were introduced, and when they will be --- or were --- made mandatory. This is a form of executable documentation, and - can be inspected programatically via importing :mod:`__future__` and examining + can be inspected programmatically via importing :mod:`__future__` and examining its contents. Each statement in :file:`__future__.py` is of the form:: Modified: python/trunk/Doc/library/ftplib.rst ============================================================================== --- python/trunk/Doc/library/ftplib.rst (original) +++ python/trunk/Doc/library/ftplib.rst Sat Jul 12 22:16:19 2008 @@ -316,7 +316,7 @@ Send a ``QUIT`` command to the server and close the connection. This is the "polite" way to close a connection, but it may raise an exception of the server - reponds with an error to the ``QUIT`` command. This implies a call to the + responds with an error to the ``QUIT`` command. This implies a call to the :meth:`close` method which renders the :class:`FTP` instance useless for subsequent calls (see below). Modified: python/trunk/Doc/library/functions.rst ============================================================================== --- python/trunk/Doc/library/functions.rst (original) +++ python/trunk/Doc/library/functions.rst Sat Jul 12 22:16:19 2008 @@ -1389,7 +1389,7 @@ or use in modern Python programming. They have been kept here to maintain backwards compatibility with programs written for older versions of Python. -Python programmers, trainers, students and bookwriters should feel free to +Python programmers, trainers, students and book writers should feel free to bypass these functions without concerns about missing something important. Modified: python/trunk/Doc/library/imputil.rst ============================================================================== --- python/trunk/Doc/library/imputil.rst (original) +++ python/trunk/Doc/library/imputil.rst Sat Jul 12 22:16:19 2008 @@ -108,7 +108,7 @@ This code is intended to be read, not executed. However, it does work -- all you need to do to enable it is "import knee". -(The name is a pun on the klunkier predecessor of this module, "ni".) +(The name is a pun on the clunkier predecessor of this module, "ni".) :: Modified: python/trunk/Doc/library/macosa.rst ============================================================================== --- python/trunk/Doc/library/macosa.rst (original) +++ python/trunk/Doc/library/macosa.rst Sat Jul 12 22:16:19 2008 @@ -6,10 +6,10 @@ ********************* This chapter describes the current implementation of the Open Scripting -Architecure (OSA, also commonly referred to as AppleScript) for Python, allowing -you to control scriptable applications from your Python program, and with a -fairly pythonic interface. Development on this set of modules has stopped, and a -replacement is expected for Python 2.5. +Architecture (OSA, also commonly referred to as AppleScript) for Python, +allowing you to control scriptable applications from your Python program, +and with a fairly pythonic interface. Development on this set of modules has +stopped, and a replacement is expected for Python 2.5. For a description of the various components of AppleScript and OSA, and to get an understanding of the architecture and terminology, you should read Apple's Modified: python/trunk/Doc/library/multiprocessing.rst ============================================================================== --- python/trunk/Doc/library/multiprocessing.rst (original) +++ python/trunk/Doc/library/multiprocessing.rst Sat Jul 12 22:16:19 2008 @@ -160,7 +160,7 @@ The ``'d'`` and ``'i'`` arguments used when creating ``num`` and ``arr`` are typecodes of the kind used by the :mod:`array` module: ``'d'`` indicates a - double precision float and ``'i'`` inidicates a signed integer. These shared + double precision float and ``'i'`` indicates a signed integer. These shared objects will be process and thread safe. For more flexibility in using shared memory one can use the @@ -784,7 +784,7 @@ A bounded semaphore object: a clone of :class:`threading.BoundedSemaphore`. - (On Mac OSX this is indistiguishable from :class:`Semaphore` because + (On Mac OSX this is indistinguishable from :class:`Semaphore` because ``sem_getvalue()`` is not implemented on that platform). .. class:: Condition([lock]) @@ -893,8 +893,8 @@ .. note:: - Although it is posible to store a pointer in shared memory remember that this - will refer to a location in the address space of a specific process. + Although it is possible to store a pointer in shared memory remember that + this will refer to a location in the address space of a specific process. However, the pointer is quite likely to be invalid in the context of a second process and trying to dereference the pointer from the second process may cause a crash. @@ -1776,7 +1776,7 @@ handler which sends output to :data:`sys.stderr` using format ``'[%(levelname)s/%(processName)s] %(message)s'``. (The logger allows use of the non-standard ``'%(processName)s'`` format.) Message sent to this logger - will not by default propogate to the root logger. + will not by default propagate to the root logger. Note that on Windows child processes will only inherit the level of the parent process's logger -- any other customization of the logger will not be Modified: python/trunk/Doc/library/operator.rst ============================================================================== --- python/trunk/Doc/library/operator.rst (original) +++ python/trunk/Doc/library/operator.rst Sat Jul 12 22:16:19 2008 @@ -630,7 +630,7 @@ +-----------------------+-------------------------+---------------------------------+ | Right Shift | ``a >> b`` | ``rshift(a, b)`` | +-----------------------+-------------------------+---------------------------------+ -| Sequence Repitition | ``seq * i`` | ``repeat(seq, i)`` | +| Sequence Repetition | ``seq * i`` | ``repeat(seq, i)`` | +-----------------------+-------------------------+---------------------------------+ | Slice Assignment | ``seq[i:j] = values`` | ``setslice(seq, i, j, values)`` | +-----------------------+-------------------------+---------------------------------+ Modified: python/trunk/Doc/library/select.rst ============================================================================== --- python/trunk/Doc/library/select.rst (original) +++ python/trunk/Doc/library/select.rst Sat Jul 12 22:16:19 2008 @@ -338,7 +338,7 @@ +---------------------------+---------------------------------------------+ | :const:`KQ_EV_DISABLE` | Disablesevent | +---------------------------+---------------------------------------------+ - | :const:`KQ_EV_ONESHOT` | Removes event after first occurence | + | :const:`KQ_EV_ONESHOT` | Removes event after first occurrence | +---------------------------+---------------------------------------------+ | :const:`KQ_EV_CLEAR` | Reset the state after an event is retrieved | +---------------------------+---------------------------------------------+ @@ -373,7 +373,7 @@ +============================+============================================+ | :const:`KQ_NOTE_DELETE` | *unlink()* was called | +----------------------------+--------------------------------------------+ - | :const:`KQ_NOTE_WRITE` | a write occured | + | :const:`KQ_NOTE_WRITE` | a write occurred | +----------------------------+--------------------------------------------+ | :const:`KQ_NOTE_EXTEND` | the file was extended | +----------------------------+--------------------------------------------+ Modified: python/trunk/Doc/library/stdtypes.rst ============================================================================== --- python/trunk/Doc/library/stdtypes.rst (original) +++ python/trunk/Doc/library/stdtypes.rst Sat Jul 12 22:16:19 2008 @@ -1543,7 +1543,7 @@ .. method:: isdisjoint(other) Return True if the set has no elements in common with *other*. Sets are - disjoint if and only if their interesection is the empty set. + disjoint if and only if their intersection is the empty set. .. versionadded:: 2.6 Modified: python/trunk/Doc/library/string.rst ============================================================================== --- python/trunk/Doc/library/string.rst (original) +++ python/trunk/Doc/library/string.rst Sat Jul 12 22:16:19 2008 @@ -293,7 +293,7 @@ "noses " -Which is subsitituted into the string, yielding:: +Which is substituted into the string, yielding:: "A man with two noses " Modified: python/trunk/Doc/library/tix.rst ============================================================================== --- python/trunk/Doc/library/tix.rst (original) +++ python/trunk/Doc/library/tix.rst Sat Jul 12 22:16:19 2008 @@ -310,8 +310,8 @@ .. \ulink{FileEntry}{http://tix.sourceforge.net/dist/current/demos/samples/FileEnt.tcl} -Hierachical ListBox -^^^^^^^^^^^^^^^^^^^ +Hierarchical ListBox +^^^^^^^^^^^^^^^^^^^^ .. class:: HList() Modified: python/trunk/Doc/library/turtle.rst ============================================================================== --- python/trunk/Doc/library/turtle.rst (original) +++ python/trunk/Doc/library/turtle.rst Sat Jul 12 22:16:19 2008 @@ -1275,7 +1275,7 @@ ... left(10) ... >>> for _ in range(8): - ... left(45); fd(2) # a regular octogon + ... left(45); fd(2) # a regular octagon Animation control @@ -1286,7 +1286,7 @@ :param delay: positive integer Set or return the drawing *delay* in milliseconds. (This is approximately - the time interval between two consecutived canvas updates.) The longer the + the time interval between two consecutive canvas updates.) The longer the drawing delay, the slower the animation. Optional argument: Modified: python/trunk/Doc/library/urllib2.rst ============================================================================== --- python/trunk/Doc/library/urllib2.rst (original) +++ python/trunk/Doc/library/urllib2.rst Sat Jul 12 22:16:19 2008 @@ -923,7 +923,7 @@ obtain the HTTP proxy's URL. This example replaces the default :class:`ProxyHandler` with one that uses -programatically-supplied proxy URLs, and adds proxy authorization support with +programmatically-supplied proxy URLs, and adds proxy authorization support with :class:`ProxyBasicAuthHandler`. :: proxy_handler = urllib2.ProxyHandler({'http': 'http://www.example.com:3128/'}) Modified: python/trunk/Doc/library/wsgiref.rst ============================================================================== --- python/trunk/Doc/library/wsgiref.rst (original) +++ python/trunk/Doc/library/wsgiref.rst Sat Jul 12 22:16:19 2008 @@ -415,7 +415,7 @@ from wsgiref.validate import validator from wsgiref.simple_server import make_server - # Our callable object which is intentionally not compilant to the + # Our callable object which is intentionally not compliant to the # standard, so the validator is going to break def simple_app(environ, start_response): status = '200 OK' # HTTP Status Modified: python/trunk/Doc/library/xmlrpclib.rst ============================================================================== --- python/trunk/Doc/library/xmlrpclib.rst (original) +++ python/trunk/Doc/library/xmlrpclib.rst Sat Jul 12 22:16:19 2008 @@ -379,7 +379,7 @@ try: proxy.add(2, 5) except xmlrpclib.Fault, err: - print "A fault occured" + print "A fault occurred" print "Fault code: %d" % err.faultCode print "Fault string: %s" % err.faultString @@ -426,7 +426,7 @@ try: proxy.some_method() except xmlrpclib.ProtocolError, err: - print "A protocol error occured" + print "A protocol error occurred" print "URL: %s" % err.url print "HTTP/HTTPS headers: %s" % err.headers print "Error code: %d" % err.errcode Modified: python/trunk/Doc/tutorial/stdlib2.rst ============================================================================== --- python/trunk/Doc/tutorial/stdlib2.rst (original) +++ python/trunk/Doc/tutorial/stdlib2.rst Sat Jul 12 22:16:19 2008 @@ -286,7 +286,7 @@ performance trade-offs. The :mod:`array` module provides an :class:`array()` object that is like a list -that stores only homogenous data and stores it more compactly. The following +that stores only homogeneous data and stores it more compactly. The following example shows an array of numbers stored as two byte unsigned binary numbers (typecode ``"H"``) rather than the usual 16 bytes per entry for regular lists of python int objects:: Modified: python/trunk/Doc/using/windows.rst ============================================================================== --- python/trunk/Doc/using/windows.rst (original) +++ python/trunk/Doc/using/windows.rst Sat Jul 12 22:16:19 2008 @@ -188,7 +188,7 @@ startup. You can also make all ``.py`` scripts execute with :program:`pythonw.exe`, -setting this through the usual facilites, for example (might require +setting this through the usual facilities, for example (might require administrative rights): #. Launch a command prompt. @@ -217,7 +217,7 @@ The `PyWin32 `_ module by Mark Hammond is a collection of modules for advanced Windows-specific support. This includes -utilites for: +utilities for: * `Component Object Model `_ (COM) * Win32 API calls Modified: python/trunk/Doc/whatsnew/2.6.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.6.rst (original) +++ python/trunk/Doc/whatsnew/2.6.rst Sat Jul 12 22:16:19 2008 @@ -529,7 +529,7 @@ .. XXX I think this still needs help :mod:`multiprocessing` makes it easy to distribute work over multiple processes. -Its API is similiar to that of :mod:`threading`. For example:: +Its API is similar to that of :mod:`threading`. For example:: from multiprocessing import Process From python-checkins at python.org Sat Jul 12 22:57:22 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 12 Jul 2008 22:57:22 +0200 (CEST) Subject: [Python-checkins] r64898 - in tracker/instances/security: config.ini.template detectors/autoassign.py detectors/changes_xml_writer.py detectors/cia.py detectors/spambayes.py schema.py Message-ID: <20080712205722.362661E4007@bag.python.org> Author: martin.v.loewis Date: Sat Jul 12 22:57:21 2008 New Revision: 64898 Log: Disable anonymous access; remove unused detectors. Removed: tracker/instances/security/detectors/autoassign.py tracker/instances/security/detectors/changes_xml_writer.py tracker/instances/security/detectors/cia.py tracker/instances/security/detectors/spambayes.py Modified: tracker/instances/security/config.ini.template tracker/instances/security/schema.py Modified: tracker/instances/security/config.ini.template ============================================================================== --- tracker/instances/security/config.ini.template (original) +++ tracker/instances/security/config.ini.template Sat Jul 12 22:57:21 2008 @@ -105,7 +105,7 @@ # A descriptive name for your roundup instance. # Default: Roundup issue tracker -name = Tracker +name = Security Tracker # The web address that the tracker is viewable at. # This will be included in information sent to users of the tracker. @@ -115,7 +115,7 @@ # Default: NO DEFAULT #web = NO DEFAULT #web = http://psf.upfronthosting.co.za/roundup/tracker/ -web = http://localhost:9999/python-dev/ +web = http://localhost:9999/security/ # Email address that mail to roundup should go to. # Default: issue_tracker Deleted: tracker/instances/security/detectors/autoassign.py ============================================================================== --- tracker/instances/security/detectors/autoassign.py Sat Jul 12 22:57:21 2008 +++ (empty file) @@ -1,28 +0,0 @@ -# Auditor to automatically assign issues to a user when -# the component field gets set - -def autoassign(db, cl, nodeid, newvalues): - try: - components = newvalues['components'] - except KeyError: - # Without components, nothing needs to be auto-assigned - return - if newvalues.has_key('assignee'): - # If there is an explicit assignee in the new values - # (even if it is None, in the case unassignment): - # do nothing - return - # If the issue is already assigned, do nothing - if nodeid and db.issue.get(nodeid, 'assignee'): - return - for component in components: - user = db.component.get(component, 'assign_to') - if user: - # If there would be multiple auto-assigned users - # arbitrarily pick the first one we find - newvalues['assignee'] = user - return - -def init(db): - db.issue.audit('create', autoassign) - db.issue.audit('set', autoassign) Deleted: tracker/instances/security/detectors/changes_xml_writer.py ============================================================================== --- tracker/instances/security/detectors/changes_xml_writer.py Sat Jul 12 22:57:21 2008 +++ (empty file) @@ -1,194 +0,0 @@ -# -# changes.xml writer detector. -# -# Copyright (c) 2007 Michal Kwiatkowski -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# * Neither the name of the author nor the names of his contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -"""changes.xml writer detector -- save each database change to an XML file. - -Root element is called `changes` and it has at most `ChangesXml.max_items` -children, each called a `change`. Each `change` has the following attributes: - -:date: date in RFC2822 format when the change was made -:id: unique identifier of this change (note: not an integer) -:type: type of this change (see below) - -A structure of a `change` depends on its `type`. Currently implemented -change types and their formats are listed below. - -* type = `file-added` - - Describes a new file attached to an existing issue. Child elements: - - :file-id: unique integer identifier of the file - :file-name: name of the uploaded file - :file-type: MIME type of the file content - :file-url: permanent URL of the file - :issue-id: unique integer identifier of an issue this file is attached to -""" - -import os -import urllib -from xml.dom import minidom -from xml.parsers.expat import ExpatError -from time import gmtime, strftime - -# Relative to tracker home directory. -FILENAME = os.path.join('%(TEMPLATES)s', 'recent-changes.xml') - - -def tracker_url(db): - return str(db.config.options[('tracker', 'web')]) - -def changes_xml_path(db): - return os.path.join(db.config.HOME, FILENAME % db.config.options) - -def rfc2822_date(): - return strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()) - -class File(object): - def __init__(self, db, id, issue_id): - self.db = db - self.id = id - self.issue_id = issue_id - - self.name = db.file.get(id, 'name') - self.type = db.file.get(id, 'type') - # Based on roundup.cgi.templating._HTMLItem.download_url(). - self.download_url = tracker_url(self.db) +\ - urllib.quote('%s%s/%s' % ('file', self.id, self.name)) - -class ChangesXml(object): - # Maximum number of changes stored in a file. - max_items = 20 - - def __init__(self, filename): - self.filename = filename - self._read_document() - self.modified = False - - def save(self): - if not self.modified: - return - - self._trim_to_max_items() - - fd = open(self.filename, 'w') - self.document.writexml(fd, encoding="UTF-8") - fd.close() - - def add_file(self, file): - change = self._change("file%s-added-to-issue%s" % (file.id, file.issue_id), - "file-added") - - change.appendChild(self._element_with_text("file-id", file.id)) - change.appendChild(self._element_with_text("file-name", file.name)) - change.appendChild(self._element_with_text("file-type", file.type)) - change.appendChild(self._element_with_text("file-url", file.download_url)) - change.appendChild(self._element_with_text("issue-id", file.issue_id)) - - self.root.appendChild(change) - self.modified = True - - def add_files(self, files): - for file in files: - self.add_file(file) - - def _change(self, id, type): - """Return new 'change' element of a given type. - - """ - change = self.document.createElement("change") - change.setAttribute("id", id) - change.setAttribute("type", type) - change.setAttribute("date", rfc2822_date()) - return change - - def _element_with_text(self, name, value): - """Return new element with given name and text node as a value. - value - """ - element = self.document.createElement(name) - text = self.document.createTextNode(str(value)) - element.appendChild(text) - return element - - def _trim_to_max_items(self): - """Remove changes exceeding self.max_items. - """ - # Assumes that changes are stored sequentially from oldest to newest. - # Will do for now. - for change in self.root.getElementsByTagName("change")[0:-self.max_items]: - self.root.removeChild(change) - - def _read_document(self): - try: - self.document = minidom.parse(self.filename) - self.root = self.document.firstChild - except IOError, e: - # File not found, create a new one then. - if e.errno != 2: - raise - self._create_new_document() - except ExpatError: - # File has been damaged, forget about it and create a new one. - self._create_new_document() - - def _create_new_document(self): - self.document = minidom.Document() - self.root = self.document.createElement("changes") - self.document.appendChild(self.root) - -def get_new_files_ids(issue_now, issue_then): - """Return ids of files added between `now` and `then`. - """ - files_now = set(issue_now['files']) - if issue_then: - files_then = set(issue_then['files']) - else: - files_then = set() - return map(int, files_now - files_then) - -def file_added_to_issue(db, cl, issue_id, olddata): - try: - changes = ChangesXml(changes_xml_path(db)) - issue = db.issue.getnode(issue_id) - new_files = [ File(db, id, issue_id) for id in get_new_files_ids(issue, olddata) ] - - changes.add_files(new_files) - changes.save() - except: - # We can't mess up with a database commit. - pass - - -def init(db): - db.issue.react('create', file_added_to_issue) - db.issue.react('set', file_added_to_issue) Deleted: tracker/instances/security/detectors/cia.py ============================================================================== --- tracker/instances/security/detectors/cia.py Sat Jul 12 22:57:21 2008 +++ (empty file) @@ -1,86 +0,0 @@ -# Reactor for sending changes to CIA.vc -import xmlrpclib -import cgi - -server = "http://CIA.vc" - -parameters = { - 'name':'Roundup Reactor for CIA', - 'revision': "$Revision$"[11:-2], - 'project': 'Python', - 'branch': 'roundup', - 'urlprefix': 'http://bugs.python.org/issue', -} - -max_content = 150 - -TEMPLATE = """ - - - Roundup Reactor for CIA - %(revision)s - - - %(project)s - #%(nodeid)s - %(branch)s - - - - %(author)s - %(file)s - %(log)s - %(urlprefix)s%(nodeid)s - - - -""" - - -def sendcia(db, cl, nodeid, oldvalues): - messages = set(cl.get(nodeid, 'messages')) - if oldvalues: - messages -= set(oldvalues.get('messages',())) - if not messages: - return - messages = list(messages) - - if oldvalues: - oldstatus = oldvalues['status'] - else: - oldstatus = None - newstatus = db.issue.get(nodeid, 'status') - if oldstatus != newstatus: - if oldvalues: - status = db.status.get(newstatus, 'name') - else: - status = 'new' - log = '[' + status + '] ' - else: - log = '' - for msg in messages: - log += db.msg.get(msg, 'content') - if len(log) > max_content: - log = log[:max_content-4] + ' ...' - log = log.replace('\n', ' ') - - params = parameters.copy() - params['file'] = cgi.escape(db.issue.get(nodeid, 'title')) - params['nodeid'] = nodeid - params['author'] = db.user.get(db.getuid(), 'username') - params['log'] = cgi.escape(log) - - payload = TEMPLATE % params - - try: - rpc = xmlrpclib.ServerProxy(server) - rpc.hub.deliver(payload) - except: - # Ignore any errors in sending the CIA; - # if the server is down, that's just bad luck - # XXX might want to do some logging here - pass - -def init(db): - db.issue.react('create', sendcia) - db.issue.react('set', sendcia) Deleted: tracker/instances/security/detectors/spambayes.py ============================================================================== --- tracker/instances/security/detectors/spambayes.py Sat Jul 12 22:57:21 2008 +++ (empty file) @@ -1 +0,0 @@ -link ../../spambayes_integration/detectors/spambayes.py \ No newline at end of file Modified: tracker/instances/security/schema.py ============================================================================== --- tracker/instances/security/schema.py (original) +++ tracker/instances/security/schema.py Sat Jul 12 22:57:21 2008 @@ -155,7 +155,7 @@ 'version', 'priority', 'status', 'resolution', 'issue', 'keyword'): db.security.addPermissionToRole('User', 'View', cl) - db.security.addPermissionToRole('Anonymous', 'View', cl) + #db.security.addPermissionToRole('Anonymous', 'View', cl) class may_view_spam: def __init__(self, klassname): @@ -188,7 +188,7 @@ 'description', )) - db.security.addPermissionToRole('Anonymous', p) + #db.security.addPermissionToRole('Anonymous', p) db.security.addPermissionToRole('User', p) db.security.addPermissionToRole('User', 'Create', cl) @@ -204,7 +204,7 @@ properties=('content', 'summary'), check=may_view_spam(cl)) - db.security.addPermissionToRole('Anonymous', spamcheck) + #db.security.addPermissionToRole('Anonymous', spamcheck) def may_edit_file(db, userid, itemid): return userid == db.file.get(itemid, "creator") @@ -327,15 +327,15 @@ # Assign the appropriate permissions to the anonymous user's Anonymous # Role. Choices here are: # - Allow anonymous users to register -db.security.addPermissionToRole('Anonymous', 'Create', 'user') +#db.security.addPermissionToRole('Anonymous', 'Create', 'user') # Allow anonymous users access to view issues (and the related, linked # information). # Note permissions settings for file and msg above (due to spambayes # integration). -for cl in 'issue', 'severity', 'status', 'resolution': - db.security.addPermissionToRole('Anonymous', 'View', cl) +#for cl in 'issue', 'severity', 'status', 'resolution': +# db.security.addPermissionToRole('Anonymous', 'View', cl) # [OPTIONAL] # Allow anonymous users access to create or edit "issue" items (and the From buildbot at python.org Sat Jul 12 23:34:16 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 12 Jul 2008 21:34:16 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20080712213428.3EF2E1E4007@bag.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/751 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jul 13 00:06:54 2008 From: python-checkins at python.org (alexandre.vassalotti) Date: Sun, 13 Jul 2008 00:06:54 +0200 (CEST) Subject: [Python-checkins] r64900 - python/trunk/Doc/library/thread.rst Message-ID: <20080712220654.117191E4015@bag.python.org> Author: alexandre.vassalotti Date: Sun Jul 13 00:06:53 2008 New Revision: 64900 Log: Fixed typo. Modified: python/trunk/Doc/library/thread.rst Modified: python/trunk/Doc/library/thread.rst ============================================================================== --- python/trunk/Doc/library/thread.rst (original) +++ python/trunk/Doc/library/thread.rst Sun Jul 13 00:06:53 2008 @@ -7,7 +7,7 @@ .. note:: The :mod:`thread` module has been renamed to :mod:`_thread` in Python 3.0. The :term:`2to3` tool will automatically adapt imports when converting your - sources to 3.0; however, you should consider using the high-lever + sources to 3.0; however, you should consider using the high-level :mod:`threading` module instead. From buildbot at python.org Sun Jul 13 00:43:41 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 12 Jul 2008 22:43:41 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080712224342.13BD81E4007@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/434 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jul 13 01:41:19 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 13 Jul 2008 01:41:19 +0200 (CEST) Subject: [Python-checkins] r64901 - in python/trunk: Lib/robotparser.py Misc/ACKS Message-ID: <20080712234119.70CEA1E4002@bag.python.org> Author: benjamin.peterson Date: Sun Jul 13 01:41:19 2008 New Revision: 64901 Log: #1778443 robotparser fixes from Aristotelis Mikropoulos Modified: python/trunk/Lib/robotparser.py python/trunk/Misc/ACKS Modified: python/trunk/Lib/robotparser.py ============================================================================== --- python/trunk/Lib/robotparser.py (original) +++ python/trunk/Lib/robotparser.py Sun Jul 13 01:41:19 2008 @@ -55,11 +55,8 @@ """Reads the robots.txt URL and feeds it to the parser.""" opener = URLopener() f = opener.open(self.url) - lines = [] - line = f.readline() - while line: - lines.append(line.strip()) - line = f.readline() + lines = [line.strip() for line in f] + f.close() self.errcode = opener.errcode if self.errcode in (401, 403): self.disallow_all = True @@ -84,7 +81,7 @@ entry = Entry() for line in lines: - linenumber = linenumber + 1 + linenumber += 1 if not line: if state == 1: entry = Entry() Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Sun Jul 13 01:41:19 2008 @@ -460,6 +460,7 @@ Mike Meyer Steven Miale Trent Mick +Aristotelis Mikropoulos Damien Miller Chad Miller Jay T. Miller From python-checkins at python.org Sun Jul 13 02:23:34 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 13 Jul 2008 02:23:34 +0200 (CEST) Subject: [Python-checkins] r64902 - in sandbox/trunk/ttk-gsoc: Doc/library/ttk.rst src/2.x/ttk.py src/3.x/ttk.py Message-ID: <20080713002334.EB3BE1E4002@bag.python.org> Author: guilherme.polo Date: Sun Jul 13 02:23:26 2008 New Revision: 64902 Log: Changed Treeview's get_children method, if nothing is passed to it, it returns all root children; Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst ============================================================================== --- sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst (original) +++ sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst Sun Jul 13 02:23:26 2008 @@ -846,10 +846,12 @@ scrolled offscreen), returns an empty string. - .. method:: get_children(item) + .. method:: get_children([item]) Returns the list of children belonging to *item*. + If *item* is not specified, returns all root children. + .. method:: set_children(item, newchildren) Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Sun Jul 13 02:23:26 2008 @@ -1134,9 +1134,11 @@ return self.tk.call(self._w, "bbox", item, column) - def get_children(self, item): - """Returns a tuple of children belonging to item.""" - return self.tk.call(self._w, "children", item) + def get_children(self, item=None): + """Returns a tuple of children belonging to item. + + If item is not specified, returns all root children.""" + return self.tk.call(self._w, "children", item or '') def set_children(self, item, newchildren): Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Sun Jul 13 02:23:26 2008 @@ -1134,9 +1134,11 @@ return self.tk.call(self._w, "bbox", item, column) - def get_children(self, item): - """Returns a tuple of children belonging to item.""" - return self.tk.call(self._w, "children", item) + def get_children(self, item=None): + """Returns a tuple of children belonging to item. + + If item is not specified, returns all root children.""" + return self.tk.call(self._w, "children", item or '') def set_children(self, item, newchildren): From buildbot at python.org Sun Jul 13 03:11:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 13 Jul 2008 01:11:24 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20080713011124.EF0C01E4009@bag.python.org> The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/1311 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: alexandre.vassalotti,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sun Jul 13 03:15:08 2008 From: python-checkins at python.org (brett.cannon) Date: Sun, 13 Jul 2008 03:15:08 +0200 (CEST) Subject: [Python-checkins] r64903 - in python/trunk: Lib/dummy_thread.py Lib/test/test_dummy_thread.py Misc/NEWS Message-ID: <20080713011508.628FE1E4012@bag.python.org> Author: brett.cannon Date: Sun Jul 13 03:15:07 2008 New Revision: 64903 Log: dummy_thread.acquire() would return None if no waitflag argument was given. It should have returned True. Fixes issue #3339. Thanks, Henk Punt for the report and Andrii v. Mishkovskiyi for attempting a patch. Modified: python/trunk/Lib/dummy_thread.py python/trunk/Lib/test/test_dummy_thread.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/dummy_thread.py ============================================================================== --- python/trunk/Lib/dummy_thread.py (original) +++ python/trunk/Lib/dummy_thread.py Sun Jul 13 03:15:07 2008 @@ -104,18 +104,15 @@ aren't triggered and throw a little fit. """ - if waitflag is None: + if waitflag is None or waitflag: self.locked_status = True - return None - elif not waitflag: + return True + else: if not self.locked_status: self.locked_status = True return True else: return False - else: - self.locked_status = True - return True __enter__ = acquire Modified: python/trunk/Lib/test/test_dummy_thread.py ============================================================================== --- python/trunk/Lib/test/test_dummy_thread.py (original) +++ python/trunk/Lib/test/test_dummy_thread.py Sun Jul 13 03:15:07 2008 @@ -60,6 +60,7 @@ #Make sure that an unconditional locking returns True. self.failUnless(self.lock.acquire(1) is True, "Unconditional locking did not return True.") + self.failUnless(self.lock.acquire() is True) def test_uncond_acquire_blocking(self): #Make sure that unconditional acquiring of a locked lock blocks. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jul 13 03:15:07 2008 @@ -10,7 +10,6 @@ Core and Builtins ----------------- - - Issue #2517: Allow unicode messages in Exceptions again by correctly bypassing the instance dictionary when looking up __unicode__ on new-style classes. @@ -41,6 +40,8 @@ Library ------- +- Issue #3339: dummy_thread.acquire() should not return None. + - Issue #3285: Fractions from_float() and from_decimal() accept Integral arguments. - Issue #3301: Bisect module behaved badly when lo was negative. From python-checkins at python.org Sun Jul 13 03:20:20 2008 From: python-checkins at python.org (brett.cannon) Date: Sun, 13 Jul 2008 03:20:20 +0200 (CEST) Subject: [Python-checkins] r64905 - in python/branches/release25-maint: Lib/dummy_thread.py Lib/test/test_dummy_thread.py Misc/NEWS Message-ID: <20080713012020.287D01E4002@bag.python.org> Author: brett.cannon Date: Sun Jul 13 03:20:19 2008 New Revision: 64905 Log: Backport of 64903. Modified: python/branches/release25-maint/Lib/dummy_thread.py python/branches/release25-maint/Lib/test/test_dummy_thread.py python/branches/release25-maint/Misc/NEWS Modified: python/branches/release25-maint/Lib/dummy_thread.py ============================================================================== --- python/branches/release25-maint/Lib/dummy_thread.py (original) +++ python/branches/release25-maint/Lib/dummy_thread.py Sun Jul 13 03:20:19 2008 @@ -107,18 +107,15 @@ aren't triggered and throw a little fit. """ - if waitflag is None: + if waitflag is None or waitflag: self.locked_status = True - return None - elif not waitflag: + return True + else: if not self.locked_status: self.locked_status = True return True else: return False - else: - self.locked_status = True - return True __enter__ = acquire Modified: python/branches/release25-maint/Lib/test/test_dummy_thread.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_dummy_thread.py (original) +++ python/branches/release25-maint/Lib/test/test_dummy_thread.py Sun Jul 13 03:20:19 2008 @@ -60,6 +60,7 @@ #Make sure that an unconditional locking returns True. self.failUnless(self.lock.acquire(1) is True, "Unconditional locking did not return True.") + self.failUnless(self.lock.acquire() is True) def test_uncond_acquire_blocking(self): #Make sure that unconditional acquiring of a locked lock blocks. Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Sun Jul 13 03:20:19 2008 @@ -59,6 +59,9 @@ Library ------- +- Issue #3339: dummy_thread.acquire() could return None which is not a valid + return value. + - Issue #3116 and #1792: Fix quadratic behavior in marshal.dumps(). - Issue #2682: ctypes callback functions no longer contain a cyclic From buildbot at python.org Sun Jul 13 04:53:39 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 13 Jul 2008 02:53:39 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080713025340.1FF4C1E4002@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/358 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jul 13 05:16:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 13 Jul 2008 03:16:40 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080713031642.2D6B51E4002@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/257 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jul 13 10:42:57 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 13 Jul 2008 10:42:57 +0200 (CEST) Subject: [Python-checkins] r64907 - in python/branches/tlee-ast-optimize: Lib/test/test_optimizer.py Python/optimize.c Message-ID: <20080713084257.973FC1E4002@bag.python.org> Author: thomas.lee Date: Sun Jul 13 10:42:57 2008 New Revision: 64907 Log: Fix test_syntax by tracking namespaces in the optimizer code. Breaking string._TemplateMetaclass with the return injection, not sure how or why. Modified: python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py python/branches/tlee-ast-optimize/Python/optimize.c Modified: python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_optimizer.py Sun Jul 13 10:42:57 2008 @@ -25,39 +25,39 @@ self.assertEqual(2, ast.body[1].body[0].value.n) self.assertEqual(1, ast.body[1].orelse[0].value.n) -# def test_fold_if_stmt_with_constants(self): -# # ensure we can optimize conditionals using simple constants -# code = """ -#if 1: -# 'true' -#else: -# 'false' -# -#if 0: -# 'true' -#else: -# 'false' -# -#""" -# ast = self.compileast(code) -# self.assertEqual(2, len(ast.body)) -# self.assertEqual(_ast.Str, ast.body[0].value.__class__) -# self.assertEqual('true', ast.body[0].value.s) -# self.assertEqual(_ast.Str, ast.body[1].value.__class__) -# self.assertEqual('false', ast.body[1].value.s) + def test_fold_if_stmt_with_constants(self): + # ensure we can optimize conditionals using simple constants + code = """ +if 1: + 'true' +else: + 'false' + +if 0: + 'true' +else: + 'false' -# def test_fold_unary_op_before_collapse_branch(self): -# # ensure unary op folding is applied before collapsing a branch -# code = """ -#if not 1: -# 'true' -#else: -# 'false' -#""" -# ast = self.compileast(code) -# self.assertEqual(1, len(ast.body)) -# self.assertEqual(_ast.Str, ast.body[0].value.__class__) -# self.assertEqual('false', ast.body[0].value.s) +""" + ast = self.compileast(code) + self.assertEqual(2, len(ast.body)) + self.assertEqual(_ast.Str, ast.body[0].value.__class__) + self.assertEqual('true', ast.body[0].value.s) + self.assertEqual(_ast.Str, ast.body[1].value.__class__) + self.assertEqual('false', ast.body[1].value.s) + + def test_fold_unary_op_before_collapse_branch(self): + # ensure unary op folding is applied before collapsing a branch + code = """ +if not 1: + 'true' +else: + 'false' +""" + ast = self.compileast(code) + self.assertEqual(1, len(ast.body)) + self.assertEqual(_ast.Str, ast.body[0].value.__class__) + self.assertEqual('false', ast.body[0].value.s) def assertAstNode(self, expected_type, attr, expected_value, code): ast = self.compileast(code) @@ -156,19 +156,19 @@ except TypeError: pass -# def test_eliminate_code_after_return(self): -# # ensure code following a "return" is erased from the AST -# code = """ -#def say_hello(): -# print "Hello there" -# return True -# print "A secret message!" -#""" -# ast = self.compileast(code) -# self.assertEqual(1, len(ast.body)) -# self.assertEqual(_ast.FunctionDef, ast.body[0].__class__) -# self.assertEqual(3, len(ast.body[0].body)) -# self.assertEqual(_ast.Pass, ast.body[0].body[2].__class__) + def test_eliminate_code_after_return(self): + # ensure code following a "return" is erased from the AST + code = """ +def say_hello(): + print "Hello there" + return True + print "A secret message!" +""" + ast = self.compileast(code) + self.assertEqual(1, len(ast.body)) + self.assertEqual(_ast.FunctionDef, ast.body[0].__class__) + self.assertEqual(3, len(ast.body[0].body)) + self.assertEqual(_ast.Pass, ast.body[0].body[2].__class__) def test_yield_none_becomes_yield(self): code = """ @@ -195,16 +195,16 @@ self.assertEqual(_ast.Return, ast.body[0].body[0].__class__) self.assertEqual(None, ast.body[0].body[0].value) -# def test_generators_work_even_if_yields_are_optimized_away(self): -# code = """ -#def mygen(): -# return -# yield 5 -#""" -# -# ast = self.compileast(code) -# self.assertEqual(_ast.Return, ast.body[0].body[0].__class__) -# self.assertEqual(_ast.Pass, ast.body[0].body[1].__class__) + def test_generators_work_even_if_yields_are_optimized_away(self): + code = """ +def mygen(): + return + yield 5 +""" + + ast = self.compileast(code) + self.assertEqual(_ast.Return, ast.body[0].body[0].__class__) + self.assertEqual(_ast.Pass, ast.body[0].body[1].__class__) def test_tuple_of_constants(self): tests = [ @@ -230,15 +230,19 @@ #""" # ast = self.compileast(code) # self.assertEqual(_ast.Pass, ast.body[0].__class__) + + def test_skip_unreachable_while_loop(self): + code = """ +while 0: + print 'foo' +""" + + ast = self.compileast(code) + self.assertEqual(_ast.Pass, ast.body[0].__class__) + # -# def test_skip_unreachable_while_loop(self): -# code = """ -#while 0: -# print 'foo' -#""" +# XXX: constant list folding is currently disabled # -# ast = self.compileast(code) -# self.assertEqual(_ast.Pass, ast.body[0].__class__) # def test_fold_constant_list_in_for_loop(self): # code = """ @@ -287,18 +291,30 @@ self.assertEqual(_ast.Return, ast.body[0].body[0].body[1].__class__) self.assertEqual(1, ast.body[0].body[0].body[1].value.n) -# def test_jump_to_implicit_returns_are_simplified(self): -# code = """ -#def foo(x): -# if x: -# print x -# else: -# print "n/a" -#""" -# -# ast = self.compileast(code) -# self.assertEqual(_ast.Return, ast.body[0].body[0].body[1].__class__) -# self.assertEqual(None, ast.body[0].body[0].body[1].value) + def test_jump_to_implicit_returns_are_simplified(self): + code = """ +def foo(x): + if x: + print x + else: + print "n/a" +""" + + ast = self.compileast(code) + self.assertEqual(_ast.Return, ast.body[0].body[0].body[1].__class__) + self.assertEqual(None, ast.body[0].body[0].body[1].value) + + code = """ +def bar(x): + if x: + print x + else: + print "n/a" + return 1 +""" + ast = self.compileast(code) + self.assertEqual(_ast.Return, ast.body[0].body[0].body[1].__class__) + self.assertEqual(1, ast.body[0].body[0].body[1].value.n) def test_assignment_to_true_works(self): # --------------------------------------------------------------------- Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jul 13 10:42:57 2008 @@ -6,20 +6,69 @@ #include "node.h" #include "ast.h" -static int optimize_expr(expr_ty* expr_ptr, PySTEntryObject* ste, - PyArena* arena); -static int optimize_stmt(stmt_ty* stmt_ptr, PySTEntryObject* ste, - PyArena* arena); -static int optimize_comprehension(comprehension_ty* comp_ptr, - PySTEntryObject* ste, PyArena* arena); -static int optimize_excepthandler(excepthandler_ty* exc_ptr, - PySTEntryObject* ste, PyArena* arena); -static int optimize_keyword(keyword_ty* kwd_ptr, PySTEntryObject* ste, - PyArena* arena); -static int optimize_arguments(arguments_ty* args_ptr, PySTEntryObject* ste, - PyArena* arena); -static int optimize_slice(slice_ty* slice_ptr, PySTEntryObject* ste, - PyArena* arena); +typedef struct _optimizer_block { + struct _optimizer_block* b_next; /* next block on the stack */ + PySTEntryObject* b_ste; /* symtable entry */ + + /* we don't want to optimize away "try" blocks containing a + * "continue" statement in its finally clause. This is illegal syntax, + * and we need to make sure it falls through to the compiler where it + * will be detected. The following fields are used to that end. + */ + unsigned int b_finally; /* non-zero if we're in a "finally" */ + unsigned int b_eliminate; /* non-zero if elimination is OK */ +} optimizer_block; + +typedef struct _optimizer { + struct symtable* opt_symtable; + PyArena* opt_arena; + optimizer_block* opt_current; /* the current block */ +} optimizer; + +static int optimize_expr(optimizer* opt, expr_ty* expr_ptr); +static int optimize_stmt(optimizer* opt, stmt_ty* stmt_ptr); +static int optimize_comprehension(optimizer* opt, comprehension_ty* comp_ptr); +static int optimize_excepthandler(optimizer* opt, excepthandler_ty* exc_ptr); +static int optimize_keyword(optimizer* opt, keyword_ty* kwd_ptr); +static int optimize_arguments(optimizer* opt, arguments_ty* args_ptr); +static int optimize_slice(optimizer* opt, slice_ty* slice_ptr); + +/** + * Enter a block/namespace. + */ +static int +_enter_block(optimizer* opt, PySTEntryObject* ste) +{ + optimizer_block* block = malloc(sizeof *block); + if (block == NULL) + return 0; + block->b_next = opt->opt_current; + block->b_finally = 0; + block->b_eliminate = 1; + block->b_ste = ste; + + Py_INCREF(ste); + + opt->opt_current = block; + + return 1; +} + +/** + * Leave a block/namespace. + */ +static void +_leave_block(optimizer* opt) +{ + optimizer_block* next; + assert(opt->opt_current != NULL); + next = opt->opt_current->b_next; + + Py_DECREF(opt->opt_current->b_ste); + free(opt->opt_current); + + opt->opt_current = next; +} /** * Determine the constant value of a given expression. It's assumed that @@ -136,12 +185,12 @@ * Optimize a sequence of expressions. */ static int -optimize_expr_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_expr_seq(optimizer* opt, asdl_seq** seq_ptr) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_expr((expr_ty*)&asdl_seq_GET(seq, n), ste, arena)) + if (!optimize_expr(opt, (expr_ty*)&asdl_seq_GET(seq, n))) return 0; return 1; } @@ -200,18 +249,11 @@ #define LAST_IN_SEQ(seq) (asdl_seq_LEN((seq)) - 1) -/* XXX: code elimination must be disabled until we work out what to do with - * "continue" statements in a "finally" clause. If we eliminate a - * branch containing a "try..finally" with a finally clause containing - * a "continue" statement, we start breaking tests. - */ -#if 0 /** * Eliminate code that we can determine will never be executed. */ static int -_eliminate_unreachable_code(asdl_seq** seq_ptr, int n, PySTEntryObject* ste, - PyArena* arena) +_eliminate_unreachable_code(optimizer* opt, asdl_seq** seq_ptr, int n) { asdl_seq* seq = *seq_ptr; stmt_ty stmt = asdl_seq_GET(seq, n); @@ -220,16 +262,19 @@ if (stmt->kind == If_kind) { PyObject* test = _expr_constant_value(stmt->v.If.test); if (test != NULL) { - if (PyObject_IsTrue(test)) - seq = _asdl_seq_replace(seq, n, stmt->v.If.body, arena); + if (PyObject_IsTrue(test)) { + seq = _asdl_seq_replace(seq, n, stmt->v.If.body, + opt->opt_arena); + } else { if (stmt->v.If.orelse == NULL) { /* no "else:" body: use a Pass() */ seq = _asdl_seq_replace_with_pass(seq, n, stmt->lineno, - stmt->col_offset, arena); + stmt->col_offset, opt->opt_arena); } else { - seq = _asdl_seq_replace(seq, n, stmt->v.If.orelse, arena); + seq = _asdl_seq_replace(seq, n, stmt->v.If.orelse, + opt->opt_arena); } } if (seq == NULL) @@ -244,11 +289,11 @@ if (!PyObject_IsTrue(test)) { if (stmt->v.While.orelse != NULL) { seq = _asdl_seq_replace(seq, n, stmt->v.While.orelse, - arena); + opt->opt_arena); } else { seq = _asdl_seq_replace_with_pass(seq, n, stmt->lineno, - stmt->col_offset, arena); + stmt->col_offset, opt->opt_arena); } if (seq == NULL) return 0; @@ -261,11 +306,12 @@ if (iter != NULL) { if (PyObject_Size(iter) == 0) { if (stmt->v.For.orelse != NULL) { - seq = _asdl_seq_replace(seq, n, stmt->v.For.orelse, arena); + seq = _asdl_seq_replace(seq, n, stmt->v.For.orelse, + opt->opt_arena); } else { seq = _asdl_seq_replace_with_pass(seq, n, stmt->lineno, - stmt->col_offset, arena); + stmt->col_offset, opt->opt_arena); } if (seq == NULL) return 0; @@ -276,7 +322,7 @@ else if (stmt->kind == Return_kind && n < LAST_IN_SEQ(seq)) { /* eliminate all nodes after a return */ seq = _asdl_seq_replace_with_pass(seq, n + 1, - stmt->lineno, stmt->col_offset, arena); + stmt->lineno, stmt->col_offset, opt->opt_arena); if (seq == NULL) return 0; } @@ -285,7 +331,6 @@ return 1; } -#endif /** * Adds all ASDL nodes from seq1 with offset n1 to a new list, then @@ -335,46 +380,65 @@ return _asdl_seq_append(seq, 0, retseq, 0, arena); } +static void +_expr_incref(expr_ty expr) +{ + if (expr != NULL) { + if (expr->kind == Num_kind) + Py_INCREF(expr->v.Num.n); + else if (expr->kind == Str_kind) + Py_INCREF(expr->v.Str.s); + else if (expr->kind == Const_kind) + Py_INCREF(expr->v.Const.value); + } +} + static int _inject_compound_stmt_return(stmt_ty stmt, stmt_ty next, PyArena* arena) { /* if the else body is not present, there will be no jump anyway */ + /* XXX: this is breaking string._TemplateMetaclass for some reason */ +#if 0 if (stmt->kind == If_kind && stmt->v.If.orelse != NULL) { stmt_ty inner = asdl_seq_GET(stmt->v.If.body, LAST_IN_SEQ(stmt->v.If.body)); if (inner->kind != Return_kind) { + expr_ty value = next->v.Return.value; + _expr_incref(value); stmt->v.If.body = - _asdl_seq_append_return(stmt->v.If.body, - next->v.Return.value, arena); + _asdl_seq_append_return(stmt->v.If.body, value, arena); if (stmt->v.If.body == NULL) return 0; } } +#endif /* TODO: we probably want to append a return to all but * the last handler too */ - else if (stmt->kind == TryExcept_kind) { + if (stmt->kind == TryExcept_kind) { stmt_ty inner = asdl_seq_GET(stmt->v.TryExcept.body, LAST_IN_SEQ(stmt->v.TryExcept.body)); if (inner->kind != Return_kind && inner->kind != Raise_kind) { - /* XXX: if we inject a return into the "try" body of a - * "try..except..else", we will miss the "else"! - * We need to take a different path if the "else" is - * present. + expr_ty value = next->v.Return.value; + _expr_incref(value); + /* if we inject a return into the "try" body of a + * "try..except..else", we will miss the "else"! + * We need to take a different path if the "else" is + * present. */ if (stmt->v.TryExcept.orelse == NULL) { stmt->v.TryExcept.body = _asdl_seq_append_return(stmt->v.TryExcept.body, - next->v.Return.value, arena); + value, arena); if (stmt->v.TryExcept.body == NULL) return 0; } else { stmt->v.TryExcept.orelse = _asdl_seq_append_return(stmt->v.TryExcept.orelse, - next->v.Return.value, arena); + value, arena); if (stmt->v.TryExcept.orelse == NULL) return 0; } @@ -384,9 +448,10 @@ stmt_ty inner = asdl_seq_GET(stmt->v.TryFinally.body, LAST_IN_SEQ(stmt->v.TryFinally.body)); if (inner->kind != Return_kind && inner->kind != Raise_kind) { + expr_ty value = next->v.Return.value; + _expr_incref(value); stmt->v.TryFinally.body = - _asdl_seq_append_return(stmt->v.TryFinally.body, - next->v.Return.value, arena); + _asdl_seq_append_return(stmt->v.TryFinally.body, value, arena); if (stmt->v.TryFinally.body == NULL) return 0; } @@ -400,38 +465,34 @@ * they immediately return rather than jump. */ static int -_simplify_jumps(asdl_seq* seq, PySTEntryObject* ste, PyArena* arena) +_simplify_jumps(optimizer* opt, asdl_seq* seq) { int n, len; len = asdl_seq_LEN(seq); - for (n = 0; n < len - 1; n++) { + for (n = 0; n < len; n++) { stmt_ty stmt; stmt_ty next; stmt = asdl_seq_GET(seq, n); -/* XXX: this will only work at the top level of a function ... let's find - * somewhere else for this optimization to live! */ -#if 0 /* on the last iteration, the target is an implicit `return None' */ if (n == len-1) { + /* if a "return" is already present, we have nothing left to do */ if (stmt->kind == Return_kind) - continue; + break; - next = Return(NULL, stmt->lineno, stmt->col_offset, arena); + next = Return(NULL, stmt->lineno, stmt->col_offset, opt->opt_arena); if (next == NULL) return 0; } else -#endif - next = asdl_seq_GET(seq, n+1); + next = asdl_seq_GET(seq, n+1); - if (next->kind == Return_kind) { - if (!_inject_compound_stmt_return(stmt, next, arena)) + if (next->kind == Return_kind) + if (!_inject_compound_stmt_return(stmt, next, opt->opt_arena)) return 0; - } } return 1; @@ -441,78 +502,75 @@ * Optimize a sequence of statements. */ static int -optimize_stmt_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_stmt_seq(optimizer* opt, asdl_seq** seq_ptr) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { - if (!optimize_stmt((stmt_ty*)&asdl_seq_GET(seq, n), ste, arena)) + if (!optimize_stmt(opt, (stmt_ty*)&asdl_seq_GET(seq, n))) return 0; -#if 0 - if (!_eliminate_unreachable_code(seq_ptr, n, ste, arena)) - return 0; -#endif - if (ste->ste_type == FunctionBlock) - if (!_simplify_jumps(*seq_ptr, ste, arena)) + if (opt->opt_current->b_eliminate) + if (!_eliminate_unreachable_code(opt, seq_ptr, n)) + return 0; + if (opt->opt_current->b_ste->ste_type == FunctionBlock) + if (!_simplify_jumps(opt, *seq_ptr)) return 0; } return 1; } static int -optimize_comprehension_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, - PyArena* arena) +optimize_comprehension_seq(optimizer* opt, asdl_seq** seq_ptr) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { comprehension_ty* comp; comp = (comprehension_ty*)&asdl_seq_GET(seq, n); - if (!optimize_comprehension(comp, ste, arena)) + if (!optimize_comprehension(opt, comp)) return 0; } return 1; } static int -optimize_excepthandler_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, - PyArena* arena) +optimize_excepthandler_seq(optimizer* opt, asdl_seq** seq_ptr) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) { excepthandler_ty* excepthandler; excepthandler = (excepthandler_ty*)&asdl_seq_GET(seq, n); - if (!optimize_excepthandler(excepthandler, ste, arena)) + if (!optimize_excepthandler(opt, excepthandler)) return 0; } return 1; } static int -optimize_keyword_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_keyword_seq(optimizer* opt, asdl_seq** seq_ptr) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_keyword((keyword_ty*)&asdl_seq_GET(seq, n), ste, arena)) + if (!optimize_keyword(opt, (keyword_ty*)&asdl_seq_GET(seq, n))) return 0; return 1; } static int -optimize_slice_seq(asdl_seq** seq_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_slice_seq(optimizer* opt, asdl_seq** seq_ptr) { int n; asdl_seq* seq = *seq_ptr; for (n = 0; n < asdl_seq_LEN(seq); n++) - if (!optimize_slice((slice_ty*)&asdl_seq_GET(seq, n), ste, arena)) + if (!optimize_slice(opt, (slice_ty*)&asdl_seq_GET(seq, n))) return 0; return 1; } static int -optimize_mod(mod_ty* mod_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_mod(optimizer* opt, mod_ty* mod_ptr) { asdl_seq** body; mod_ty mod = *mod_ptr; @@ -535,7 +593,7 @@ } case Expression_kind: { - return optimize_expr(&mod->v.Expression.body, ste, arena); + return optimize_expr(opt, &mod->v.Expression.body); } default: PyErr_Format(PyExc_ValueError, "unknown mod_ty kind: %d", @@ -543,28 +601,28 @@ return 0; }; - return optimize_stmt_seq(body, ste, arena); + return optimize_stmt_seq(opt, body); } static int -optimize_bool_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_bool_op(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.BoolOp.values, ste, arena)) + if (!optimize_expr_seq(opt, &expr->v.BoolOp.values)) return 0; return 1; } static int -optimize_bin_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_bin_op(optimizer* opt, expr_ty* expr_ptr) { PyObject* left; PyObject* right; expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.BinOp.left, ste, arena)) + if (!optimize_expr(opt, &expr->v.BinOp.left)) return 0; - if (!optimize_expr(&expr->v.BinOp.right, ste, arena)) + if (!optimize_expr(opt, &expr->v.BinOp.right)) return 0; /* @@ -679,7 +737,8 @@ return 1; } - expr = _expr_from_object(res, expr->lineno, expr->col_offset, arena); + expr = _expr_from_object(res, expr->lineno, expr->col_offset, + opt->opt_arena); if (expr == NULL) { Py_DECREF(res); return 0; @@ -691,11 +750,11 @@ } static int -optimize_unary_op(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_unary_op(optimizer* opt, expr_ty* expr_ptr) { PyObject* operand; expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.UnaryOp.operand, ste, arena)) + if (!optimize_expr(opt, &expr->v.UnaryOp.operand)) return 0; operand = _expr_constant_value(expr->v.UnaryOp.operand); if (operand != NULL) { @@ -745,7 +804,8 @@ return 1; } - expr = _expr_from_object(res, expr->lineno, expr->col_offset, arena); + expr = _expr_from_object(res, expr->lineno, expr->col_offset, + opt->opt_arena); if (!expr) { Py_DECREF(res); return 0; @@ -756,83 +816,80 @@ } static int -optimize_lambda(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_lambda(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Lambda.body, ste, arena)) + if (!optimize_expr(opt, &expr->v.Lambda.body)) return 0; return 1; } static int -optimize_if_exp(expr_ty* expr_ptr, PySTEntryObject* ste, - PyArena* arena) +optimize_if_exp(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.IfExp.test, ste, arena)) + if (!optimize_expr(opt, &expr->v.IfExp.test)) return 0; - if (!optimize_expr(&expr->v.IfExp.body, ste, arena)) + if (!optimize_expr(opt, &expr->v.IfExp.body)) return 0; - if (!optimize_expr(&expr->v.IfExp.orelse, ste, arena)) + if (!optimize_expr(opt, &expr->v.IfExp.orelse)) return 0; return 1; } static int -optimize_dict(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_dict(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.Dict.keys, ste, arena)) + if (!optimize_expr_seq(opt, &expr->v.Dict.keys)) return 0; - if (!optimize_expr_seq(&expr->v.Dict.values, ste, arena)) + if (!optimize_expr_seq(opt, &expr->v.Dict.values)) return 0; return 1; } static int -optimize_comprehension(comprehension_ty* comp_ptr, PySTEntryObject* ste, - PyArena* arena) +optimize_comprehension(optimizer* opt, comprehension_ty* comp_ptr) { comprehension_ty comp = *comp_ptr; - if (!optimize_expr(&comp->target, ste, arena)) + if (!optimize_expr(opt, &comp->target)) return 0; - if (!optimize_expr(&comp->iter, ste, arena)) + if (!optimize_expr(opt, &comp->iter)) return 0; - if (!optimize_expr_seq(&comp->ifs, ste, arena)) + if (!optimize_expr_seq(opt, &comp->ifs)) return 0; return 1; } static int -optimize_list_comp(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_list_comp(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.ListComp.elt, ste, arena)) + if (!optimize_expr(opt, &expr->v.ListComp.elt)) return 0; - if (!optimize_comprehension_seq(&expr->v.ListComp.generators, ste, arena)) + if (!optimize_comprehension_seq(opt, &expr->v.ListComp.generators)) return 0; return 1; } static int -optimize_generator_exp(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_generator_exp(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.GeneratorExp.elt, ste, arena)) + if (!optimize_expr(opt, &expr->v.GeneratorExp.elt)) return 0; - if (!optimize_comprehension_seq(&expr->v.GeneratorExp.generators, ste, - arena)) + if (!optimize_comprehension_seq(opt, &expr->v.GeneratorExp.generators)) return 0; return 1; } static int -optimize_yield(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_yield(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; if (expr->v.Yield.value != NULL) { expr_ty value; - if (!optimize_expr(&expr->v.Yield.value, ste, arena)) + if (!optimize_expr(opt, &expr->v.Yield.value)) return 0; value = expr->v.Yield.value; if (value->kind == Const_kind && value->v.Const.value == Py_None) @@ -842,101 +899,100 @@ } static int -optimize_compare(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_compare(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Compare.left, ste, arena)) + if (!optimize_expr(opt, &expr->v.Compare.left)) return 0; - if (!optimize_expr_seq(&expr->v.Compare.comparators, ste, arena)) + if (!optimize_expr_seq(opt, &expr->v.Compare.comparators)) return 0; return 1; } static int -optimize_keyword(keyword_ty* keyword_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_keyword(optimizer* opt, keyword_ty* keyword_ptr) { keyword_ty keyword = *keyword_ptr; - if (!optimize_expr(&keyword->value, ste, arena)) + if (!optimize_expr(opt, &keyword->value)) return 0; return 1; } static int -optimize_arguments(arguments_ty* args_ptr, PySTEntryObject* ste, - PyArena* arena) +optimize_arguments(optimizer* opt, arguments_ty* args_ptr) { arguments_ty args = *args_ptr; - if (!optimize_expr_seq(&args->args, ste, arena)) + if (!optimize_expr_seq(opt, &args->args)) return 0; - if (!optimize_expr_seq(&args->defaults, ste, arena)) + if (!optimize_expr_seq(opt, &args->defaults)) return 0; return 1; } static int -optimize_call(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_call(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Call.func, ste, arena)) + if (!optimize_expr(opt, &expr->v.Call.func)) return 0; - if (!optimize_expr_seq(&expr->v.Call.args, ste, arena)) + if (!optimize_expr_seq(opt, &expr->v.Call.args)) return 0; - if (!optimize_keyword_seq(&expr->v.Call.keywords, ste, arena)) + if (!optimize_keyword_seq(opt, &expr->v.Call.keywords)) return 0; if (expr->v.Call.starargs != NULL) - if (!optimize_expr(&expr->v.Call.starargs, ste, arena)) + if (!optimize_expr(opt, &expr->v.Call.starargs)) return 0; if (expr->v.Call.kwargs != NULL) - if (!optimize_expr(&expr->v.Call.kwargs, ste, arena)) + if (!optimize_expr(opt, &expr->v.Call.kwargs)) return 0; return 1; } static int -optimize_repr(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_repr(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Repr.value, ste, arena)) + if (!optimize_expr(opt, &expr->v.Repr.value)) return 0; return 1; } static int -optimize_attribute(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_attribute(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Attribute.value, ste, arena)) + if (!optimize_expr(opt, &expr->v.Attribute.value)) return 0; return 1; } static int -optimize_slice(slice_ty* slice_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_slice(optimizer* opt, slice_ty* slice_ptr) { slice_ty slice = *slice_ptr; switch (slice->kind) { case Slice_kind: { if (slice->v.Slice.lower != NULL) - if (!optimize_expr(&slice->v.Slice.lower, ste, arena)) + if (!optimize_expr(opt, &slice->v.Slice.lower)) return 0; if (slice->v.Slice.upper != NULL) - if (!optimize_expr(&slice->v.Slice.upper, ste, arena)) + if (!optimize_expr(opt, &slice->v.Slice.upper)) return 0; if (slice->v.Slice.step != NULL) - if (!optimize_expr(&slice->v.Slice.step, ste, arena)) + if (!optimize_expr(opt, &slice->v.Slice.step)) return 0; break; } case ExtSlice_kind: { - if (!optimize_slice_seq(&slice->v.ExtSlice.dims, ste, arena)) + if (!optimize_slice_seq(opt, &slice->v.ExtSlice.dims)) return 0; break; } case Index_kind: { - if (!optimize_expr(&slice->v.Index.value, ste, arena)) + if (!optimize_expr(opt, &slice->v.Index.value)) return 0; break; } @@ -953,28 +1009,30 @@ } static int -optimize_subscript(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_subscript(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr(&expr->v.Subscript.value, ste, arena)) + if (!optimize_expr(opt, &expr->v.Subscript.value)) return 0; - if (!optimize_slice(&expr->v.Subscript.slice, ste, arena)) + if (!optimize_slice(opt, &expr->v.Subscript.slice)) return 0; return 1; } static int -optimize_tuple(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_tuple(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; - if (!optimize_expr_seq(&expr->v.Tuple.elts, ste, arena)) + if (!optimize_expr_seq(opt, &expr->v.Tuple.elts)) return 0; if (_is_sequence_of_constants(expr->v.Tuple.elts)) { - PyObject* tuple = _build_tuple_of_constants(expr->v.Tuple.elts, arena); + PyObject* tuple = _build_tuple_of_constants(expr->v.Tuple.elts, + opt->opt_arena); if (tuple == NULL) return 0; - *expr_ptr = Const(tuple, expr->lineno, expr->col_offset, arena); + *expr_ptr = Const(tuple, expr->lineno, expr->col_offset, + opt->opt_arena); if (*expr_ptr == NULL) return 0; } @@ -983,7 +1041,7 @@ } static int -optimize_name(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_name(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; const char* id = PyString_AS_STRING(expr->v.Name.id); @@ -1011,7 +1069,7 @@ if (constvalue != NULL) { *expr_ptr = Const(constvalue, expr->lineno, - expr->col_offset, arena); + expr->col_offset, opt->opt_arena); if (*expr_ptr == NULL) return 0; } @@ -1020,77 +1078,77 @@ } static int -optimize_expr(expr_ty* expr_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_expr(optimizer* opt, expr_ty* expr_ptr) { expr_ty expr = *expr_ptr; switch (expr->kind) { case BoolOp_kind: { - return optimize_bool_op(expr_ptr, ste, arena); + return optimize_bool_op(opt, expr_ptr); } case BinOp_kind: { - return optimize_bin_op(expr_ptr, ste, arena); + return optimize_bin_op(opt, expr_ptr); } case UnaryOp_kind: { - return optimize_unary_op(expr_ptr, ste, arena); + return optimize_unary_op(opt, expr_ptr); } case Lambda_kind: { - return optimize_lambda(expr_ptr, ste, arena); + return optimize_lambda(opt, expr_ptr); } case IfExp_kind: { - return optimize_if_exp(expr_ptr, ste, arena); + return optimize_if_exp(opt, expr_ptr); } case Dict_kind: { - return optimize_dict(expr_ptr, ste, arena); + return optimize_dict(opt, expr_ptr); } case ListComp_kind: { - return optimize_list_comp(expr_ptr, ste, arena); + return optimize_list_comp(opt, expr_ptr); } case GeneratorExp_kind: { - return optimize_generator_exp(expr_ptr, ste, arena); + return optimize_generator_exp(opt, expr_ptr); } case Yield_kind: { - return optimize_yield(expr_ptr, ste, arena); + return optimize_yield(opt, expr_ptr); } case Compare_kind: { - return optimize_compare(expr_ptr, ste, arena); + return optimize_compare(opt, expr_ptr); } case Call_kind: { - return optimize_call(expr_ptr, ste, arena); + return optimize_call(opt, expr_ptr); } case Repr_kind: { - return optimize_repr(expr_ptr, ste, arena); + return optimize_repr(opt, expr_ptr); } case Attribute_kind: { - return optimize_attribute(expr_ptr, ste, arena); + return optimize_attribute(opt, expr_ptr); } case Subscript_kind: { - return optimize_subscript(expr_ptr, ste, arena); + return optimize_subscript(opt, expr_ptr); } case List_kind: { - return optimize_expr_seq(&expr->v.List.elts, ste, arena); + return optimize_expr_seq(opt, &expr->v.List.elts); } case Tuple_kind: { - return optimize_tuple(expr_ptr, ste, arena); + return optimize_tuple(opt, expr_ptr); } case Name_kind: { - return optimize_name(expr_ptr, ste, arena); + return optimize_name(opt, expr_ptr); } case Num_kind: case Str_kind: @@ -1106,38 +1164,38 @@ } static int -optimize_function_def(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_function_def(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_arguments(&stmt->v.FunctionDef.args, ste, arena)) + if (!optimize_arguments(opt, &stmt->v.FunctionDef.args)) return 0; - if (!optimize_expr_seq(&stmt->v.FunctionDef.decorator_list, ste, arena)) + if (!optimize_expr_seq(opt, &stmt->v.FunctionDef.decorator_list)) return 0; - if (!optimize_stmt_seq(&stmt->v.FunctionDef.body, ste, arena)) + if (!optimize_stmt_seq(opt, &stmt->v.FunctionDef.body)) return 0; return 1; } static int -optimize_class_def(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_class_def(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.ClassDef.bases, ste, arena)) + if (!optimize_expr_seq(opt, &stmt->v.ClassDef.bases)) return 0; - if (!optimize_expr_seq(&stmt->v.ClassDef.decorator_list, ste, arena)) + if (!optimize_expr_seq(opt, &stmt->v.ClassDef.decorator_list)) return 0; - if (!optimize_stmt_seq(&stmt->v.ClassDef.body, ste, arena)) + if (!optimize_stmt_seq(opt, &stmt->v.ClassDef.body)) return 0; return 1; } static int -optimize_return(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_return(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Return.value != NULL) { expr_ty value; - if (!optimize_expr(&stmt->v.Return.value, ste, arena)) + if (!optimize_expr(opt, &stmt->v.Return.value)) return 0; value = stmt->v.Return.value; if (value->kind == Const_kind && value->v.Const.value == Py_None) @@ -1147,96 +1205,96 @@ } static int -optimize_delete(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_delete(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.Delete.targets, ste, arena)) + if (!optimize_expr_seq(opt, &stmt->v.Delete.targets)) return 0; return 1; } static int -optimize_assign(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_assign(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr_seq(&stmt->v.Assign.targets, ste, arena)) + if (!optimize_expr_seq(opt, &stmt->v.Assign.targets)) return 0; - if (!optimize_expr(&stmt->v.Assign.value, ste, arena)) + if (!optimize_expr(opt, &stmt->v.Assign.value)) return 0; return 1; } static int -optimize_aug_assign(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_aug_assign(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.AugAssign.target, ste, arena)) + if (!optimize_expr(opt, &stmt->v.AugAssign.target)) return 0; - if (!optimize_expr(&stmt->v.AugAssign.value, ste, arena)) + if (!optimize_expr(opt, &stmt->v.AugAssign.value)) return 0; return 1; } static int -optimize_print(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_print(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Print.dest != NULL) - if (!optimize_expr(&stmt->v.Print.dest, ste, arena)) + if (!optimize_expr(opt, &stmt->v.Print.dest)) return 0; - if (!optimize_expr_seq(&stmt->v.Print.values, ste, arena)) + if (!optimize_expr_seq(opt, &stmt->v.Print.values)) return 0; return 1; } static int -_optimize_for_iter(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +_optimize_for_iter(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.For.iter, ste, arena)) + if (!optimize_expr(opt, &stmt->v.For.iter)) return 0; return 1; } static int -optimize_for(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_for(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.For.target, ste, arena)) + if (!optimize_expr(opt, &stmt->v.For.target)) return 0; - if (!_optimize_for_iter(&stmt, ste, arena)) + if (!_optimize_for_iter(opt, &stmt)) return 0; - if (!optimize_stmt_seq(&stmt->v.For.body, ste, arena)) + if (!optimize_stmt_seq(opt, &stmt->v.For.body)) return 0; - if (!optimize_stmt_seq(&stmt->v.For.orelse, ste, arena)) + if (!optimize_stmt_seq(opt, &stmt->v.For.orelse)) return 0; return 1; } static int -optimize_while(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_while(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.While.test, ste, arena)) + if (!optimize_expr(opt, &stmt->v.While.test)) return 0; - if (!optimize_stmt_seq(&stmt->v.While.body, ste, arena)) + if (!optimize_stmt_seq(opt, &stmt->v.While.body)) return 0; - if (!optimize_stmt_seq(&stmt->v.While.orelse, ste, arena)) + if (!optimize_stmt_seq(opt, &stmt->v.While.orelse)) return 0; return 1; } static int -optimize_if(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_if(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.If.test, ste, arena)) + if (!optimize_expr(opt, &stmt->v.If.test)) return 0; - if (!optimize_stmt_seq(&stmt->v.If.body, ste, arena)) + if (!optimize_stmt_seq(opt, &stmt->v.If.body)) return 0; - if (!optimize_stmt_seq(&stmt->v.If.orelse, ste, arena)) + if (!optimize_stmt_seq(opt, &stmt->v.If.orelse)) return 0; if (stmt->v.If.test->kind == UnaryOp_kind && @@ -1244,11 +1302,11 @@ asdl_seq* body = stmt->v.If.orelse; if (body == NULL) { /* body can't be NULL, so let's turn this into a Pass() */ - stmt_ty pass = Pass(stmt->lineno, stmt->col_offset, arena); + stmt_ty pass = Pass(stmt->lineno, stmt->col_offset, opt->opt_arena); if (pass == NULL) return 0; - body = asdl_seq_new(1, arena); + body = asdl_seq_new(1, opt->opt_arena); if (body == NULL) return 0; @@ -1257,7 +1315,7 @@ *stmt_ptr = If(stmt->v.If.test->v.UnaryOp.operand, body, stmt->v.If.body, - stmt->lineno, stmt->col_offset, arena); + stmt->lineno, stmt->col_offset, opt->opt_arena); if (*stmt_ptr == NULL) return 0; } @@ -1266,104 +1324,110 @@ } static int -optimize_with(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_with(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.With.context_expr, ste, arena)) + if (!optimize_expr(opt, &stmt->v.With.context_expr)) return 0; if (stmt->v.With.optional_vars != NULL) - if (!optimize_expr(&stmt->v.With.optional_vars, ste, arena)) + if (!optimize_expr(opt, &stmt->v.With.optional_vars)) return 0; - if (!optimize_stmt_seq(&stmt->v.With.body, ste, arena)) + if (!optimize_stmt_seq(opt, &stmt->v.With.body)) return 0; return 1; } static int -optimize_raise(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_raise(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; if (stmt->v.Raise.type != NULL) - if (!optimize_expr(&stmt->v.Raise.type, ste, arena)) + if (!optimize_expr(opt, &stmt->v.Raise.type)) return 0; if (stmt->v.Raise.inst != NULL) - if (!optimize_expr(&stmt->v.Raise.inst, ste, arena)) + if (!optimize_expr(opt, &stmt->v.Raise.inst)) return 0; if (stmt->v.Raise.tback != NULL) - if (!optimize_expr(&stmt->v.Raise.tback, ste, arena)) + if (!optimize_expr(opt, &stmt->v.Raise.tback)) return 0; return 1; } static int -optimize_excepthandler(excepthandler_ty* exc_ptr, PySTEntryObject* ste, - PyArena* arena) +optimize_excepthandler(optimizer* opt, excepthandler_ty* exc_ptr) { excepthandler_ty exc = *exc_ptr; if (exc->v.ExceptHandler.type != NULL) - if (!optimize_expr(&exc->v.ExceptHandler.type, ste, arena)) + if (!optimize_expr(opt, &exc->v.ExceptHandler.type)) return 0; if (exc->v.ExceptHandler.name != NULL) - if (!optimize_expr(&exc->v.ExceptHandler.name, ste, arena)) + if (!optimize_expr(opt, &exc->v.ExceptHandler.name)) return 0; - if (!optimize_stmt_seq(&exc->v.ExceptHandler.body, ste, arena)) + if (!optimize_stmt_seq(opt, &exc->v.ExceptHandler.body)) return 0; return 1; } static int -optimize_try_except(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_try_except(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_stmt_seq(&stmt->v.TryExcept.body, ste, arena)) + + if (!optimize_stmt_seq(opt, &stmt->v.TryExcept.body)) return 0; - if (!optimize_excepthandler_seq(&stmt->v.TryExcept.handlers, ste, arena)) + if (!optimize_excepthandler_seq(opt, &stmt->v.TryExcept.handlers)) return 0; - if (!optimize_stmt_seq(&stmt->v.TryExcept.orelse, ste, arena)) + if (!optimize_stmt_seq(opt, &stmt->v.TryExcept.orelse)) return 0; + return 1; } static int -optimize_try_finally(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_try_finally(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_stmt_seq(&stmt->v.TryFinally.body, ste, arena)) + + if (!optimize_stmt_seq(opt, &stmt->v.TryFinally.body)) return 0; - if (!optimize_stmt_seq(&stmt->v.TryFinally.finalbody, ste, arena)) + + opt->opt_current->b_finally = 1; + if (!optimize_stmt_seq(opt, &stmt->v.TryFinally.finalbody)) return 0; + opt->opt_current->b_finally = 0; + return 1; } static int -optimize_assert(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_assert(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.Assert.test, ste, arena)) + if (!optimize_expr(opt, &stmt->v.Assert.test)) return 0; if (stmt->v.Assert.msg != NULL) - if (!optimize_expr(&stmt->v.Assert.msg, ste, arena)) + if (!optimize_expr(opt, &stmt->v.Assert.msg)) return 0; return 1; } static int -optimize_exec(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_exec(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; - if (!optimize_expr(&stmt->v.Exec.body, ste, arena)) + if (!optimize_expr(opt, &stmt->v.Exec.body)) return 0; if (stmt->v.Exec.globals != NULL) - if (!optimize_expr(&stmt->v.Exec.globals, ste, arena)) + if (!optimize_expr(opt, &stmt->v.Exec.globals)) return 0; if (stmt->v.Exec.locals != NULL) - if (!optimize_expr(&stmt->v.Exec.locals, ste, arena)) + if (!optimize_expr(opt, &stmt->v.Exec.locals)) return 0; return 1; } static int -optimize_stmt(stmt_ty* stmt_ptr, PySTEntryObject* ste, PyArena* arena) +optimize_stmt(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; @@ -1371,90 +1435,111 @@ case FunctionDef_kind: { int result; - ste = PySymtable_Lookup(ste->ste_table, stmt); + PySTEntryObject* ste; + + ste = PySymtable_Lookup(opt->opt_symtable, stmt); if (ste == NULL) return 0; - result = optimize_function_def(stmt_ptr, ste, arena); + if (!_enter_block(opt, ste)) { + Py_DECREF(ste); + return 0; + } + + result = optimize_function_def(opt, stmt_ptr); + + _leave_block(opt); Py_DECREF(ste); return result; } case ClassDef_kind: { int result; - ste = PySymtable_Lookup(ste->ste_table, stmt); + PySTEntryObject* ste; + + ste = PySymtable_Lookup(opt->opt_symtable, stmt); if (ste == NULL) return 0; - result = optimize_class_def(stmt_ptr, ste, arena); + if (!_enter_block(opt, ste)) { + Py_DECREF(ste); + return 0; + } + result = optimize_class_def(opt, stmt_ptr); + _leave_block(opt); Py_DECREF(ste); return result; } case Return_kind: { - return optimize_return(stmt_ptr, ste, arena); + return optimize_return(opt, stmt_ptr); } case Delete_kind: { - return optimize_delete(stmt_ptr, ste, arena); + return optimize_delete(opt, stmt_ptr); } case Assign_kind: { - return optimize_assign(stmt_ptr, ste, arena); + return optimize_assign(opt, stmt_ptr); } case AugAssign_kind: { - return optimize_aug_assign(stmt_ptr, ste, arena); + return optimize_aug_assign(opt, stmt_ptr); } case Print_kind: { - return optimize_print(stmt_ptr, ste, arena); + return optimize_print(opt, stmt_ptr); } case For_kind: { - return optimize_for(stmt_ptr, ste, arena); + return optimize_for(opt, stmt_ptr); } case While_kind: { - return optimize_while(stmt_ptr, ste, arena); + return optimize_while(opt, stmt_ptr); } case If_kind: { - return optimize_if(stmt_ptr, ste, arena); + return optimize_if(opt, stmt_ptr); } case With_kind: { - return optimize_with(stmt_ptr, ste, arena); + return optimize_with(opt, stmt_ptr); } case Raise_kind: { - return optimize_raise(stmt_ptr, ste, arena); + return optimize_raise(opt, stmt_ptr); } case TryExcept_kind: { - return optimize_try_except(stmt_ptr, ste, arena); + return optimize_try_except(opt, stmt_ptr); } case TryFinally_kind: { - return optimize_try_finally(stmt_ptr, ste, arena); + return optimize_try_finally(opt, stmt_ptr); } case Assert_kind: { - return optimize_assert(stmt_ptr, ste, arena); + return optimize_assert(opt, stmt_ptr); } case Exec_kind: { - return optimize_exec(stmt_ptr, ste, arena); + return optimize_exec(opt, stmt_ptr); } case Expr_kind: { - return optimize_expr(&stmt->v.Expr.value, ste, arena); + return optimize_expr(opt, &stmt->v.Expr.value); } case Import_kind: case ImportFrom_kind: case Global_kind: case Pass_kind: case Break_kind: + { + return 1; + } case Continue_kind: { + if (opt->opt_current->b_finally) + opt->opt_current->b_eliminate = 0; return 1; } default: @@ -1474,11 +1559,21 @@ { int result; PySTEntryObject* ste; + optimizer opt; + + opt.opt_symtable = st; + opt.opt_arena = arena; + opt.opt_current = NULL; ste = PySymtable_Lookup(st, *mod_ptr); if (ste == NULL) return 0; - result = optimize_mod(mod_ptr, ste, arena); + if (!_enter_block(&opt, ste)) { + Py_DECREF(ste); + return 0; + } + result = optimize_mod(&opt, mod_ptr); + _leave_block(&opt); Py_DECREF(ste); return result; } From python-checkins at python.org Sun Jul 13 10:52:40 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 13 Jul 2008 10:52:40 +0200 (CEST) Subject: [Python-checkins] r64908 - in python/branches/tlee-ast-optimize: Doc/c-api/conversion.rst Doc/extending/windows.rst Doc/library/__future__.rst Doc/library/ftplib.rst Doc/library/functions.rst Doc/library/imputil.rst Doc/library/macosa.rst Doc/library/multiprocessing.rst Doc/library/operator.rst Doc/library/select.rst Doc/library/stdtypes.rst Doc/library/string.rst Doc/library/thread.rst Doc/library/tix.rst Doc/library/turtle.rst Doc/library/urllib2.rst Doc/library/wsgiref.rst Doc/library/xmlrpclib.rst Doc/tutorial/stdlib2.rst Doc/using/windows.rst Doc/whatsnew/2.6.rst Lib/dummy_thread.py Lib/robotparser.py Lib/test/test_dummy_thread.py Misc/ACKS Misc/NEWS Tools/faqwiz/move-faqwiz.sh Message-ID: <20080713085240.3D91A1E4002@bag.python.org> Author: thomas.lee Date: Sun Jul 13 10:52:38 2008 New Revision: 64908 Log: Merged revisions 64887-64907 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r64888 | matthias.klose | 2008-07-12 17:51:48 +1000 (Sat, 12 Jul 2008) | 2 lines - Fix bashisms in Tools/faqwiz/move-faqwiz.sh ........ r64897 | benjamin.peterson | 2008-07-13 06:16:19 +1000 (Sun, 13 Jul 2008) | 1 line fix various doc typos #3320 ........ r64900 | alexandre.vassalotti | 2008-07-13 08:06:53 +1000 (Sun, 13 Jul 2008) | 2 lines Fixed typo. ........ r64901 | benjamin.peterson | 2008-07-13 09:41:19 +1000 (Sun, 13 Jul 2008) | 1 line #1778443 robotparser fixes from Aristotelis Mikropoulos ........ r64903 | brett.cannon | 2008-07-13 11:15:07 +1000 (Sun, 13 Jul 2008) | 6 lines dummy_thread.acquire() would return None if no waitflag argument was given. It should have returned True. Fixes issue #3339. Thanks, Henk Punt for the report and Andrii v. Mishkovskiyi for attempting a patch. ........ Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/c-api/conversion.rst python/branches/tlee-ast-optimize/Doc/extending/windows.rst python/branches/tlee-ast-optimize/Doc/library/__future__.rst python/branches/tlee-ast-optimize/Doc/library/ftplib.rst python/branches/tlee-ast-optimize/Doc/library/functions.rst python/branches/tlee-ast-optimize/Doc/library/imputil.rst python/branches/tlee-ast-optimize/Doc/library/macosa.rst python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst python/branches/tlee-ast-optimize/Doc/library/operator.rst python/branches/tlee-ast-optimize/Doc/library/select.rst python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst python/branches/tlee-ast-optimize/Doc/library/string.rst python/branches/tlee-ast-optimize/Doc/library/thread.rst python/branches/tlee-ast-optimize/Doc/library/tix.rst python/branches/tlee-ast-optimize/Doc/library/turtle.rst python/branches/tlee-ast-optimize/Doc/library/urllib2.rst python/branches/tlee-ast-optimize/Doc/library/wsgiref.rst python/branches/tlee-ast-optimize/Doc/library/xmlrpclib.rst python/branches/tlee-ast-optimize/Doc/tutorial/stdlib2.rst python/branches/tlee-ast-optimize/Doc/using/windows.rst python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst python/branches/tlee-ast-optimize/Lib/dummy_thread.py python/branches/tlee-ast-optimize/Lib/robotparser.py python/branches/tlee-ast-optimize/Lib/test/test_dummy_thread.py python/branches/tlee-ast-optimize/Misc/ACKS python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Tools/faqwiz/move-faqwiz.sh Modified: python/branches/tlee-ast-optimize/Doc/c-api/conversion.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/c-api/conversion.rst (original) +++ python/branches/tlee-ast-optimize/Doc/c-api/conversion.rst Sun Jul 13 10:52:38 2008 @@ -89,15 +89,15 @@ .. cfunction:: char * PyOS_stricmp(char *s1, char *s2) - Case insensitive comparsion of strings. The functions works almost - identical to :cfunc:`strcmp` except that it ignores the case. + Case insensitive comparison of strings. The function works almost + identically to :cfunc:`strcmp` except that it ignores the case. .. versionadded:: 2.6 .. cfunction:: char * PyOS_strnicmp(char *s1, char *s2, Py_ssize_t size) - Case insensitive comparsion of strings. The functions works almost - identical to :cfunc:`strncmp` except that it ignores the case. + Case insensitive comparison of strings. The function works almost + identically to :cfunc:`strncmp` except that it ignores the case. .. versionadded:: 2.6 Modified: python/branches/tlee-ast-optimize/Doc/extending/windows.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/extending/windows.rst (original) +++ python/branches/tlee-ast-optimize/Doc/extending/windows.rst Sun Jul 13 10:52:38 2008 @@ -23,7 +23,7 @@ This chapter mentions a number of filenames that include an encoded Python version number. These filenames are represented with the version number shown - as ``XY``; in practive, ``'X'`` will be the major version number and ``'Y'`` + as ``XY``; in practice, ``'X'`` will be the major version number and ``'Y'`` will be the minor version number of the Python release you're working with. For example, if you are using Python 2.2.1, ``XY`` will actually be ``22``. Modified: python/branches/tlee-ast-optimize/Doc/library/__future__.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/__future__.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/__future__.rst Sun Jul 13 10:52:38 2008 @@ -16,7 +16,7 @@ * To document when incompatible changes were introduced, and when they will be --- or were --- made mandatory. This is a form of executable documentation, and - can be inspected programatically via importing :mod:`__future__` and examining + can be inspected programmatically via importing :mod:`__future__` and examining its contents. Each statement in :file:`__future__.py` is of the form:: Modified: python/branches/tlee-ast-optimize/Doc/library/ftplib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/ftplib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/ftplib.rst Sun Jul 13 10:52:38 2008 @@ -316,7 +316,7 @@ Send a ``QUIT`` command to the server and close the connection. This is the "polite" way to close a connection, but it may raise an exception of the server - reponds with an error to the ``QUIT`` command. This implies a call to the + responds with an error to the ``QUIT`` command. This implies a call to the :meth:`close` method which renders the :class:`FTP` instance useless for subsequent calls (see below). Modified: python/branches/tlee-ast-optimize/Doc/library/functions.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/functions.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/functions.rst Sun Jul 13 10:52:38 2008 @@ -1389,7 +1389,7 @@ or use in modern Python programming. They have been kept here to maintain backwards compatibility with programs written for older versions of Python. -Python programmers, trainers, students and bookwriters should feel free to +Python programmers, trainers, students and book writers should feel free to bypass these functions without concerns about missing something important. Modified: python/branches/tlee-ast-optimize/Doc/library/imputil.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/imputil.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/imputil.rst Sun Jul 13 10:52:38 2008 @@ -108,7 +108,7 @@ This code is intended to be read, not executed. However, it does work -- all you need to do to enable it is "import knee". -(The name is a pun on the klunkier predecessor of this module, "ni".) +(The name is a pun on the clunkier predecessor of this module, "ni".) :: Modified: python/branches/tlee-ast-optimize/Doc/library/macosa.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/macosa.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/macosa.rst Sun Jul 13 10:52:38 2008 @@ -6,10 +6,10 @@ ********************* This chapter describes the current implementation of the Open Scripting -Architecure (OSA, also commonly referred to as AppleScript) for Python, allowing -you to control scriptable applications from your Python program, and with a -fairly pythonic interface. Development on this set of modules has stopped, and a -replacement is expected for Python 2.5. +Architecture (OSA, also commonly referred to as AppleScript) for Python, +allowing you to control scriptable applications from your Python program, +and with a fairly pythonic interface. Development on this set of modules has +stopped, and a replacement is expected for Python 2.5. For a description of the various components of AppleScript and OSA, and to get an understanding of the architecture and terminology, you should read Apple's Modified: python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst Sun Jul 13 10:52:38 2008 @@ -160,7 +160,7 @@ The ``'d'`` and ``'i'`` arguments used when creating ``num`` and ``arr`` are typecodes of the kind used by the :mod:`array` module: ``'d'`` indicates a - double precision float and ``'i'`` inidicates a signed integer. These shared + double precision float and ``'i'`` indicates a signed integer. These shared objects will be process and thread safe. For more flexibility in using shared memory one can use the @@ -784,7 +784,7 @@ A bounded semaphore object: a clone of :class:`threading.BoundedSemaphore`. - (On Mac OSX this is indistiguishable from :class:`Semaphore` because + (On Mac OSX this is indistinguishable from :class:`Semaphore` because ``sem_getvalue()`` is not implemented on that platform). .. class:: Condition([lock]) @@ -893,8 +893,8 @@ .. note:: - Although it is posible to store a pointer in shared memory remember that this - will refer to a location in the address space of a specific process. + Although it is possible to store a pointer in shared memory remember that + this will refer to a location in the address space of a specific process. However, the pointer is quite likely to be invalid in the context of a second process and trying to dereference the pointer from the second process may cause a crash. @@ -1776,7 +1776,7 @@ handler which sends output to :data:`sys.stderr` using format ``'[%(levelname)s/%(processName)s] %(message)s'``. (The logger allows use of the non-standard ``'%(processName)s'`` format.) Message sent to this logger - will not by default propogate to the root logger. + will not by default propagate to the root logger. Note that on Windows child processes will only inherit the level of the parent process's logger -- any other customization of the logger will not be Modified: python/branches/tlee-ast-optimize/Doc/library/operator.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/operator.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/operator.rst Sun Jul 13 10:52:38 2008 @@ -630,7 +630,7 @@ +-----------------------+-------------------------+---------------------------------+ | Right Shift | ``a >> b`` | ``rshift(a, b)`` | +-----------------------+-------------------------+---------------------------------+ -| Sequence Repitition | ``seq * i`` | ``repeat(seq, i)`` | +| Sequence Repetition | ``seq * i`` | ``repeat(seq, i)`` | +-----------------------+-------------------------+---------------------------------+ | Slice Assignment | ``seq[i:j] = values`` | ``setslice(seq, i, j, values)`` | +-----------------------+-------------------------+---------------------------------+ Modified: python/branches/tlee-ast-optimize/Doc/library/select.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/select.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/select.rst Sun Jul 13 10:52:38 2008 @@ -338,7 +338,7 @@ +---------------------------+---------------------------------------------+ | :const:`KQ_EV_DISABLE` | Disablesevent | +---------------------------+---------------------------------------------+ - | :const:`KQ_EV_ONESHOT` | Removes event after first occurence | + | :const:`KQ_EV_ONESHOT` | Removes event after first occurrence | +---------------------------+---------------------------------------------+ | :const:`KQ_EV_CLEAR` | Reset the state after an event is retrieved | +---------------------------+---------------------------------------------+ @@ -373,7 +373,7 @@ +============================+============================================+ | :const:`KQ_NOTE_DELETE` | *unlink()* was called | +----------------------------+--------------------------------------------+ - | :const:`KQ_NOTE_WRITE` | a write occured | + | :const:`KQ_NOTE_WRITE` | a write occurred | +----------------------------+--------------------------------------------+ | :const:`KQ_NOTE_EXTEND` | the file was extended | +----------------------------+--------------------------------------------+ Modified: python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst Sun Jul 13 10:52:38 2008 @@ -1543,7 +1543,7 @@ .. method:: isdisjoint(other) Return True if the set has no elements in common with *other*. Sets are - disjoint if and only if their interesection is the empty set. + disjoint if and only if their intersection is the empty set. .. versionadded:: 2.6 Modified: python/branches/tlee-ast-optimize/Doc/library/string.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/string.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/string.rst Sun Jul 13 10:52:38 2008 @@ -293,7 +293,7 @@ "noses " -Which is subsitituted into the string, yielding:: +Which is substituted into the string, yielding:: "A man with two noses " Modified: python/branches/tlee-ast-optimize/Doc/library/thread.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/thread.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/thread.rst Sun Jul 13 10:52:38 2008 @@ -7,7 +7,7 @@ .. note:: The :mod:`thread` module has been renamed to :mod:`_thread` in Python 3.0. The :term:`2to3` tool will automatically adapt imports when converting your - sources to 3.0; however, you should consider using the high-lever + sources to 3.0; however, you should consider using the high-level :mod:`threading` module instead. Modified: python/branches/tlee-ast-optimize/Doc/library/tix.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/tix.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/tix.rst Sun Jul 13 10:52:38 2008 @@ -310,8 +310,8 @@ .. \ulink{FileEntry}{http://tix.sourceforge.net/dist/current/demos/samples/FileEnt.tcl} -Hierachical ListBox -^^^^^^^^^^^^^^^^^^^ +Hierarchical ListBox +^^^^^^^^^^^^^^^^^^^^ .. class:: HList() Modified: python/branches/tlee-ast-optimize/Doc/library/turtle.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/turtle.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/turtle.rst Sun Jul 13 10:52:38 2008 @@ -1275,7 +1275,7 @@ ... left(10) ... >>> for _ in range(8): - ... left(45); fd(2) # a regular octogon + ... left(45); fd(2) # a regular octagon Animation control @@ -1286,7 +1286,7 @@ :param delay: positive integer Set or return the drawing *delay* in milliseconds. (This is approximately - the time interval between two consecutived canvas updates.) The longer the + the time interval between two consecutive canvas updates.) The longer the drawing delay, the slower the animation. Optional argument: Modified: python/branches/tlee-ast-optimize/Doc/library/urllib2.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/urllib2.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/urllib2.rst Sun Jul 13 10:52:38 2008 @@ -923,7 +923,7 @@ obtain the HTTP proxy's URL. This example replaces the default :class:`ProxyHandler` with one that uses -programatically-supplied proxy URLs, and adds proxy authorization support with +programmatically-supplied proxy URLs, and adds proxy authorization support with :class:`ProxyBasicAuthHandler`. :: proxy_handler = urllib2.ProxyHandler({'http': 'http://www.example.com:3128/'}) Modified: python/branches/tlee-ast-optimize/Doc/library/wsgiref.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/wsgiref.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/wsgiref.rst Sun Jul 13 10:52:38 2008 @@ -415,7 +415,7 @@ from wsgiref.validate import validator from wsgiref.simple_server import make_server - # Our callable object which is intentionally not compilant to the + # Our callable object which is intentionally not compliant to the # standard, so the validator is going to break def simple_app(environ, start_response): status = '200 OK' # HTTP Status Modified: python/branches/tlee-ast-optimize/Doc/library/xmlrpclib.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/xmlrpclib.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/xmlrpclib.rst Sun Jul 13 10:52:38 2008 @@ -379,7 +379,7 @@ try: proxy.add(2, 5) except xmlrpclib.Fault, err: - print "A fault occured" + print "A fault occurred" print "Fault code: %d" % err.faultCode print "Fault string: %s" % err.faultString @@ -426,7 +426,7 @@ try: proxy.some_method() except xmlrpclib.ProtocolError, err: - print "A protocol error occured" + print "A protocol error occurred" print "URL: %s" % err.url print "HTTP/HTTPS headers: %s" % err.headers print "Error code: %d" % err.errcode Modified: python/branches/tlee-ast-optimize/Doc/tutorial/stdlib2.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/tutorial/stdlib2.rst (original) +++ python/branches/tlee-ast-optimize/Doc/tutorial/stdlib2.rst Sun Jul 13 10:52:38 2008 @@ -286,7 +286,7 @@ performance trade-offs. The :mod:`array` module provides an :class:`array()` object that is like a list -that stores only homogenous data and stores it more compactly. The following +that stores only homogeneous data and stores it more compactly. The following example shows an array of numbers stored as two byte unsigned binary numbers (typecode ``"H"``) rather than the usual 16 bytes per entry for regular lists of python int objects:: Modified: python/branches/tlee-ast-optimize/Doc/using/windows.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/using/windows.rst (original) +++ python/branches/tlee-ast-optimize/Doc/using/windows.rst Sun Jul 13 10:52:38 2008 @@ -188,7 +188,7 @@ startup. You can also make all ``.py`` scripts execute with :program:`pythonw.exe`, -setting this through the usual facilites, for example (might require +setting this through the usual facilities, for example (might require administrative rights): #. Launch a command prompt. @@ -217,7 +217,7 @@ The `PyWin32 `_ module by Mark Hammond is a collection of modules for advanced Windows-specific support. This includes -utilites for: +utilities for: * `Component Object Model `_ (COM) * Win32 API calls Modified: python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst (original) +++ python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst Sun Jul 13 10:52:38 2008 @@ -529,7 +529,7 @@ .. XXX I think this still needs help :mod:`multiprocessing` makes it easy to distribute work over multiple processes. -Its API is similiar to that of :mod:`threading`. For example:: +Its API is similar to that of :mod:`threading`. For example:: from multiprocessing import Process Modified: python/branches/tlee-ast-optimize/Lib/dummy_thread.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/dummy_thread.py (original) +++ python/branches/tlee-ast-optimize/Lib/dummy_thread.py Sun Jul 13 10:52:38 2008 @@ -104,18 +104,15 @@ aren't triggered and throw a little fit. """ - if waitflag is None: + if waitflag is None or waitflag: self.locked_status = True - return None - elif not waitflag: + return True + else: if not self.locked_status: self.locked_status = True return True else: return False - else: - self.locked_status = True - return True __enter__ = acquire Modified: python/branches/tlee-ast-optimize/Lib/robotparser.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/robotparser.py (original) +++ python/branches/tlee-ast-optimize/Lib/robotparser.py Sun Jul 13 10:52:38 2008 @@ -55,11 +55,8 @@ """Reads the robots.txt URL and feeds it to the parser.""" opener = URLopener() f = opener.open(self.url) - lines = [] - line = f.readline() - while line: - lines.append(line.strip()) - line = f.readline() + lines = [line.strip() for line in f] + f.close() self.errcode = opener.errcode if self.errcode in (401, 403): self.disallow_all = True @@ -84,7 +81,7 @@ entry = Entry() for line in lines: - linenumber = linenumber + 1 + linenumber += 1 if not line: if state == 1: entry = Entry() Modified: python/branches/tlee-ast-optimize/Lib/test/test_dummy_thread.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_dummy_thread.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_dummy_thread.py Sun Jul 13 10:52:38 2008 @@ -60,6 +60,7 @@ #Make sure that an unconditional locking returns True. self.failUnless(self.lock.acquire(1) is True, "Unconditional locking did not return True.") + self.failUnless(self.lock.acquire() is True) def test_uncond_acquire_blocking(self): #Make sure that unconditional acquiring of a locked lock blocks. Modified: python/branches/tlee-ast-optimize/Misc/ACKS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/ACKS (original) +++ python/branches/tlee-ast-optimize/Misc/ACKS Sun Jul 13 10:52:38 2008 @@ -460,6 +460,7 @@ Mike Meyer Steven Miale Trent Mick +Aristotelis Mikropoulos Damien Miller Chad Miller Jay T. Miller Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Sun Jul 13 10:52:38 2008 @@ -10,7 +10,6 @@ Core and Builtins ----------------- - - Issue #2517: Allow unicode messages in Exceptions again by correctly bypassing the instance dictionary when looking up __unicode__ on new-style classes. @@ -41,6 +40,8 @@ Library ------- +- Issue #3339: dummy_thread.acquire() should not return None. + - Issue #3285: Fractions from_float() and from_decimal() accept Integral arguments. - Issue #3301: Bisect module behaved badly when lo was negative. Modified: python/branches/tlee-ast-optimize/Tools/faqwiz/move-faqwiz.sh ============================================================================== --- python/branches/tlee-ast-optimize/Tools/faqwiz/move-faqwiz.sh (original) +++ python/branches/tlee-ast-optimize/Tools/faqwiz/move-faqwiz.sh Sun Jul 13 10:52:38 2008 @@ -9,7 +9,7 @@ # blackjesus:~> ./move-faqwiz.sh 2\.1 3\.2 # Moving FAQ question 02.001 to 03.002 -if [ x$2 == x ]; then +if [ x$2 = x ]; then echo "Need 2 args: original_version final_version." exit 2 fi @@ -19,7 +19,7 @@ exit 2 fi -function cut_n_pad() { +cut_n_pad() { t=`echo $1 | cut -d. -f $2` export $3=`echo $t | awk "{ tmp = \\$0; l = length(tmp); for (i = 0; i < $2-l+1; i++) { tmp = "0".tmp } print tmp }"` } @@ -28,7 +28,13 @@ cut_n_pad $1 2 suffix1 cut_n_pad $2 1 prefix2 cut_n_pad $2 2 suffix2 -tmpfile=tmp$RANDOM.tmp +if which tempfile >/dev/null; then + tmpfile=$(tempfile -d .) +elif [ -n "$RANDOM" ]; then + tmpfile=tmp$RANDOM.tmp +else + tmpfile=tmp$$.tmp +fi file1=faq$prefix1.$suffix1.htp file2=faq$prefix2.$suffix2.htp From python-checkins at python.org Sun Jul 13 12:26:11 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 13 Jul 2008 12:26:11 +0200 (CEST) Subject: [Python-checkins] r64909 - python/branches/tlee-ast-optimize/Python/optimize.c Message-ID: <20080713102611.299971E4002@bag.python.org> Author: thomas.lee Date: Sun Jul 13 12:26:10 2008 New Revision: 64909 Log: Return injection causing the build to fail. Disabling the code for now, bug needs more investigation. Modified: python/branches/tlee-ast-optimize/Python/optimize.c Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jul 13 12:26:10 2008 @@ -297,6 +297,7 @@ } if (seq == NULL) return 0; + *seq_ptr = seq; } } } @@ -315,6 +316,7 @@ } if (seq == NULL) return 0; + *seq_ptr = seq; } } } @@ -325,6 +327,7 @@ stmt->lineno, stmt->col_offset, opt->opt_arena); if (seq == NULL) return 0; + *seq_ptr = seq; } *seq_ptr = seq; @@ -396,9 +399,8 @@ static int _inject_compound_stmt_return(stmt_ty stmt, stmt_ty next, PyArena* arena) { - /* if the else body is not present, there will be no jump anyway */ - /* XXX: this is breaking string._TemplateMetaclass for some reason */ #if 0 + /* if the else body is not present, there will be no jump anyway */ if (stmt->kind == If_kind && stmt->v.If.orelse != NULL) { stmt_ty inner = asdl_seq_GET(stmt->v.If.body, LAST_IN_SEQ(stmt->v.If.body)); @@ -413,7 +415,6 @@ return 0; } } -#endif /* TODO: we probably want to append a return to all but * the last handler too */ @@ -456,6 +457,7 @@ return 0; } } +#endif return 1; } From python-checkins at python.org Sun Jul 13 14:23:48 2008 From: python-checkins at python.org (nick.coghlan) Date: Sun, 13 Jul 2008 14:23:48 +0200 (CEST) Subject: [Python-checkins] r64910 - in python/trunk: Doc/library/test.rst Lib/test/test_py3kwarn.py Lib/test/test_struct.py Lib/test/test_support.py Lib/test/test_warnings.py Misc/NEWS Message-ID: <20080713122348.73EDC1E4002@bag.python.org> Author: nick.coghlan Date: Sun Jul 13 14:23:47 2008 New Revision: 64910 Log: Make test.test_support.catch_warnings more robust as discussed on python-dev. Also add explicit tests for itto test_warnings. Modified: python/trunk/Doc/library/test.rst python/trunk/Lib/test/test_py3kwarn.py python/trunk/Lib/test/test_struct.py python/trunk/Lib/test/test_support.py python/trunk/Lib/test/test_warnings.py python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/test.rst ============================================================================== --- python/trunk/Doc/library/test.rst (original) +++ python/trunk/Doc/library/test.rst Sun Jul 13 14:23:47 2008 @@ -291,19 +291,34 @@ This will run all tests defined in the named module. -.. function:: catch_warning(record=True) +.. function:: catch_warning(module=warnings, record=True) Return a context manager that guards the warnings filter from being - permanently changed and records the data of the last warning that has been - issued. The ``record`` argument specifies whether any raised warnings are - captured by the object returned by :func:`warnings.catch_warning` or allowed - to propagate as normal. + permanently changed and optionally alters the :func:`showwarning` + function to record the details of any warnings that are issued in the + managed context. Details of the most recent call to :func:`showwarning` + are saved directly on the context manager, while details of previous + warnings can be retrieved from the ``warnings`` list. - The context manager is typically used like this:: + The context manager is used like this:: with catch_warning() as w: + warnings.simplefilter("always") warnings.warn("foo") - assert str(w.message) == "foo" + assert w.last == "foo" + warnings.warn("bar") + assert w.last == "bar" + assert str(w.warnings[0].message) == "foo" + assert str(w.warnings[1].message) == "bar" + + By default, the real :mod:`warnings` module is affected - the ability + to select a different module is provided for the benefit of the + :mod:`warnings` module's own unit tests. + The ``record`` argument specifies whether or not the :func:`showwarning` + function is replaced. Note that recording the warnings in this fashion + also prevents them from being written to sys.stderr. If set to ``False``, + the standard handling of warning messages is left in place (however, the + original handling is still restored at the end of the block). .. versionadded:: 2.6 @@ -334,8 +349,6 @@ attributes on the exception is :exc:`ResourceDenied` raised. .. versionadded:: 2.6 - - .. class:: EnvironmentVarGuard() Class used to temporarily set or unset environment variables. Instances can be @@ -352,3 +365,5 @@ .. method:: EnvironmentVarGuard.unset(envvar) Temporarily unset the environment variable ``envvar``. + + Modified: python/trunk/Lib/test/test_py3kwarn.py ============================================================================== --- python/trunk/Lib/test/test_py3kwarn.py (original) +++ python/trunk/Lib/test/test_py3kwarn.py Sun Jul 13 14:23:47 2008 @@ -26,41 +26,30 @@ with catch_warning() as w: safe_exec("True = False") self.assertWarning(None, w, expected) - with catch_warning() as w: safe_exec("False = True") self.assertWarning(None, w, expected) - with catch_warning() as w: try: safe_exec("obj.False = True") except NameError: pass self.assertWarning(None, w, expected) - with catch_warning() as w: try: safe_exec("obj.True = False") except NameError: pass self.assertWarning(None, w, expected) - with catch_warning() as w: safe_exec("def False(): pass") self.assertWarning(None, w, expected) - with catch_warning() as w: safe_exec("def True(): pass") self.assertWarning(None, w, expected) - with catch_warning() as w: safe_exec("class False: pass") self.assertWarning(None, w, expected) - with catch_warning() as w: safe_exec("class True: pass") self.assertWarning(None, w, expected) - with catch_warning() as w: safe_exec("def f(True=43): pass") self.assertWarning(None, w, expected) - with catch_warning() as w: safe_exec("def f(False=None): pass") self.assertWarning(None, w, expected) - with catch_warning() as w: safe_exec("f(False=True)") self.assertWarning(None, w, expected) - with catch_warning() as w: safe_exec("f(True=1)") self.assertWarning(None, w, expected) @@ -69,25 +58,20 @@ expected = 'type inequality comparisons not supported in 3.x' with catch_warning() as w: self.assertWarning(int < str, w, expected) - with catch_warning() as w: self.assertWarning(type < object, w, expected) def test_object_inequality_comparisons(self): expected = 'comparing unequal types not supported in 3.x' with catch_warning() as w: self.assertWarning(str < [], w, expected) - with catch_warning() as w: self.assertWarning(object() < (1, 2), w, expected) def test_dict_inequality_comparisons(self): expected = 'dict inequality comparisons not supported in 3.x' with catch_warning() as w: self.assertWarning({} < {2:3}, w, expected) - with catch_warning() as w: self.assertWarning({} <= {}, w, expected) - with catch_warning() as w: self.assertWarning({} > {2:3}, w, expected) - with catch_warning() as w: self.assertWarning({2:3} >= {}, w, expected) def test_cell_inequality_comparisons(self): @@ -100,7 +84,6 @@ cell1, = f(1).func_closure with catch_warning() as w: self.assertWarning(cell0 == cell1, w, expected) - with catch_warning() as w: self.assertWarning(cell0 < cell1, w, expected) def test_code_inequality_comparisons(self): @@ -111,11 +94,8 @@ pass with catch_warning() as w: self.assertWarning(f.func_code < g.func_code, w, expected) - with catch_warning() as w: self.assertWarning(f.func_code <= g.func_code, w, expected) - with catch_warning() as w: self.assertWarning(f.func_code >= g.func_code, w, expected) - with catch_warning() as w: self.assertWarning(f.func_code > g.func_code, w, expected) def test_builtin_function_or_method_comparisons(self): @@ -125,11 +105,8 @@ meth = {}.get with catch_warning() as w: self.assertWarning(func < meth, w, expected) - with catch_warning() as w: self.assertWarning(func > meth, w, expected) - with catch_warning() as w: self.assertWarning(meth <= func, w, expected) - with catch_warning() as w: self.assertWarning(meth >= func, w, expected) def assertWarning(self, _, warning, expected_message): @@ -142,11 +119,8 @@ with catch_warning() as w: self.assertWarning(lst.sort(cmp=cmp), w, expected) - with catch_warning() as w: self.assertWarning(sorted(lst, cmp=cmp), w, expected) - with catch_warning() as w: self.assertWarning(lst.sort(cmp), w, expected) - with catch_warning() as w: self.assertWarning(sorted(lst, cmp), w, expected) def test_sys_exc_clear(self): @@ -229,7 +203,7 @@ """Make sure the specified module, when imported, raises a DeprecationWarning and specifies itself in the message.""" with CleanImport(module_name): - with catch_warning(record=False) as w: + with catch_warning(record=False): warnings.filterwarnings("error", ".+ removed", DeprecationWarning) try: @@ -290,7 +264,7 @@ def test_main(): - with catch_warning(record=True): + with catch_warning(): warnings.simplefilter("always") run_unittest(TestPy3KWarnings, TestStdlibRemovals) Modified: python/trunk/Lib/test/test_struct.py ============================================================================== --- python/trunk/Lib/test/test_struct.py (original) +++ python/trunk/Lib/test/test_struct.py Sun Jul 13 14:23:47 2008 @@ -35,12 +35,9 @@ @wraps(func) def decorator(*args, **kw): with catch_warning(): - # Grrr, we need this function to warn every time. Without removing - # the warningregistry, running test_tarfile then test_struct would fail - # on 64-bit platforms. - globals = func.func_globals - if '__warningregistry__' in globals: - del globals['__warningregistry__'] + # We need this function to warn every time, so stick an + # unqualifed 'always' at the head of the filter list + warnings.simplefilter("always") warnings.filterwarnings("error", category=DeprecationWarning) return func(*args, **kw) return decorator @@ -53,7 +50,7 @@ pass except DeprecationWarning: if not PY_STRUCT_OVERFLOW_MASKING: - raise TestFailed, "%s%s expected to raise struct.error" % ( + raise TestFailed, "%s%s expected to raise DeprecationWarning" % ( func.__name__, args) else: raise TestFailed, "%s%s did not raise error" % ( Modified: python/trunk/Lib/test/test_support.py ============================================================================== --- python/trunk/Lib/test/test_support.py (original) +++ python/trunk/Lib/test/test_support.py Sun Jul 13 14:23:47 2008 @@ -383,36 +383,49 @@ class WarningMessage(object): - "Holds the result of the latest showwarning() call" + "Holds the result of a single showwarning() call" + _WARNING_DETAILS = "message category filename lineno line".split() + def __init__(self, message, category, filename, lineno, line=None): + for attr in self._WARNING_DETAILS: + setattr(self, attr, locals()[attr]) + self._category_name = category.__name__ if category else None + + def __str__(self): + return ("{message : %r, category : %r, filename : %r, lineno : %s, " + "line : %r}" % (self.message, self._category_name, + self.filename, self.lineno, self.line)) + +class WarningRecorder(object): + "Records the result of any showwarning calls" def __init__(self): - self.message = None - self.category = None - self.filename = None - self.lineno = None - - def _showwarning(self, message, category, filename, lineno, file=None, - line=None): - self.message = message - self.category = category - self.filename = filename - self.lineno = lineno - self.line = line + self.warnings = [] + self._set_last(None) + + def _showwarning(self, message, category, filename, lineno, + file=None, line=None): + wm = WarningMessage(message, category, filename, lineno, line) + self.warnings.append(wm) + self._set_last(wm) + + def _set_last(self, last_warning): + if last_warning is None: + for attr in WarningMessage._WARNING_DETAILS: + setattr(self, attr, None) + else: + for attr in WarningMessage._WARNING_DETAILS: + setattr(self, attr, getattr(last_warning, attr)) def reset(self): - self._showwarning(*((None,)*6)) + self.warnings = [] + self._set_last(None) def __str__(self): - return ("{message : %r, category : %r, filename : %r, lineno : %s, " - "line : %r}" % (self.message, - self.category.__name__ if self.category else None, - self.filename, self.lineno, self.line)) - + return '[%s]' % (', '.join(map(str, self.warnings))) @contextlib.contextmanager def catch_warning(module=warnings, record=True): - """ - Guard the warnings filter from being permanently changed and record the - data of the last warning that has been issued. + """Guard the warnings filter from being permanently changed and + optionally record the details of any warnings that are issued. Use like this: @@ -420,13 +433,17 @@ warnings.warn("foo") assert str(w.message) == "foo" """ - original_filters = module.filters[:] + original_filters = module.filters original_showwarning = module.showwarning if record: - warning_obj = WarningMessage() - module.showwarning = warning_obj._showwarning + recorder = WarningRecorder() + module.showwarning = recorder._showwarning + else: + recorder = None try: - yield warning_obj if record else None + # Replace the filters with a copy of the original + module.filters = module.filters[:] + yield recorder finally: module.showwarning = original_showwarning module.filters = original_filters @@ -436,7 +453,7 @@ """Context manager to force import to return a new module reference. This is useful for testing module-level behaviours, such as - the emission of a DepreciationWarning on import. + the emission of a DeprecationWarning on import. Use like this: Modified: python/trunk/Lib/test/test_warnings.py ============================================================================== --- python/trunk/Lib/test/test_warnings.py (original) +++ python/trunk/Lib/test/test_warnings.py Sun Jul 13 14:23:47 2008 @@ -488,6 +488,49 @@ module = py_warnings + +class WarningsSupportTests(object): + """Test the warning tools from test support module""" + + def test_catch_warning_restore(self): + wmod = self.module + orig_filters = wmod.filters + orig_showwarning = wmod.showwarning + with test_support.catch_warning(wmod): + wmod.filters = wmod.showwarning = object() + self.assert_(wmod.filters is orig_filters) + self.assert_(wmod.showwarning is orig_showwarning) + with test_support.catch_warning(wmod, record=False): + wmod.filters = wmod.showwarning = object() + self.assert_(wmod.filters is orig_filters) + self.assert_(wmod.showwarning is orig_showwarning) + + def test_catch_warning_recording(self): + wmod = self.module + with test_support.catch_warning(wmod) as w: + self.assertEqual(w.warnings, []) + wmod.simplefilter("always") + wmod.warn("foo") + self.assertEqual(str(w.message), "foo") + wmod.warn("bar") + self.assertEqual(str(w.message), "bar") + self.assertEqual(str(w.warnings[0].message), "foo") + self.assertEqual(str(w.warnings[1].message), "bar") + w.reset() + self.assertEqual(w.warnings, []) + orig_showwarning = wmod.showwarning + with test_support.catch_warning(wmod, record=False) as w: + self.assert_(w is None) + self.assert_(wmod.showwarning is orig_showwarning) + + +class CWarningsSupportTests(BaseTest, WarningsSupportTests): + module = c_warnings + +class PyWarningsSupportTests(BaseTest, WarningsSupportTests): + module = py_warnings + + class ShowwarningDeprecationTests(BaseTest): """Test the deprecation of the old warnings.showwarning() API works.""" @@ -513,7 +556,6 @@ module = py_warnings - def test_main(): py_warnings.onceregistry.clear() c_warnings.onceregistry.clear() @@ -524,6 +566,7 @@ CWCmdLineTests, PyWCmdLineTests, _WarningsTests, CWarningsDisplayTests, PyWarningsDisplayTests, + CWarningsSupportTests, PyWarningsSupportTests, CShowwarningDeprecationTests, PyShowwarningDeprecationTests, ) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jul 13 14:23:47 2008 @@ -82,6 +82,14 @@ redundant ":443" port number designation when the connection is using the default https port (443). +Tests +----- + +- test.test_support.catch_warning now keeps track of all warnings it sees + and is now better documented. Explicit unit tests for this context manager + have been added to test_warnings. + + Build ----- From buildbot at python.org Sun Jul 13 14:31:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 13 Jul 2008 12:31:53 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080713123153.B4AC01E4002@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/757 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: nick.coghlan BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sun Jul 13 14:36:43 2008 From: python-checkins at python.org (nick.coghlan) Date: Sun, 13 Jul 2008 14:36:43 +0200 (CEST) Subject: [Python-checkins] r64913 - python/trunk/Doc/library/test.rst Message-ID: <20080713123643.43B601E4002@bag.python.org> Author: nick.coghlan Date: Sun Jul 13 14:36:42 2008 New Revision: 64913 Log: Correct a couple of errors in the updated catch_warning documentation (the Py3k version was fixed before being checked in) Modified: python/trunk/Doc/library/test.rst Modified: python/trunk/Doc/library/test.rst ============================================================================== --- python/trunk/Doc/library/test.rst (original) +++ python/trunk/Doc/library/test.rst Sun Jul 13 14:36:42 2008 @@ -305,9 +305,9 @@ with catch_warning() as w: warnings.simplefilter("always") warnings.warn("foo") - assert w.last == "foo" + assert str(w.message) == "foo" warnings.warn("bar") - assert w.last == "bar" + assert str(w.message) == "bar" assert str(w.warnings[0].message) == "foo" assert str(w.warnings[1].message) == "bar" From buildbot at python.org Sun Jul 13 15:27:34 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 13 Jul 2008 13:27:34 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080713132734.E16321E4002@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/436 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon,nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jul 13 16:52:37 2008 From: python-checkins at python.org (nick.coghlan) Date: Sun, 13 Jul 2008 16:52:37 +0200 (CEST) Subject: [Python-checkins] r64915 - in python/trunk: Lib/test/test_import.py Misc/NEWS Python/import.c Message-ID: <20080713145237.1AA5C1E4002@bag.python.org> Author: nick.coghlan Date: Sun Jul 13 16:52:36 2008 New Revision: 64915 Log: Fix issue 3221 by emitting a RuntimeWarning instead of raising SystemError when the parent module can't be found during an absolute import (likely due to non-PEP 361 aware code which sets a module level __package__ attribute) Modified: python/trunk/Lib/test/test_import.py python/trunk/Misc/NEWS python/trunk/Python/import.c Modified: python/trunk/Lib/test/test_import.py ============================================================================== --- python/trunk/Lib/test/test_import.py (original) +++ python/trunk/Lib/test/test_import.py Sun Jul 13 16:52:36 2008 @@ -1,5 +1,3 @@ -from test.test_support import TESTFN, run_unittest, catch_warning - import unittest import os import random @@ -7,7 +5,7 @@ import sys import py_compile import warnings -from test.test_support import unlink, TESTFN, unload +from test.test_support import unlink, TESTFN, unload, run_unittest, catch_warning def remove_files(name): @@ -266,6 +264,38 @@ from . import relimport self.assertTrue(hasattr(relimport, "RelativeImport")) + def test_issue3221(self): + def check_absolute(): + exec "from os import path" in ns + def check_relative(): + exec "from . import relimport" in ns + # Check both OK with __package__ and __name__ correct + ns = dict(__package__='test', __name__='test.notarealmodule') + check_absolute() + check_relative() + # Check both OK with only __name__ wrong + ns = dict(__package__='test', __name__='notarealpkg.notarealmodule') + check_absolute() + check_relative() + # Check relative fails with only __package__ wrong + ns = dict(__package__='foo', __name__='test.notarealmodule') + with catch_warning() as w: + check_absolute() + self.assert_('foo' in str(w.message)) + self.assertEqual(w.category, RuntimeWarning) + self.assertRaises(SystemError, check_relative) + # Check relative fails with __package__ and __name__ wrong + ns = dict(__package__='foo', __name__='notarealpkg.notarealmodule') + with catch_warning() as w: + check_absolute() + self.assert_('foo' in str(w.message)) + self.assertEqual(w.category, RuntimeWarning) + self.assertRaises(SystemError, check_relative) + # Check both fail with package set to a non-string + ns = dict(__package__=object()) + self.assertRaises(ValueError, check_absolute) + self.assertRaises(ValueError, check_relative) + def test_main(verbose=None): run_unittest(ImportTest, PathsTests, RelativeImport) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jul 13 16:52:36 2008 @@ -10,6 +10,12 @@ Core and Builtins ----------------- +- Issue #3221: Issue a RuntimeWarning instead of raising SystemError if + the parent module cannot be found while performing an absolute import. + This means that an incorrectly defined __package__ attribute will + now only prevent relative imports in that module rather than causing + all imports from that module to fail. + - Issue #2517: Allow unicode messages in Exceptions again by correctly bypassing the instance dictionary when looking up __unicode__ on new-style classes. Modified: python/trunk/Python/import.c ============================================================================== --- python/trunk/Python/import.c (original) +++ python/trunk/Python/import.c Sun Jul 13 16:52:36 2008 @@ -2160,6 +2160,7 @@ static PyObject *pathstr = NULL; static PyObject *pkgstr = NULL; PyObject *pkgname, *modname, *modpath, *modules, *parent; + int orig_level = level; if (globals == NULL || !PyDict_Check(globals) || !level) return Py_None; @@ -2285,9 +2286,27 @@ modules = PyImport_GetModuleDict(); parent = PyDict_GetItemString(modules, buf); - if (parent == NULL) - PyErr_Format(PyExc_SystemError, - "Parent module '%.200s' not loaded", buf); + if (parent == NULL) { + if (orig_level < 1) { + PyObject *err_msg = PyString_FromFormat( + "Parent module '%.200s' not found " + "while handling absolute import", buf); + if (err_msg == NULL) { + return NULL; + } + if (!PyErr_WarnEx(PyExc_RuntimeWarning, + PyString_AsString(err_msg), 1)) { + *buf = '\0'; + *p_buflen = 0; + parent = Py_None; + } + Py_DECREF(err_msg); + } else { + PyErr_Format(PyExc_SystemError, + "Parent module '%.200s' not loaded, " + "cannot perform relative import", buf); + } + } return parent; /* We expect, but can't guarantee, if parent != None, that: - parent.__name__ == buf From python-checkins at python.org Sun Jul 13 17:11:55 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 13 Jul 2008 17:11:55 +0200 (CEST) Subject: [Python-checkins] r64916 - python/branches/tlee-ast-optimize/Python/optimize.c Message-ID: <20080713151155.1FF471E4002@bag.python.org> Author: thomas.lee Date: Sun Jul 13 17:11:54 2008 New Revision: 64916 Log: Include a hack for jump injection that doesn't break quite so many tests. Need to fix lnotab breakage due to if/else swappage (and possibly other optimizations). Modified: python/branches/tlee-ast-optimize/Python/optimize.c Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jul 13 17:11:54 2008 @@ -6,6 +6,8 @@ #include "node.h" #include "ast.h" +#define NEXTLINE(lineno) (lineno+1) + typedef struct _optimizer_block { struct _optimizer_block* b_next; /* next block on the stack */ PySTEntryObject* b_ste; /* symtable entry */ @@ -258,7 +260,7 @@ asdl_seq* seq = *seq_ptr; stmt_ty stmt = asdl_seq_GET(seq, n); - /* eliminate unreachable branches in an "if" statement? */ + /* eliminate unreachable branches in an "if" statement */ if (stmt->kind == If_kind) { PyObject* test = _expr_constant_value(stmt->v.If.test); if (test != NULL) { @@ -376,13 +378,14 @@ if (retseq == NULL) return NULL; last = asdl_seq_GET(seq, asdl_seq_LEN(seq)-1); - ret = Return(value, last->lineno, last->col_offset, arena); + ret = Return(value, NEXTLINE(last->lineno), last->col_offset, arena); if (ret == NULL) return NULL; asdl_seq_SET(retseq, 0, ret); return _asdl_seq_append(seq, 0, retseq, 0, arena); } +#if 0 static void _expr_incref(expr_ty expr) { @@ -395,19 +398,21 @@ Py_INCREF(expr->v.Const.value); } } +#endif static int _inject_compound_stmt_return(stmt_ty stmt, stmt_ty next, PyArena* arena) { -#if 0 + expr_ty value = NULL; + if (next != NULL) + value = next->v.Return.value; + /* if the else body is not present, there will be no jump anyway */ if (stmt->kind == If_kind && stmt->v.If.orelse != NULL) { stmt_ty inner = asdl_seq_GET(stmt->v.If.body, LAST_IN_SEQ(stmt->v.If.body)); if (inner->kind != Return_kind) { - expr_ty value = next->v.Return.value; - _expr_incref(value); stmt->v.If.body = _asdl_seq_append_return(stmt->v.If.body, value, arena); @@ -422,8 +427,6 @@ stmt_ty inner = asdl_seq_GET(stmt->v.TryExcept.body, LAST_IN_SEQ(stmt->v.TryExcept.body)); if (inner->kind != Return_kind && inner->kind != Raise_kind) { - expr_ty value = next->v.Return.value; - _expr_incref(value); /* if we inject a return into the "try" body of a * "try..except..else", we will miss the "else"! * We need to take a different path if the "else" is @@ -449,15 +452,12 @@ stmt_ty inner = asdl_seq_GET(stmt->v.TryFinally.body, LAST_IN_SEQ(stmt->v.TryFinally.body)); if (inner->kind != Return_kind && inner->kind != Raise_kind) { - expr_ty value = next->v.Return.value; - _expr_incref(value); stmt->v.TryFinally.body = _asdl_seq_append_return(stmt->v.TryFinally.body, value, arena); if (stmt->v.TryFinally.body == NULL) return 0; } } -#endif return 1; } @@ -467,32 +467,19 @@ * they immediately return rather than jump. */ static int -_simplify_jumps(optimizer* opt, asdl_seq* seq) +_simplify_jumps(optimizer* opt, asdl_seq* seq, int top) { int n, len; len = asdl_seq_LEN(seq); for (n = 0; n < len; n++) { - stmt_ty stmt; - stmt_ty next; - - stmt = asdl_seq_GET(seq, n); - - /* on the last iteration, the target is an implicit `return None' */ - if (n == len-1) { - /* if a "return" is already present, we have nothing left to do */ - if (stmt->kind == Return_kind) - break; - - next = Return(NULL, stmt->lineno, stmt->col_offset, opt->opt_arena); - if (next == NULL) - return 0; - } - else + stmt_ty stmt = asdl_seq_GET(seq, n); + stmt_ty next = NULL; + if (n < len-1) next = asdl_seq_GET(seq, n+1); - - if (next->kind == Return_kind) + /* XXX: handle the implicit return only if top-level function seq */ + if ((top && next == NULL) || (next && next->kind == Return_kind)) if (!_inject_compound_stmt_return(stmt, next, opt->opt_arena)) return 0; } @@ -515,7 +502,7 @@ if (!_eliminate_unreachable_code(opt, seq_ptr, n)) return 0; if (opt->opt_current->b_ste->ste_type == FunctionBlock) - if (!_simplify_jumps(opt, *seq_ptr)) + if (!_simplify_jumps(opt, *seq_ptr, 0)) return 0; } return 1; @@ -1166,15 +1153,43 @@ } static int +_contains_return(asdl_seq* seq) +{ + int i; + int len = asdl_seq_LEN(seq); + for (i = 0; i < len; i++) + if (((stmt_ty)asdl_seq_GET(seq, i))->kind == Return_kind) + return 1; + return 0; +} + +static int optimize_function_def(optimizer* opt, stmt_ty* stmt_ptr) { stmt_ty stmt = *stmt_ptr; + + /* XXX: this breaks a bunch of tests. For now we use a second pass. */ +#if 0 + /* Make any implicit returns explicit */ + if (!_contains_return(stmt->v.FunctionDef.body)) { + stmt->v.FunctionDef.body = + _asdl_seq_append_return(stmt->v.FunctionDef.body, NULL, + opt->opt_arena); + if (stmt->v.FunctionDef.body == NULL) + return 0; + } +#endif + if (!optimize_arguments(opt, &stmt->v.FunctionDef.args)) return 0; if (!optimize_expr_seq(opt, &stmt->v.FunctionDef.decorator_list)) return 0; if (!optimize_stmt_seq(opt, &stmt->v.FunctionDef.body)) return 0; + /* XXX: shallow second pass for implicit returns */ + if (!_contains_return(stmt->v.FunctionDef.body)) + if (!_simplify_jumps(opt, stmt->v.FunctionDef.body, 1)) + return 0; return 1; } From python-checkins at python.org Sun Jul 13 17:16:37 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 13 Jul 2008 17:16:37 +0200 (CEST) Subject: [Python-checkins] r64917 - python/branches/tlee-ast-optimize/Python/optimize.c Message-ID: <20080713151637.0997F1E4014@bag.python.org> Author: thomas.lee Date: Sun Jul 13 17:16:36 2008 New Revision: 64917 Log: Added a comment describing the if/else translation for tests with a unary not. Modified: python/branches/tlee-ast-optimize/Python/optimize.c Modified: python/branches/tlee-ast-optimize/Python/optimize.c ============================================================================== --- python/branches/tlee-ast-optimize/Python/optimize.c (original) +++ python/branches/tlee-ast-optimize/Python/optimize.c Sun Jul 13 17:16:36 2008 @@ -1314,6 +1314,9 @@ if (!optimize_stmt_seq(opt, &stmt->v.If.orelse)) return 0; + /* BEFORE: if not : ; else: + * AFTER: if : ; else: + */ if (stmt->v.If.test->kind == UnaryOp_kind && stmt->v.If.test->v.UnaryOp.op == Not) { asdl_seq* body = stmt->v.If.orelse; From python-checkins at python.org Sun Jul 13 20:10:22 2008 From: python-checkins at python.org (andrew.kuchling) Date: Sun, 13 Jul 2008 20:10:22 +0200 (CEST) Subject: [Python-checkins] r64919 - peps/trunk/pep-0361.txt Message-ID: <20080713181022.B60B11E4002@bag.python.org> Author: andrew.kuchling Date: Sun Jul 13 20:10:22 2008 New Revision: 64919 Log: Update date Modified: peps/trunk/pep-0361.txt Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Sun Jul 13 20:10:22 2008 @@ -20,7 +20,7 @@ There will be at least two alpha releases, two beta releases, and one release candidate. The release date is planned for the - beginning of September, 2008. + beginning of October, 2008. Python 2.6 is not only the next advancement in the Python 2 series, it is also a transitional release, helping developers From python-checkins at python.org Sun Jul 13 20:25:13 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 13 Jul 2008 20:25:13 +0200 (CEST) Subject: [Python-checkins] r64920 - python/trunk/Lib/test/test_multiprocessing.py Message-ID: <20080713182513.C60EE1E4002@bag.python.org> Author: benjamin.peterson Date: Sun Jul 13 20:25:13 2008 New Revision: 64920 Log: remove bytes alias Modified: python/trunk/Lib/test/test_multiprocessing.py Modified: python/trunk/Lib/test/test_multiprocessing.py ============================================================================== --- python/trunk/Lib/test/test_multiprocessing.py (original) +++ python/trunk/Lib/test/test_multiprocessing.py Sun Jul 13 20:25:13 2008 @@ -38,13 +38,6 @@ else: latin = str -try: - bytes -except NameError: - bytes = str - def bytearray(seq): - return array.array('c', seq) - # # Constants # From buildbot at python.org Sun Jul 13 20:33:21 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 13 Jul 2008 18:33:21 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20080713183322.15EEF1E4002@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%20trunk/builds/759 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sun Jul 13 20:34:58 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 13 Jul 2008 20:34:58 +0200 (CEST) Subject: [Python-checkins] r64922 - python/trunk/Lib/test/test_multiprocessing.py Message-ID: <20080713183458.EA6C81E4002@bag.python.org> Author: benjamin.peterson Date: Sun Jul 13 20:34:58 2008 New Revision: 64922 Log: remove sys.version_info check for 3.0 Modified: python/trunk/Lib/test/test_multiprocessing.py Modified: python/trunk/Lib/test/test_multiprocessing.py ============================================================================== --- python/trunk/Lib/test/test_multiprocessing.py (original) +++ python/trunk/Lib/test/test_multiprocessing.py Sun Jul 13 20:34:58 2008 @@ -32,11 +32,7 @@ # # -if sys.version_info >= (3, 0): - def latin(s): - return s.encode('latin') -else: - latin = str +latin = str # # Constants From buildbot at python.org Sun Jul 13 21:04:16 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 13 Jul 2008 19:04:16 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20080713190416.701541E4009@bag.python.org> The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/1314 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: 8 tests failed: test_bsddb3 test_ctypes test_lib2to3 test_multiprocessing test_site test_ssl test_subprocess test_wsgiref ====================================================================== ERROR: test01_badpointer (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 33, in test01_badpointer dbs = dbshelve.open(self.filename) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\dbshelve.py", line 91, in open d.open(filename, dbname, filetype, flags, mode) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\dbshelve.py", line 152, in open self.db.open(*args, **kwargs) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test03_repr_closed_db (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 45, in test03_repr_closed_db db = hashopen(self.filename) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\__init__.py", line 324, in hashopen d.open(file, db.DB_HASH, flags, mode) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test04_double_free_make_key_dbt (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 68, in test04_double_free_make_key_dbt os.unlink(self.filename) WindowsError: [Error 2] The system cannot find the file specified: 'MiscTestCase.db' ====================================================================== ERROR: test05_key_with_null_bytes (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 87, in test05_key_with_null_bytes os.unlink(self.filename) WindowsError: [Error 2] The system cannot find the file specified: 'MiscTestCase.db' ====================================================================== ERROR: test_DB_set_flags_persists (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 115, in test_DB_set_flags_persists os.unlink(self.filename) WindowsError: [Error 2] The system cannot find the file specified: 'MiscTestCase.db' ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 101, in setUp self.assertTrue(time.time()= 0.1) AssertionError ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 19, in dumps return pickle.dumps(item) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest_1) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 71, in dumps return pickle.dumps(item, 1) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== ERROR: test_simple (ctypes.test.test_pickling.PickleTest_2) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 29, in test_simple dst = self.loads(self.dumps(src)) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ctypes\test\test_pickling.py", line 75, in dumps return pickle.dumps(item, 2) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 224, in dump self.save(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\pickle.py", line 301, in save rv = reduce(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\sharedctypes.py", line 121, in reduce_ctype assert_spawning(obj) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\multiprocessing\forking.py", line 25, in assert_spawning ' through inheritance' % type(self).__name__ RuntimeError: c_long objects should only be shared between processes through inheritance ====================================================================== FAIL: test_from_import_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1485, in test_from_import_usage self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nfrom builtins import print\nfoo(print, print())\n\n\n' != 'None' ====================================================================== FAIL: test_import_from (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1427, in test_import_from self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print\n\n' != 'None' ====================================================================== FAIL: test_import_from_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1454, in test_import_from_as self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'from builtins import print as foo_bar\n\n' != 'None' ====================================================================== FAIL: test_import_module (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1416, in test_import_module self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support\n\n' != 'import test.test_support\n\n' ====================================================================== FAIL: test_import_module_as (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1443, in test_import_module_as self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: 'import test.support as foo_bar\n\n' != 'import test.test_support as foo_bar\n\n' ====================================================================== FAIL: test_import_module_usage (lib2to3.tests.test_fixers.Test_imports) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 1472, in test_import_module_usage self.check(b, a) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 50, in check tree = self._check(before, after) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\lib2to3\tests\test_fixers.py", line 46, in _check self.failUnlessEqual(after, str(tree)) AssertionError: '\nimport builtins\nfoo(builtins, builtins.print)\n\n\n' != 'None' ====================================================================== ERROR: test_s_option (test.test_site.HelperFunctionsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_site.py", line 115, in test_s_option env=env) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 444, in call return Popen(*popenargs, **kwargs).wait() File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 595, in __init__ errread, errwrite) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 817, in _execute_child startupinfo) TypeError: environment can only contain strings ====================================================================== ERROR: testWrongCert (test.test_ssl.ThreadedTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_ssl.py", line 807, in testWrongCert "wrongcert.pem")) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_ssl.py", line 597, in badCertTest s.connect((HOST, server.port)) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ssl.py", line 272, in connect self.do_handshake() File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\ssl.py", line 256, in do_handshake self._sslobj.do_handshake() error: [Errno 10054] An existing connection was forcibly closed by the remote host ====================================================================== ERROR: test_call_kwargs (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_subprocess.py", line 82, in test_call_kwargs env=newenv) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 444, in call return Popen(*popenargs, **kwargs).wait() File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 595, in __init__ errread, errwrite) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 817, in _execute_child startupinfo) TypeError: environment can only contain strings ====================================================================== ERROR: test_env (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_subprocess.py", line 266, in test_env env=newenv) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 595, in __init__ errread, errwrite) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 817, in _execute_child startupinfo) TypeError: environment can only contain strings ====================================================================== ERROR: test_shell_sequence (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_subprocess.py", line 677, in test_shell_sequence env=newenv) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 595, in __init__ errread, errwrite) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 817, in _execute_child startupinfo) TypeError: environment can only contain strings ====================================================================== ERROR: test_shell_string (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_subprocess.py", line 686, in test_shell_string env=newenv) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 595, in __init__ errread, errwrite) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\subprocess.py", line 817, in _execute_child startupinfo) TypeError: environment can only contain strings ====================================================================== ERROR: testEnviron (test.test_wsgiref.HandlerTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_wsgiref.py", line 437, in testEnviron self.checkOSEnviron(h) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_wsgiref.py", line 429, in checkOSEnviron self.assertEqual(env[k],v) KeyError: 'TCL_LIBRARY' ====================================================================== FAIL: test_simple_validation_error (test.test_wsgiref.IntegrationTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_wsgiref.py", line 157, in test_simple_validation_error "AssertionError: Headers (('Content-Type', 'text/plain')) must" AssertionError: "AssertionError: Environmental variable LIB is not a string: (value: u'C:\\\\Program Files\\\\Microsoft Visual Studio 9.0\\\\VC\\\\LIB;C:\\\\Program Files\\\\Microsoft SDKs\\\\Windows\\\\v6.0A\\\\lib;c:\\\\program files\\\\microsoft visual studio .NET 2003\\\\vc7\\\\atlmfc\\\\lib;c:\\\\program files\\\\microsoft visual studio .NET 2003\\\\vc7\\\\lib;c:\\\\program files\\\\microsoft visual studio .NET 2003\\\\vc7\\\\PlatformSDK\\\\lib;C:\\\\Program Files\\\\Microsoft Visual Studio .NET 2003\\\\SDK\\\\v1.1\\\\Lib\\\\')" != "AssertionError: Headers (('Content-Type', 'text/plain')) must be of type list: " ====================================================================== FAIL: test_validated_hello (test.test_wsgiref.IntegrationTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_wsgiref.py", line 145, in test_validated_hello self.check_hello(out, has_length=False) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_wsgiref.py", line 134, in check_hello "\r\n" AssertionError: 'HTTP/1.0 500 Dude, this is whack!\r\nDate: Sun, 13 Jul 2008 18:56:59 GMT\r\nServer: WSGIServer/0.1 Python/2.6b1+\r\nContent-Type: text/plain\r\nContent-Length: 59\r\n\r\nA server error occurred. Please contact the administrator.' != 'HTTP/1.0 200 OK\r\nServer: WSGIServer/0.1 Python/2.6b1+\r\nContent-Type: text/plain\r\nDate: Mon, 05 Jun 2006 18:49:54 GMT\r\n\r\nHello, world!' sincerely, -The Buildbot From buildbot at python.org Sun Jul 13 22:27:29 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 13 Jul 2008 20:27:29 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20080713202729.93C6C1E4002@bag.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.0/builds/261 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_doctest test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jul 13 22:31:49 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 13 Jul 2008 22:31:49 +0200 (CEST) Subject: [Python-checkins] r64926 - python/trunk/Doc/library/turtle.rst Message-ID: <20080713203149.8E4CB1E4019@bag.python.org> Author: martin.v.loewis Date: Sun Jul 13 22:31:49 2008 New Revision: 64926 Log: Add turtle into the module index. Modified: python/trunk/Doc/library/turtle.rst Modified: python/trunk/Doc/library/turtle.rst ============================================================================== --- python/trunk/Doc/library/turtle.rst (original) +++ python/trunk/Doc/library/turtle.rst Sun Jul 13 22:31:49 2008 @@ -2,6 +2,10 @@ :mod:`turtle` --- Turtle graphics for Tk ======================================== +.. module:: turtle + :synopsis: Turtle graphics for Tk +.. sectionauthor:: Gregor Lingl + Introduction ============ From python-checkins at python.org Sun Jul 13 22:42:45 2008 From: python-checkins at python.org (alexandre.vassalotti) Date: Sun, 13 Jul 2008 22:42:45 +0200 (CEST) Subject: [Python-checkins] r64927 - python/trunk/Include/object.h Message-ID: <20080713204245.228B41E4007@bag.python.org> Author: alexandre.vassalotti Date: Sun Jul 13 22:42:44 2008 New Revision: 64927 Log: Issue #3274: Use a less common identifier for the temporary variable in Py_CLEAR(). Modified: python/trunk/Include/object.h Modified: python/trunk/Include/object.h ============================================================================== --- python/trunk/Include/object.h (original) +++ python/trunk/Include/object.h Sun Jul 13 22:42:44 2008 @@ -773,9 +773,9 @@ #define Py_CLEAR(op) \ do { \ if (op) { \ - PyObject *tmp = (PyObject *)(op); \ + PyObject *_py_tmp = (PyObject *)(op); \ (op) = NULL; \ - Py_DECREF(tmp); \ + Py_DECREF(_py_tmp); \ } \ } while (0) From python-checkins at python.org Sun Jul 13 23:43:26 2008 From: python-checkins at python.org (andrew.kuchling) Date: Sun, 13 Jul 2008 23:43:26 +0200 (CEST) Subject: [Python-checkins] r64928 - python/trunk/Doc/library/ctypes.rst Message-ID: <20080713214326.386A41E4002@bag.python.org> Author: andrew.kuchling Date: Sun Jul 13 23:43:25 2008 New Revision: 64928 Log: Re-word Modified: python/trunk/Doc/library/ctypes.rst Modified: python/trunk/Doc/library/ctypes.rst ============================================================================== --- python/trunk/Doc/library/ctypes.rst (original) +++ python/trunk/Doc/library/ctypes.rst Sun Jul 13 23:43:25 2008 @@ -1791,8 +1791,8 @@ .. function:: byref(obj[, offset]) Returns a light-weight pointer to ``obj``, which must be an - instance of a ctypes type. ``offset`` defaults to zero, it must be - an integer which is added to the internal pointer value. + instance of a ctypes type. ``offset`` defaults to zero, and must be + an integer that will be added to the internal pointer value. ``byref(obj, offset)`` corresponds to this C code:: From python-checkins at python.org Sun Jul 13 23:43:52 2008 From: python-checkins at python.org (andrew.kuchling) Date: Sun, 13 Jul 2008 23:43:52 +0200 (CEST) Subject: [Python-checkins] r64929 - python/trunk/Doc/whatsnew/2.6.rst Message-ID: <20080713214352.CECC61E4002@bag.python.org> Author: andrew.kuchling Date: Sun Jul 13 23:43:52 2008 New Revision: 64929 Log: Add various items; move ctypes items into a subsection of their own Modified: python/trunk/Doc/whatsnew/2.6.rst Modified: python/trunk/Doc/whatsnew/2.6.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.6.rst (original) +++ python/trunk/Doc/whatsnew/2.6.rst Sun Jul 13 23:43:52 2008 @@ -51,7 +51,7 @@ This article explains the new features in Python 2.6. The release schedule is described in :pep:`361`; currently the final release is -scheduled for September 3 2008. +scheduled for October 1 2008. This article doesn't attempt to provide a complete specification of the new features, but instead provides a convenient overview. For @@ -1770,21 +1770,6 @@ (Contributed by Raymond Hettinger.) -* XXX Describe the new ctypes calling convention that allows safe - access to errno. - (Implemented by Thomas Heller; :issue:`1798`.) - -* The :mod:`ctypes` module now supports a :class:`c_bool` datatype - that represents the C99 ``bool`` type. (Contributed by David Remahl; - :issue:`1649190`.) - - The :mod:`ctypes` string, buffer and array types also have improved - support for extended slicing syntax, - where various combinations of ``(start, stop, step)`` are supplied. - (Implemented by Thomas Wouters.) - - .. Revision 57769 - * A new method in the :mod:`curses` module: for a window, :meth:`chgat` changes the display characters for a certain number of characters on a single line. (Contributed by Fabian Kreutz.) @@ -2623,6 +2608,45 @@ .. ====================================================================== +ctypes Enhancements +-------------------------------------------------- + +Thomas Heller continued to maintain and enhance the +:mod:`ctypes` module. + +:mod:`ctypes` now supports a :class:`c_bool` datatype +that represents the C99 ``bool`` type. (Contributed by David Remahl; +:issue:`1649190`.) + +The :mod:`ctypes` string, buffer and array types have improved +support for extended slicing syntax, +where various combinations of ``(start, stop, step)`` are supplied. +(Implemented by Thomas Wouters.) + +.. Revision 57769 + +A new calling convention tells :mod:`ctypes` to clear the ``errno`` or +Win32 LastError variables at the outset of each wrapped call. +(Implemented by Thomas Heller; :issue:`1798`.) + +For the Unix ``errno`` variable: when creating a wrapped function, +you can supply ``use_errno=True`` as a keyword parameter +to the :func:`DLL` function +and then call the module-level methods :meth:`set_errno` +and :meth:`get_errno` to set and retrieve the error value. + +The Win32 LastError variable is supported similarly by +the :func:`DLL`, :func:`OleDLL`, and :func:`WinDLL` functions. +You supply ``use_last_error=True`` as a keyword parameter +and then call the module-level methods :meth:`set_last_error` +and :meth:`get_last_error`. + +The :func:`byref` function, used to retrieve a pointer to a ctypes +instance, now has an optional **offset** parameter that is a byte +count that will be added to the returned pointer. + +.. ====================================================================== + Improved SSL Support -------------------------------------------------- From buildbot at python.org Sun Jul 13 23:46:28 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 13 Jul 2008 21:46:28 +0000 Subject: [Python-checkins] buildbot failure in alpha Tru64 5.1 3.0 Message-ID: <20080713214628.991B01E4002@bag.python.org> The Buildbot has detected a new failure of alpha Tru64 5.1 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/alpha%20Tru64%205.1%203.0/builds/1238 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-tru64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: alexandre.vassalotti,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sun Jul 13 23:47:59 2008 From: python-checkins at python.org (alexandre.vassalotti) Date: Sun, 13 Jul 2008 23:47:59 +0200 (CEST) Subject: [Python-checkins] r64930 - in python/trunk/Modules/_sqlite: connection.c cursor.c Message-ID: <20080713214759.B5CF11E4007@bag.python.org> Author: alexandre.vassalotti Date: Sun Jul 13 23:47:59 2008 New Revision: 64930 Log: Issue #3153: sqlite leaks on error. Changed statements of the form Py_DECREF(obj), obj = 0 to Py_CLEAR(obj). Modified: python/trunk/Modules/_sqlite/connection.c python/trunk/Modules/_sqlite/cursor.c Modified: python/trunk/Modules/_sqlite/connection.c ============================================================================== --- python/trunk/Modules/_sqlite/connection.c (original) +++ python/trunk/Modules/_sqlite/connection.c Sun Jul 13 23:47:59 2008 @@ -1014,19 +1014,16 @@ _pysqlite_seterror(self->db, NULL); } - Py_DECREF(statement); - statement = 0; + Py_CLEAR(statement); } else { weakref = PyWeakref_NewRef((PyObject*)statement, NULL); if (!weakref) { - Py_DECREF(statement); - statement = 0; + Py_CLEAR(statement); goto error; } if (PyList_Append(self->statements, weakref) != 0) { - Py_DECREF(weakref); - statement = 0; + Py_CLEAR(weakref); goto error; } @@ -1050,15 +1047,13 @@ method = PyObject_GetAttrString(cursor, "execute"); if (!method) { - Py_DECREF(cursor); - cursor = 0; + Py_CLEAR(cursor); goto error; } result = PyObject_CallObject(method, args); if (!result) { - Py_DECREF(cursor); - cursor = 0; + Py_CLEAR(cursor); } error: @@ -1081,15 +1076,13 @@ method = PyObject_GetAttrString(cursor, "executemany"); if (!method) { - Py_DECREF(cursor); - cursor = 0; + Py_CLEAR(cursor); goto error; } result = PyObject_CallObject(method, args); if (!result) { - Py_DECREF(cursor); - cursor = 0; + Py_CLEAR(cursor); } error: @@ -1112,15 +1105,13 @@ method = PyObject_GetAttrString(cursor, "executescript"); if (!method) { - Py_DECREF(cursor); - cursor = 0; + Py_CLEAR(cursor); goto error; } result = PyObject_CallObject(method, args); if (!result) { - Py_DECREF(cursor); - cursor = 0; + Py_CLEAR(cursor); } error: Modified: python/trunk/Modules/_sqlite/cursor.c ============================================================================== --- python/trunk/Modules/_sqlite/cursor.c (original) +++ python/trunk/Modules/_sqlite/cursor.c Sun Jul 13 23:47:59 2008 @@ -545,7 +545,7 @@ } rc = pysqlite_statement_create(self->statement, self->connection, operation); if (rc != SQLITE_OK) { - self->statement = 0; + Py_CLEAR(self->statement); goto error; } } @@ -681,8 +681,7 @@ self->next_row = _pysqlite_fetch_one_row(self); } else if (rc == SQLITE_DONE && !multiple) { pysqlite_statement_reset(self->statement); - Py_DECREF(self->statement); - self->statement = 0; + Py_CLEAR(self->statement); } switch (statement_type) { @@ -988,8 +987,7 @@ if (self->statement) { (void)pysqlite_statement_reset(self->statement); - Py_DECREF(self->statement); - self->statement = 0; + Py_CLEAR(self->statement); } Py_INCREF(Py_None); From python-checkins at python.org Mon Jul 14 00:12:10 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 14 Jul 2008 00:12:10 +0200 (CEST) Subject: [Python-checkins] r64932 - peps/trunk/pep-3108.txt Message-ID: <20080713221210.AB33F1E4002@bag.python.org> Author: benjamin.peterson Date: Mon Jul 14 00:12:10 2008 New Revision: 64932 Log: Alexandre has handled the fast versions of StringIO and pickle Modified: peps/trunk/pep-3108.txt Modified: peps/trunk/pep-3108.txt ============================================================================== --- peps/trunk/pep-3108.txt (original) +++ peps/trunk/pep-3108.txt Mon Jul 14 00:12:10 2008 @@ -692,7 +692,7 @@ control of the Python development team for renaming. See `Open Issues`_ for a discussion on this. -* pickle/cPickle [done: cPickle gone (need accelerated version)] +* pickle/cPickle [done: cPickle gone and accelerated version added] + Rename cPickle to _pickle. + Semantic completeness of C implementation *not* verified. @@ -702,7 +702,7 @@ + Rename cProfile to _profile. + Semantic completeness of C implementation *not* verified. -* StringIO/cStringIO [done: cStringIO gone (need accelerated version)] +* StringIO/cStringIO [done: cStringIO gone and accelerated version added] + Add the class to the 'io' module. From buildbot at python.org Mon Jul 14 00:24:39 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 13 Jul 2008 22:24:39 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20080713222439.B28C91E4002@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%203.0/builds/165 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: alexandre.vassalotti BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2 ====================================================================== ERROR: test_badly_named_methods (test.test_urllib2.OpenerDirectorTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_urllib2.py", line 408, in test_badly_named_methods self.assertRaises(URLError, o.open, scheme+"://example.com/") File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/unittest.py", line 311, in failUnlessRaises callableObj(*args, **kwargs) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 356, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 379, in _open 'unknown_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 334, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1102, in unknown_open raise URLError('unknown url type: %s' % type) urllib.error.URLError: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jul 14 00:51:15 2008 From: python-checkins at python.org (guilherme.polo) Date: Mon, 14 Jul 2008 00:51:15 +0200 (CEST) Subject: [Python-checkins] r64936 - sandbox/trunk/ttk-gsoc/samples/theming.py Message-ID: <20080713225115.A3CE31E4002@bag.python.org> Author: guilherme.polo Date: Mon Jul 14 00:51:15 2008 New Revision: 64936 Log: Check for wanted names now, instead of discarding unwanted names. Modified: sandbox/trunk/ttk-gsoc/samples/theming.py Modified: sandbox/trunk/ttk-gsoc/samples/theming.py ============================================================================== --- sandbox/trunk/ttk-gsoc/samples/theming.py (original) +++ sandbox/trunk/ttk-gsoc/samples/theming.py Mon Jul 14 00:51:15 2008 @@ -25,8 +25,11 @@ """Maps Ttk widgets to their respective layout(s), factory and possibly other things.""" widgets = {} - # will discard Style and extension classes - unwanted_names = ('Style', 'LabeledScale', 'OptionMenu') + wanted_names = ("Button", "Checkbutton", "Combobox", "Entry", "Frame", + "Label", "Labelframe", "Menubutton", "Notebook", "Panedwindow", + "Progressbar", "Radiobutton", "Scale", "Scrollbar", "Separator", + "Sizegrip", "Treeview") + # some widgets contain Vertical and Horizontal layouts vert_horiz = ('Progressbar', 'Scale', 'Scrollbar') # several widgets contain a single layout named as Twidgetname @@ -42,12 +45,7 @@ 'Menubutton': widget_menubtn, 'Panedwindow': widget_paned} for name in ttk.__all__: - if name in unwanted_names: - continue - - name = name.title() - if name in widgets: - # do not add aliases + if name not in wanted_names: continue widget_d = {'factory': None, 'layouts': None} From python-checkins at python.org Mon Jul 14 01:11:52 2008 From: python-checkins at python.org (guilherme.polo) Date: Mon, 14 Jul 2008 01:11:52 +0200 (CEST) Subject: [Python-checkins] r64937 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20080713231152.748D81E4002@bag.python.org> Author: guilherme.polo Date: Mon Jul 14 01:11:52 2008 New Revision: 64937 Log: Moved most of _dict_from_tcltuple's code to a public function named tclobjs_to_py since it may be useful outside the ttk module (e.g. the dict returned from widget.configure()); Version is 0.1.3 now. Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/ttk.py Mon Jul 14 01:11:52 2008 @@ -12,7 +12,7 @@ of the widgets appearance lies at Themes. """ -__version__ = "0.1.2" +__version__ = "0.1.3" __author__ = "Guilherme Polo " @@ -21,7 +21,9 @@ "PanedWindow", "Progressbar", "Radiobutton", "Scale", "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview", # Extensions - "LabeledScale", "OptionMenu"] + "LabeledScale", "OptionMenu", + # functions + "tclobjs_to_py"] import Tkinter @@ -251,36 +253,13 @@ be removed. ttuple is expected to contain an even number of elements.""" - opts = [] opt_start = 1 if cut_minus else 0 + retdict = {} for opt, val in zip(iter(ttuple[::2]), iter(ttuple[1::2])): - if isinstance(val, basestring): - try: - if ' ' in val: # could be the padding option - val = map(int, val.split()) - elif val.isdigit(): - val = int(val) - except ValueError: # leave val untouched for now - pass + retdict[str(opt)[opt_start:]] = val - elif val and hasattr(val, '__len__') and hasattr(val[0], 'typename'): - if val[0].typename == 'StateSpec': - val = _list_from_statespec(val) - else: # could be padding - val = map(str, val) - try: - val = map(int, val) - except ValueError: - pass - - elif hasattr(val, 'typename'): - # some other Tcl object - val = str(val) - - opts.append((str(opt)[opt_start:], val)) - - return dict(opts) + return tclobjs_to_py(retdict) def _list_from_statespec(stuple): """Construct a list from the given statespec tuple according to the @@ -341,6 +320,44 @@ return _dict_from_tcltuple(res) +def _convert_stringval(value): + """Converts a value, that may possibly represents a sequence, + hopefully, to a more appropriate Python object.""" + try: + value = int(value) + except (ValueError, TypeError): + if ' ' in value: + value = map(str, value) + try: + value = map(int, value) + except ValueError: + # this value needs no conversion apparently + pass + + return value + +def tclobjs_to_py(adict): + """Returns adict with its values converted from Tcl objects to Python + objects.""" + for opt, val in adict.iteritems(): + if isinstance(val, basestring): + val = _convert_stringval(val) + + elif val and hasattr(val, '__len__'): + if hasattr(val[0], 'typename') and val[0].typename == 'StateSpec': + val = _list_from_statespec(val) + else: + # converts a sequence that possibly has Tcl objects, or not, + # to a better representation + val = map(_convert_stringval, map(str, val)) + + elif hasattr(val, 'typename'): # some other Tcl object + val = str(val) + + adict[opt] = val + + return adict + class Style(object): """Manipulate style database.""" Modified: sandbox/trunk/ttk-gsoc/src/3.x/ttk.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/ttk.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Mon Jul 14 01:11:52 2008 @@ -12,7 +12,7 @@ of the widgets appearance lies at Themes. """ -__version__ = "0.1.2" +__version__ = "0.1.3" __author__ = "Guilherme Polo " @@ -21,7 +21,9 @@ "PanedWindow", "Progressbar", "Radiobutton", "Scale", "Scrollbar", "Separator", "Sizegrip", "Style", "Treeview", # Extensions - "LabeledScale", "OptionMenu"] + "LabeledScale", "OptionMenu", + # functions + "tclobjs_to_py"] import tkinter @@ -251,36 +253,13 @@ be removed. ttuple is expected to contain an even number of elements.""" - opts = [] opt_start = 1 if cut_minus else 0 + retdict = {} for opt, val in zip(iter(ttuple[::2]), iter(ttuple[1::2])): - if isinstance(val, str): - try: - if ' ' in val: # could be the padding option - val = list(map(int, val.split())) - elif val.isdigit(): - val = int(val) - except ValueError: # leave val untouched for now - pass + retdict[str(opt)[opt_start:]] = val - elif val and hasattr(val, '__len__') and hasattr(val[0], 'typename'): - if val[0].typename == 'StateSpec': - val = _list_from_statespec(val) - else: # could be padding - val = list(map(str, val)) - try: - val = list(map(int, val)) - except ValueError: - pass - - elif hasattr(val, 'typename'): - # some other Tcl object - val = str(val) - - opts.append((str(opt)[opt_start:], val)) - - return dict(opts) + return tclobjs_to_py(retdict) def _list_from_statespec(stuple): """Construct a list from the given statespec tuple according to the @@ -341,6 +320,44 @@ return _dict_from_tcltuple(res) +def _convert_stringval(value): + """Converts a value, that may possibly represents a sequence, + hopefully, to a more appropriate Python object.""" + try: + value = int(value) + except (ValueError, TypeError): + if ' ' in value: + value = list(map(str, value)) + try: + value = list(map(int, value)) + except ValueError: + # this value needs no conversion apparently + pass + + return value + +def tclobjs_to_py(adict): + """Returns adict with its values converted from Tcl objects to Python + objects.""" + for opt, val in adict.items(): + if isinstance(val, str): + val = _convert_stringval(val) + + elif val and hasattr(val, '__len__'): + if hasattr(val[0], 'typename') and val[0].typename == 'StateSpec': + val = _list_from_statespec(val) + else: + # converts a sequence that possibly has Tcl objects, or not, + # to a better representation + val = list(map(_convert_stringval, map(str, val))) + + elif hasattr(val, 'typename'): # some other Tcl object + val = str(val) + + adict[opt] = val + + return adict + class Style(object): """Manipulate style database.""" From python-checkins at python.org Mon Jul 14 02:35:33 2008 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 14 Jul 2008 02:35:33 +0200 (CEST) Subject: [Python-checkins] r64938 - python/trunk/Doc/library/multiprocessing.rst Message-ID: <20080714003533.4F5A01E4002@bag.python.org> Author: andrew.kuchling Date: Mon Jul 14 02:35:32 2008 New Revision: 64938 Log: Typo fixes Modified: python/trunk/Doc/library/multiprocessing.rst Modified: python/trunk/Doc/library/multiprocessing.rst ============================================================================== --- python/trunk/Doc/library/multiprocessing.rst (original) +++ python/trunk/Doc/library/multiprocessing.rst Mon Jul 14 02:35:32 2008 @@ -170,7 +170,7 @@ **Server process** A manager object returned by :func:`Manager` controls a server process which - holds python objects and allows other processes to manipulate them using + holds Python objects and allows other processes to manipulate them using proxies. A manager returned by :func:`Manager` will support types :class:`list`, @@ -453,7 +453,7 @@ This means that if you try joining that process you may get a deadlock unless you are sure that all items which have been put on the queue have been consumed. Similarly, if the child process is non-daemonic then the parent - process may hang on exit when it tries to join all it non-daemonic children. + process may hang on exit when it tries to join all its non-daemonic children. Note that a queue created using a manager does not have this issue. See :ref:`multiprocessing-programming`. @@ -534,7 +534,8 @@ Equivalent to ``get(False)``. :class:`multiprocessing.Queue` has a few additional methods not found in - :class:`Queue.Queue` which are usually unnecessary: + :class:`Queue.Queue`. These methods are usually unnecessary for most + code: .. method:: close() From buildbot at python.org Mon Jul 14 02:35:44 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 14 Jul 2008 00:35:44 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20080714003545.8DBBB1E4002@bag.python.org> The Buildbot has detected a new failure of sparc Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Debian%203.0/builds/364 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_funcattrs make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jul 14 02:42:45 2008 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 14 Jul 2008 02:42:45 +0200 (CEST) Subject: [Python-checkins] r64939 - python/trunk/Doc/library/multiprocessing.rst Message-ID: <20080714004245.CA0771E4016@bag.python.org> Author: andrew.kuchling Date: Mon Jul 14 02:40:55 2008 New Revision: 64939 Log: Typo fix Modified: python/trunk/Doc/library/multiprocessing.rst Modified: python/trunk/Doc/library/multiprocessing.rst ============================================================================== --- python/trunk/Doc/library/multiprocessing.rst (original) +++ python/trunk/Doc/library/multiprocessing.rst Mon Jul 14 02:40:55 2008 @@ -1084,7 +1084,7 @@ Start a subprocess to start the manager. - .. method:: server_forever() + .. method:: serve_forever() Run the server in the current process. From buildbot at python.org Mon Jul 14 02:50:23 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 14 Jul 2008 00:50:23 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20080714005023.EC4A61E4011@bag.python.org> The Buildbot has detected a new failure of sparc Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20Ubuntu%203.0/builds/441 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-sparc Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jul 14 03:18:16 2008 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 14 Jul 2008 03:18:16 +0200 (CEST) Subject: [Python-checkins] r64940 - python/trunk/Doc/library/multiprocessing.rst Message-ID: <20080714011816.9A8AC1E4002@bag.python.org> Author: andrew.kuchling Date: Mon Jul 14 03:18:16 2008 New Revision: 64940 Log: Typo fix Modified: python/trunk/Doc/library/multiprocessing.rst Modified: python/trunk/Doc/library/multiprocessing.rst ============================================================================== --- python/trunk/Doc/library/multiprocessing.rst (original) +++ python/trunk/Doc/library/multiprocessing.rst Mon Jul 14 03:18:16 2008 @@ -775,7 +775,7 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~ Generally synchronization primitives are not as necessary in a multiprocess -program as they are in a mulithreaded program. See the documentation for +program as they are in a multithreaded program. See the documentation for :mod:`threading` module. Note that one can also create synchronization primitives by using a manager From python-checkins at python.org Mon Jul 14 03:18:31 2008 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 14 Jul 2008 03:18:31 +0200 (CEST) Subject: [Python-checkins] r64941 - python/trunk/Doc/whatsnew/2.6.rst Message-ID: <20080714011831.AA6191E4002@bag.python.org> Author: andrew.kuchling Date: Mon Jul 14 03:18:31 2008 New Revision: 64941 Log: Expand the multiprocessing section Modified: python/trunk/Doc/whatsnew/2.6.rst Modified: python/trunk/Doc/whatsnew/2.6.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.6.rst (original) +++ python/trunk/Doc/whatsnew/2.6.rst Mon Jul 14 03:18:31 2008 @@ -526,28 +526,152 @@ PEP 371: The ``multiprocessing`` Package ===================================================== -.. XXX I think this still needs help - -:mod:`multiprocessing` makes it easy to distribute work over multiple processes. -Its API is similar to that of :mod:`threading`. For example:: - - from multiprocessing import Process - - def long_hard_task(n): - print n * 43 - - for i in range(10): - Process(target=long_hard_task, args=(i)).start() +The new :mod:`multiprocessing` package lets Python programs create new +processes that will perform a computation and return a result to the +parent. The parent and child processes can communicate using queues +and pipes, synchronize their operations using locks and semaphores, +and can share simple arrays of data. + +The :mod:`multiprocessing` module started out as an exact emulation of +the :mod:`threading` module using processes instead of threads. That +goal was discarded along the path to Python 2.6, but the general +approach of the module is still similar. The fundamental class +is the :class:`Process`, which is passed a callable object and +a collection of arguments. The :meth:`start` method +sets the callable running in a subprocess, after which you can call +the :meth:`is_alive` method to check whether the subprocess is still running +and the :meth:`join` method to wait for the process to exit. + +Here's a simple example where the subprocess will calculate a +factorial. The function doing the calculation is a bit strange; it's +written to take significantly longer when the input argument is a +multiple of 4. + +:: + + import time + from multiprocessing import Process, Queue + + + def factorial(queue, N): + "Compute a factorial." + # If N is a multiple of 4, this function will take much longer. + if (N % 4) == 0: + time.sleep(.05 * N/4) + + # Calculate the result + fact = 1L + for i in range(1, N+1): + fact = fact * i + + # Put the result on the queue + queue.put(fact) + + if __name__ == '__main__': + queue = Queue() + + N = 5 + + p = Process(target=factorial, args=(queue, N)) + p.start() + p.join() + + result = queue.get() + print 'Factorial', N, '=', result + +A :class:`Queue` object is created and stored as a global. The child +process will use the value of the variable when the child was created; +because it's a :class:`Queue`, parent and child can use the object to +communicate. (If the parent were to change the value of the global +variable, the child's value would be unaffected, and vice versa.) + +Two other classes, :class:`Pool` and :class:`Manager`, provide +higher-level interfaces. :class:`Pool` will create a fixed number of +worker processes, and requests can then be distributed to the workers +by calling :meth:`apply` or `apply_async`, adding a single request, +and :meth:`map` or :meth:`map_async` to distribute a number of +requests. The following code uses a :class:`Pool` to spread requests +across 5 worker processes, receiving a list of results back. + +:: + + from multiprocessing import Pool + + p = Pool(5) + result = p.map(factorial, range(1, 1000, 10)) + for v in result: + print v + +This produces the following output:: + + 1 + 39916800 + 51090942171709440000 + 8222838654177922817725562880000000 + 33452526613163807108170062053440751665152000000000 + ... -will multiply the numbers between 0 and 10 times 43 and print out the result -concurrently. +The :class:`Manager` class creates a separate server process that can +hold master copies of Python data structures. Other processes can +then access and modify these data structures by using proxy objects. +The following example creates a shared dictionary by calling the +:meth:`dict` method; the worker processes then insert values into the +dictionary. (No locking is done automatically, which doesn't matter +in this example. :class:`Manager`'s methods also include +:meth:`Lock`, :meth:`RLock`, and :meth:`Semaphore` to create shared locks. + +:: + + import time + from multiprocessing import Pool, Manager + + def factorial(N, dictionary): + "Compute a factorial." + # Calculate the result + fact = 1L + for i in range(1, N+1): + fact = fact * i + + # Store result in dictionary + dictionary[N] = fact + + if __name__ == '__main__': + p = Pool(5) + mgr = Manager() + d = mgr.dict() # Create shared dictionary + + # Run tasks using the pool + for N in range(1, 1000, 10): + p.apply_async(factorial, (N, d)) + + # Mark pool as closed -- no more tasks can be added. + p.close() + + # Wait for tasks to exit + p.join() + + # Output results + for k, v in sorted(d.items()): + print k, v + +This will produce the output:: + + 1 1 + 11 39916800 + 21 51090942171709440000 + 31 8222838654177922817725562880000000 + 41 33452526613163807108170062053440751665152000000000 + 51 1551118753287382280224243016469303211063259720016986112000000000000 .. seealso:: + The documentation for the :mod:`multiprocessing` module. + :pep:`371` - Addition of the multiprocessing package PEP written by Jesse Noller and Richard Oudkerk; implemented by Richard Oudkerk and Jesse Noller. + .. ====================================================================== .. _pep-3101: From python-checkins at python.org Mon Jul 14 03:19:06 2008 From: python-checkins at python.org (collin.winter) Date: Mon, 14 Jul 2008 03:19:06 +0200 (CEST) Subject: [Python-checkins] r64942 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Message-ID: <20080714011906.3D0BE1E4002@bag.python.org> Author: collin.winter Date: Mon Jul 14 03:19:05 2008 New Revision: 64942 Log: Add a comment explaining part of fix_imports.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Mon Jul 14 03:19:05 2008 @@ -294,6 +294,7 @@ yield """import_name< 'import' dotted_as_name< module_name=%r 'as' any > > """ % old_module + # Find usages of module members in code e.g. urllib.foo(bar) yield """power< module_name=%r trailer< '.' %s > any* > """ % (old_module, members) yield """bare_name=%s""" % alternates(bare) From python-checkins at python.org Mon Jul 14 06:47:56 2008 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 14 Jul 2008 06:47:56 +0200 (CEST) Subject: [Python-checkins] r64943 - tracker/instances/board/html/issue.item.html Message-ID: <20080714044756.C03101E4002@bag.python.org> Author: martin.v.loewis Date: Mon Jul 14 06:47:56 2008 New Revision: 64943 Log: Make all board members possible assignees. Modified: tracker/instances/board/html/issue.item.html Modified: tracker/instances/board/html/issue.item.html ============================================================================== --- tracker/instances/board/html/issue.item.html (original) +++ tracker/instances/board/html/issue.item.html Mon Jul 14 06:47:56 2008 @@ -121,7 +121,7 @@