[Python-checkins] r79303 - in python/branches/py3k-jit: .hgignore Demo/classes/Complex.py Demo/classes/Dates.py Demo/classes/Dbm.py Demo/classes/Range.py Demo/classes/Rev.py Demo/classes/Vec.py Demo/classes/bitvec.py Demo/md5test/md5driver.py Demo/pdist/FSProxy.py Demo/pdist/client.py Demo/pdist/cmdfw.py Demo/pdist/cmptree.py Demo/pdist/cvslib.py Demo/pdist/cvslock.py Demo/pdist/mac.py Demo/pdist/rcsclient.py Demo/pdist/rcslib.py Demo/pdist/security.py Demo/pdist/server.py Demo/pdist/sumtree.py Demo/sockets/broadcast.py Demo/sockets/ftp.py Demo/sockets/radio.py Demo/tix/samples/Balloon.py Demo/tix/samples/BtnBox.py Demo/tix/samples/CmpImg.py Demo/tix/samples/ComboBox.py Demo/tix/samples/Control.py Demo/tix/samples/DirList.py Demo/tix/samples/DirTree.py Demo/tix/samples/NoteBook.py Demo/tix/samples/OptMenu.py Demo/tix/samples/PanedWin.py Demo/tix/samples/PopMenu.py Demo/tix/samples/SHList1.py Demo/tix/samples/SHList2.py Demo/tix/samples/Tree.py Demo/tkinter/guido/AttrDialog.py Demo/tkinter/guido/ManPage.py Demo/tkinter/guido/ShellWindow.py Demo/tkinter/guido/hanoi.py Demo/tkinter/guido/hello.py Demo/tkinter/guido/imagedraw.py Demo/tkinter/guido/imageview.py Demo/tkinter/guido/listtree.py Demo/tkinter/guido/wish.py Doc/distutils/sourcedist.rst Doc/extending/extending.rst Doc/extending/newtypes.rst Doc/faq/windows.rst Doc/includes/email-headers.py Doc/includes/minidom-example.py Doc/library/2to3.rst Doc/library/argparse.rst Doc/library/asyncore.rst Doc/library/datetime.rst Doc/library/doctest.rst Doc/library/email-examples.rst Doc/library/functions.rst Doc/library/gzip.rst Doc/library/index.rst Doc/library/logging.rst Doc/library/multiprocessing.rst Doc/library/objects.rst Doc/library/pdb.rst Doc/library/random.rst Doc/library/shutil.rst Doc/library/sqlite3.rst Doc/library/stdtypes.rst Doc/library/subprocess.rst Doc/library/sys.rst Doc/library/sysconfig.rst Doc/library/test.rst Doc/library/threading.rst Doc/library/unittest.rst Doc/library/xml.dom.minidom.rst Doc/library/xml.etree.elementtree.rst Doc/library/zipfile.rst Doc/library/zlib.rst Doc/reference/expressions.rst Doc/reference/simple_stmts.rst Doc/tutorial/datastructures.rst Doc/tutorial/introduction.rst Doc/whatsnew/2.7.rst Lib/compileall.py Lib/ctypes/test/test_internals.py Lib/http/client.py Lib/logging/__init__.py Lib/macpath.py Lib/mailbox.py Lib/pipes.py Lib/platform.py Lib/profile.py Lib/shutil.py Lib/ssl.py Lib/test/regrtest.py Lib/test/test_builtin.py Lib/test/test_bytes.py Lib/test/test_cgi.py Lib/test/test_descr.py Lib/test/test_extcall.py Lib/test/test_ftplib.py Lib/test/test_global.py Lib/test/test_http_cookies.py Lib/test/test_httplib.py Lib/test/test_imp.py Lib/test/test_importhooks.py Lib/test/test_inspect.py Lib/test/test_mailbox.py Lib/test/test_pep277.py Lib/test/test_pipes.py Lib/test/test_platform.py Lib/test/test_posix.py Lib/test/test_set.py Lib/test/test_tarfile.py Lib/test/test_tempfile.py Lib/test/test_thread.py Lib/test/test_unicode.py Lib/test/test_unittest.py Lib/test/test_xml_etree.py Lib/unittest/__init__.py Lib/unittest/__main__.py Lib/unittest/case.py Lib/unittest/loader.py Lib/unittest/main.py Lib/unittest/result.py Lib/unittest/runner.py Lib/unittest/suite.py Lib/unittest/util.py Mac/BuildScript/build-installer.py Makefile.pre.in Misc/ACKS Misc/NEWS Misc/Porting Modules/_cursesmodule.c Modules/_elementtree.c Modules/_io/fileio.c Modules/signalmodule.c Objects/unicodeobject.c Parser/myreadline.c Python/ceval.c Tools/README Tools/modulator Tools/scripts/mailerdaemon.py Tools/scripts/reindent-rst.py
collin.winter
python-checkins at python.org
Mon Mar 22 22:57:18 CET 2010
Author: collin.winter
Date: Mon Mar 22 22:57:17 2010
New Revision: 79303
Log:
Merged revisions 79119,79124,79126,79128,79136,79140-79141,79143-79145,79149-79155,79157-79158,79161,79166,79170-79171,79175,79177,79180,79182-79183,79186,79193,79196,79209,79221,79239,79242-79245,79251-79253,79255-79260,79262,79264,79267,79269,79271,79273,79275-79276,79281,79287,79289,79298,79301 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r79119 | benjamin.peterson | 2010-03-19 14:42:45 -0700 (Fri, 19 Mar 2010) | 1 line
update mac installer script from the trunk #8068
................
r79124 | sean.reifschneider | 2010-03-19 16:23:05 -0700 (Fri, 19 Mar 2010) | 2 lines
Adding an example of reproducing the rfc822.Message() parsing.
................
r79126 | sean.reifschneider | 2010-03-19 17:06:05 -0700 (Fri, 19 Mar 2010) | 2 lines
Fixing the file call in the rfc822.Message replacement example.
................
r79128 | florent.xicluna | 2010-03-19 17:21:04 -0700 (Fri, 19 Mar 2010) | 9 lines
Merged revisions 79127 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79127 | florent.xicluna | 2010-03-20 01:17:46 +0100 (sam, 20 mar 2010) | 2 lines
#8178 Cleanup the threads after test_thread.TestForkInThread.
........
................
r79136 | michael.foord | 2010-03-20 08:42:52 -0700 (Sat, 20 Mar 2010) | 1 line
Block revision 79132 in preparation for a manual merge.
................
r79140 | michael.foord | 2010-03-20 09:58:04 -0700 (Sat, 20 Mar 2010) | 1 line
Adding assertItemsEqual with tests. Issue 7832. assertSameElements still needs to be deprecated plus documentation needs to be updated.
................
r79141 | michael.foord | 2010-03-20 10:21:27 -0700 (Sat, 20 Mar 2010) | 1 line
Issue 7832. Deprecating assertSameElements in Py3k.
................
r79143 | michael.foord | 2010-03-20 11:09:14 -0700 (Sat, 20 Mar 2010) | 1 line
Issue 7832. Document changes to unittest.TestCase.assertSameElements and assertItemsEqual
................
r79144 | florent.xicluna | 2010-03-20 13:30:53 -0700 (Sat, 20 Mar 2010) | 2 lines
#8133: Use appropriate Unicode decomposition on MacOS X platform.
................
r79145 | florent.xicluna | 2010-03-20 13:31:34 -0700 (Sat, 20 Mar 2010) | 2 lines
Typo
................
r79149 | brett.cannon | 2010-03-20 13:59:33 -0700 (Sat, 20 Mar 2010) | 2 lines
Clean up the manipulation of the warnings filter in test_builtin.
................
r79150 | brett.cannon | 2010-03-20 14:45:01 -0700 (Sat, 20 Mar 2010) | 2 lines
Clean up warnings filter use in test_bytes.
................
r79151 | brett.cannon | 2010-03-20 14:48:19 -0700 (Sat, 20 Mar 2010) | 3 lines
Clean up warnings filter use in test_global by no longer having it be a
module-level manipulation of the filter.
................
r79152 | brett.cannon | 2010-03-20 14:51:10 -0700 (Sat, 20 Mar 2010) | 2 lines
Fix the warnings filter usage in test_http_cookies.
................
r79153 | brett.cannon | 2010-03-20 14:53:28 -0700 (Sat, 20 Mar 2010) | 2 lines
Fix the warnings usage in test_posix.
................
r79154 | brett.cannon | 2010-03-20 14:55:48 -0700 (Sat, 20 Mar 2010) | 2 lines
Clean up the warnings filter use in test_set.
................
r79155 | brett.cannon | 2010-03-20 15:19:55 -0700 (Sat, 20 Mar 2010) | 2 lines
Clean up warnings filter use in test_tempfile.
................
r79157 | brett.cannon | 2010-03-20 15:22:22 -0700 (Sat, 20 Mar 2010) | 2 lines
Clean up the warnings filter use in test_unicode.
................
r79158 | brett.cannon | 2010-03-20 15:22:57 -0700 (Sat, 20 Mar 2010) | 2 lines
Have regrtest monitor the warnings filter for changes made by a test suite.
................
r79161 | antoine.pitrou | 2010-03-20 17:22:55 -0700 (Sat, 20 Mar 2010) | 9 lines
Merged revisions 79160 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79160 | antoine.pitrou | 2010-03-21 01:21:43 +0100 (dim., 21 mars 2010) | 3 lines
Fix overzealous .hgignore file
........
................
r79166 | ezio.melotti | 2010-03-21 00:16:43 -0700 (Sun, 21 Mar 2010) | 1 line
Update versionadded/changed.
................
r79170 | georg.brandl | 2010-03-21 02:02:59 -0700 (Sun, 21 Mar 2010) | 1 line
Fix some issues found by Jacques Ducasse on the docs list.
................
r79171 | georg.brandl | 2010-03-21 02:04:24 -0700 (Sun, 21 Mar 2010) | 13 lines
Merged revisions 79168-79169 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79168 | georg.brandl | 2010-03-21 10:01:27 +0100 (So, 21 Mär 2010) | 1 line
Fix some issues found by Jacques Ducasse on the docs list.
........
r79169 | georg.brandl | 2010-03-21 10:02:01 +0100 (So, 21 Mär 2010) | 1 line
Remove the "built-in objects" file. It only contained two paragraphs of which only one contained useful information, which belongs in the ref manual however.
........
................
r79175 | georg.brandl | 2010-03-21 02:10:32 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 79172 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79172 | georg.brandl | 2010-03-21 10:08:00 +0100 (So, 21 Mär 2010) | 1 line
Add a paragraph about set displays.
........
................
r79177 | georg.brandl | 2010-03-21 02:25:54 -0700 (Sun, 21 Mar 2010) | 1 line
Need to use list(range()) to get a list.
................
r79180 | georg.brandl | 2010-03-21 02:50:49 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 79178 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79178 | georg.brandl | 2010-03-21 10:28:16 +0100 (So, 21 Mär 2010) | 1 line
Clarify that for shell=True, the shell PID will be the child PID.
........
................
r79182 | georg.brandl | 2010-03-21 02:51:44 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 79179 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79179 | georg.brandl | 2010-03-21 10:37:54 +0100 (So, 21 Mär 2010) | 1 line
Mention inefficiency of lists as queues, add link to collections.deque discussion.
........
................
r79183 | georg.brandl | 2010-03-21 02:52:24 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 79181 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79181 | georg.brandl | 2010-03-21 10:51:16 +0100 (So, 21 Mär 2010) | 1 line
Update os.kill() emulation example for Windows to use ctypes.
........
................
r79186 | georg.brandl | 2010-03-21 03:03:36 -0700 (Sun, 21 Mar 2010) | 13 lines
Merged revisions 79184-79185 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79184 | georg.brandl | 2010-03-21 10:58:36 +0100 (So, 21 Mär 2010) | 1 line
Update text for newest US DST regulation. The sample file already has the calculation right.
........
r79185 | georg.brandl | 2010-03-21 11:02:47 +0100 (So, 21 Mär 2010) | 1 line
Include structmember.h correctly.
........
................
r79193 | georg.brandl | 2010-03-21 04:53:50 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 79192 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79192 | georg.brandl | 2010-03-21 12:50:58 +0100 (So, 21 Mär 2010) | 1 line
Remove leftover word.
........
................
r79196 | florent.xicluna | 2010-03-21 05:29:50 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 79195 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79195 | florent.xicluna | 2010-03-21 13:27:20 +0100 (dim, 21 mar 2010) | 2 lines
Issue #8179: Fix macpath.realpath() on a non-existing path.
........
................
r79209 | florent.xicluna | 2010-03-21 11:49:50 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 79207 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79207 | florent.xicluna | 2010-03-21 19:00:38 +0100 (dim, 21 mar 2010) | 2 lines
#8180: Fix test_pep277 on OS X and add more tests for special Unicode normalization cases.
........
................
r79221 | antoine.pitrou | 2010-03-21 12:25:26 -0700 (Sun, 21 Mar 2010) | 11 lines
Merged revisions 79218 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79218 | antoine.pitrou | 2010-03-21 20:19:41 +0100 (dim., 21 mars 2010) | 5 lines
Issue #1628484: The Makefile doesn't ignore the CFLAGS environment
variable anymore. It also forwards the LDFLAGS settings to the linker
when building a shared library.
........
................
r79239 | benjamin.peterson | 2010-03-21 14:00:50 -0700 (Sun, 21 Mar 2010) | 39 lines
Merged revisions 79205,79219,79228,79230,79232-79233,79235,79237 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79205 | benjamin.peterson | 2010-03-21 12:34:54 -0500 (Sun, 21 Mar 2010) | 1 line
rewrite a bit
........
r79219 | benjamin.peterson | 2010-03-21 14:24:08 -0500 (Sun, 21 Mar 2010) | 1 line
flatten condition
........
r79228 | benjamin.peterson | 2010-03-21 14:35:39 -0500 (Sun, 21 Mar 2010) | 1 line
remove pointless condition
........
r79230 | benjamin.peterson | 2010-03-21 14:39:52 -0500 (Sun, 21 Mar 2010) | 1 line
co_varnames is certainly a tuple, so let's not waste time finding out
........
r79232 | benjamin.peterson | 2010-03-21 14:54:56 -0500 (Sun, 21 Mar 2010) | 1 line
fix import
........
r79233 | benjamin.peterson | 2010-03-21 14:56:37 -0500 (Sun, 21 Mar 2010) | 1 line
don't write duplicate tests
........
r79235 | benjamin.peterson | 2010-03-21 15:21:00 -0500 (Sun, 21 Mar 2010) | 4 lines
improve error message from passing inadequate number of keyword arguments #6474
Note this removes the "non-keyword" or "keyword" phrases from these messages.
........
r79237 | benjamin.peterson | 2010-03-21 15:30:30 -0500 (Sun, 21 Mar 2010) | 1 line
take into account keyword arguments when passing too many args
........
................
r79242 | benjamin.peterson | 2010-03-21 14:08:54 -0700 (Sun, 21 Mar 2010) | 1 line
cleanup a bit
................
r79243 | benjamin.peterson | 2010-03-21 14:12:03 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 78028 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78028 | benjamin.peterson | 2010-02-06 13:40:18 -0600 (Sat, 06 Feb 2010) | 1 line
remove pointless error checking
........
................
r79244 | benjamin.peterson | 2010-03-21 14:16:24 -0700 (Sun, 21 Mar 2010) | 1 line
count keyword only arguments as part of the total
................
r79245 | benjamin.peterson | 2010-03-21 14:22:12 -0700 (Sun, 21 Mar 2010) | 1 line
nest if for clarity
................
r79251 | benjamin.peterson | 2010-03-21 15:03:03 -0700 (Sun, 21 Mar 2010) | 99 lines
Merged revisions 77952,78030,78102,78104,78107,78206,78216,78296-78297,78328,78331-78332,78336,78339,78343,78378-78379,78415,78559,78717,78791 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77952 | mark.dickinson | 2010-02-03 10:50:14 -0600 (Wed, 03 Feb 2010) | 1 line
Fix test_inspect.py data to match recent change to inspect_fodder.py (r77942).
........
r78030 | benjamin.peterson | 2010-02-06 14:14:10 -0600 (Sat, 06 Feb 2010) | 1 line
check type_getattro for correctness in a descriptor corner case
........
r78102 | andrew.kuchling | 2010-02-07 19:35:35 -0600 (Sun, 07 Feb 2010) | 1 line
Move distutils into its own subsection; add various items
........
r78104 | andrew.kuchling | 2010-02-08 07:22:24 -0600 (Mon, 08 Feb 2010) | 1 line
Add two items; move a subsection
........
r78107 | antoine.pitrou | 2010-02-08 14:25:47 -0600 (Mon, 08 Feb 2010) | 3 lines
Clarify and correct description for ccbench and iobench.
........
r78206 | r.david.murray | 2010-02-16 11:55:26 -0600 (Tue, 16 Feb 2010) | 3 lines
Make the references to Popen in the description of Call
and check_call into links.
........
r78216 | andrew.kuchling | 2010-02-18 08:16:48 -0600 (Thu, 18 Feb 2010) | 1 line
Add various items
........
r78296 | andrew.kuchling | 2010-02-21 20:08:45 -0600 (Sun, 21 Feb 2010) | 1 line
Re-word
........
r78297 | andrew.kuchling | 2010-02-21 20:29:10 -0600 (Sun, 21 Feb 2010) | 1 line
#7076: mention SystemRandom class near start of the module docs; reword change description for clarity. Noted by Shawn Ligocki.
........
r78328 | jack.diederich | 2010-02-22 12:17:16 -0600 (Mon, 22 Feb 2010) | 1 line
fixes issue #7530, serve_forever()
........
r78331 | andrew.kuchling | 2010-02-22 12:38:23 -0600 (Mon, 22 Feb 2010) | 1 line
Fix comment typo
........
r78332 | andrew.kuchling | 2010-02-22 12:42:07 -0600 (Mon, 22 Feb 2010) | 2 lines
#7627: MH.remove() would fail if the MH mailbox was locked;
it would call _unlock_file() and pass it a closed file object. Noted by Rob Austein.
........
r78336 | jack.diederich | 2010-02-22 13:55:22 -0600 (Mon, 22 Feb 2010) | 1 line
fixes issue #1522237, bad init check in _threading_local
........
r78339 | jack.diederich | 2010-02-22 15:27:38 -0600 (Mon, 22 Feb 2010) | 1 line
* fix issue#7476
........
r78343 | andrew.kuchling | 2010-02-22 16:48:41 -0600 (Mon, 22 Feb 2010) | 10 lines
#2560: remove an unnecessary 'for' loop from my_fgets() in Parser/myreadline.c.
Noted by Joseph Armbruster; patch by Jessica McKellar.
The original code was 'for (;;) {...}', where ... ended
with a 'return -2' statement and did not contain a 'break' or 'continue'
statement. Therefore, the body of the loop is always executed once.
Once upon a time there was a 'continue' in the loop, but it was removed in
rev36346, committed by mwh on Wed Jul 7 17:44:12 2004.
........
r78378 | jack.diederich | 2010-02-23 11:23:30 -0600 (Tue, 23 Feb 2010) | 1 line
fixup markup error
........
r78379 | jack.diederich | 2010-02-23 13:34:06 -0600 (Tue, 23 Feb 2010) | 1 line
issue#6442 use in operator instead of has_key
........
r78415 | dirkjan.ochtman | 2010-02-23 22:00:52 -0600 (Tue, 23 Feb 2010) | 1 line
Issue #7733: add explicit reference in asyncore docs.
........
r78559 | andrew.kuchling | 2010-03-01 13:45:21 -0600 (Mon, 01 Mar 2010) | 1 line
#7637: update discussion of minidom.unlink() and garbage collection
........
r78717 | benjamin.peterson | 2010-03-05 21:13:33 -0600 (Fri, 05 Mar 2010) | 1 line
settscdump is definitely an implementation detail
........
r78791 | andrew.kuchling | 2010-03-08 06:00:39 -0600 (Mon, 08 Mar 2010) | 1 line
Add various items
........
................
r79252 | benjamin.peterson | 2010-03-21 15:05:32 -0700 (Sun, 21 Mar 2010) | 1 line
sync 2.7.rst with trunk
................
r79253 | benjamin.peterson | 2010-03-21 15:21:53 -0700 (Sun, 21 Mar 2010) | 79 lines
Blocked revisions 78272,78580,78707,78709-78710,78712-78713,78811,78974,79096,79105,79123,79125,79165,79187-79189,79191 via svnmerge
........
r78272 | ezio.melotti | 2010-02-20 16:34:21 -0600 (Sat, 20 Feb 2010) | 1 line
skip tests with a non-ascii cwd when the file system encoding is ascii
........
r78580 | andrew.kuchling | 2010-03-02 07:55:33 -0600 (Tue, 02 Mar 2010) | 1 line
Add an item
........
r78707 | tarek.ziade | 2010-03-05 19:18:27 -0600 (Fri, 05 Mar 2010) | 1 line
provide a fallback for xxmodule.c in case the buildir is not present
........
r78709 | tarek.ziade | 2010-03-05 19:23:21 -0600 (Fri, 05 Mar 2010) | 1 line
simplified the fallback case
........
r78710 | tarek.ziade | 2010-03-05 19:27:09 -0600 (Fri, 05 Mar 2010) | 1 line
files used by win32 tests
........
r78712 | tarek.ziade | 2010-03-05 20:11:14 -0600 (Fri, 05 Mar 2010) | 1 line
fixed various failures and environment alterations in distutils.test_build_ext
........
r78713 | tarek.ziade | 2010-03-05 20:17:28 -0600 (Fri, 05 Mar 2010) | 1 line
search in the alternative location for VCExpress
........
r78811 | raymond.hettinger | 2010-03-09 03:01:46 -0600 (Tue, 09 Mar 2010) | 4 lines
Add nicer docstrings to namedtuples().
Provides better tooltips and looks better in help().
........
r78974 | matthias.klose | 2010-03-15 07:46:18 -0500 (Mon, 15 Mar 2010) | 2 lines
- Issue #6949: Allow the _bsddb extension to be built with db-4.8.x.
........
r79096 | matthias.klose | 2010-03-19 09:45:06 -0500 (Fri, 19 Mar 2010) | 2 lines
- Issue #1039, #8154: Fix os.execlp() crash with missing 2nd argument.
........
r79105 | thomas.heller | 2010-03-19 14:59:30 -0500 (Fri, 19 Mar 2010) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-79104" from
svn+ssh://pythondev@svn.python.org/python/branches/branch_libffi-3_0_10-win
........
r79123 | sean.reifschneider | 2010-03-19 18:19:55 -0500 (Fri, 19 Mar 2010) | 2 lines
Adding an example of reproducing the rfc822.Message() parsing.
........
r79125 | sean.reifschneider | 2010-03-19 19:05:42 -0500 (Fri, 19 Mar 2010) | 2 lines
Fixing the file call in the rfc822.Message replacement example.
........
r79165 | florent.xicluna | 2010-03-20 20:14:24 -0500 (Sat, 20 Mar 2010) | 2 lines
#7092 - Silence more py3k deprecation warnings, using test_support.check_py3k_warnings() helper.
........
r79187 | florent.xicluna | 2010-03-21 05:50:44 -0500 (Sun, 21 Mar 2010) | 2 lines
Silence more py3k warnings in unittest.case.
........
r79188 | florent.xicluna | 2010-03-21 05:51:40 -0500 (Sun, 21 Mar 2010) | 2 lines
Fix py3k warnings in test_decimal, using unittest.assertItemsEqual.
........
r79189 | florent.xicluna | 2010-03-21 06:03:21 -0500 (Sun, 21 Mar 2010) | 2 lines
Silence some py3k SyntaxWarning using check_py3k_warnings() with "exec" statements.
........
r79191 | florent.xicluna | 2010-03-21 06:50:17 -0500 (Sun, 21 Mar 2010) | 3 lines
No more deprecation warnings for distutils.sysconfig, following r78666.
But when the "dl" module is available, it gives a py3k deprecation warning.
........
................
r79255 | benjamin.peterson | 2010-03-21 15:36:19 -0700 (Sun, 21 Mar 2010) | 56 lines
Merged revisions 78338,78345-78346,78561-78562,78566,78574,78581,78634,78660,78675 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78338 | andrew.kuchling | 2010-02-22 15:04:02 -0600 (Mon, 22 Feb 2010) | 4 lines
Remove Tools/modulator, a reference to it in the docs, and a screenshot of it.
(I asked the BDFL first, and he approved removing it. The last actual bugfix
to Tools/modulator was in 2001; since then all changes have been search-and-replace:
string methods, whitespace fixes, etc.)
........
r78345 | andrew.kuchling | 2010-02-22 17:10:52 -0600 (Mon, 22 Feb 2010) | 1 line
#7706: DONT_HAVE_ERRNO_H is no longer defined by configure (after rev.46819).
........
r78346 | andrew.kuchling | 2010-02-22 17:12:00 -0600 (Mon, 22 Feb 2010) | 1 line
#7706: add include guards where they're missing; required for Windows CE
........
r78561 | andrew.kuchling | 2010-03-01 13:51:43 -0600 (Mon, 01 Mar 2010) | 1 line
#7191: describe more details of wbits parameter
........
r78562 | andrew.kuchling | 2010-03-01 14:11:57 -0600 (Mon, 01 Mar 2010) | 1 line
#7637: avoid repeated-concatenation antipattern in example
........
r78566 | barry.warsaw | 2010-03-01 15:46:51 -0600 (Mon, 01 Mar 2010) | 4 lines
Manually copy patch for bug 7250 from the release26-maint branch. I suck
because I did this in the wrong order and couldn't smack svnmerge into
submission.
........
r78574 | benjamin.peterson | 2010-03-01 17:25:13 -0600 (Mon, 01 Mar 2010) | 1 line
remove CVS id
........
r78581 | michael.foord | 2010-03-02 08:22:15 -0600 (Tue, 02 Mar 2010) | 1 line
Link correction in documentation.
........
r78634 | benjamin.peterson | 2010-03-03 15:28:25 -0600 (Wed, 03 Mar 2010) | 1 line
rephrase
........
r78660 | dirkjan.ochtman | 2010-03-04 13:21:53 -0600 (Thu, 04 Mar 2010) | 4 lines
Try to fix buildbot breakage from r78384.
Thanks bitdancer and briancurtin for the help.
........
r78675 | florent.xicluna | 2010-03-04 19:12:14 -0600 (Thu, 04 Mar 2010) | 2 lines
These line should not be there.
........
................
r79256 | benjamin.peterson | 2010-03-21 15:42:02 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 78779 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78779 | benjamin.peterson | 2010-03-07 20:11:06 -0600 (Sun, 07 Mar 2010) | 1 line
remove svn:executable from scripts without a shebang line
........
................
r79257 | benjamin.peterson | 2010-03-21 15:46:35 -0700 (Sun, 21 Mar 2010) | 8 lines
Blocked revisions 78722 via svnmerge
........
r78722 | florent.xicluna | 2010-03-06 05:01:08 -0600 (Sat, 06 Mar 2010) | 2 lines
#6906: TCL_LIBRARY and TK_LIBRARY environment variables should be encoded.
........
................
r79258 | benjamin.peterson | 2010-03-21 15:50:04 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 78417 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78417 | dirkjan.ochtman | 2010-02-23 22:49:00 -0600 (Tue, 23 Feb 2010) | 1 line
Issue #7427: improve the representation of httplib.BadStatusLine exceptions.
........
................
r79259 | benjamin.peterson | 2010-03-21 16:13:07 -0700 (Sun, 21 Mar 2010) | 65 lines
Merged revisions 78966,78970,79018,79026-79027,79055,79156,79159,79163-79164,79173,79176,79194,79208,79212 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78966 | florent.xicluna | 2010-03-14 10:20:59 -0500 (Sun, 14 Mar 2010) | 2 lines
Do not hardcode Expat version. It's possible to build Python with --with-system-expat option.
........
r78970 | benjamin.peterson | 2010-03-14 21:58:24 -0500 (Sun, 14 Mar 2010) | 1 line
this little exception dance is pointless
........
r79018 | collin.winter | 2010-03-16 22:04:01 -0500 (Tue, 16 Mar 2010) | 1 line
Delete unused import.
........
r79026 | vinay.sajip | 2010-03-17 10:05:57 -0500 (Wed, 17 Mar 2010) | 1 line
Issue #8162: logging: Clarified docstring and documentation for disable function.
........
r79027 | collin.winter | 2010-03-17 12:36:16 -0500 (Wed, 17 Mar 2010) | 1 line
Avoid hardcoding refcounts in tests.
........
r79055 | benjamin.peterson | 2010-03-18 16:30:48 -0500 (Thu, 18 Mar 2010) | 1 line
remove installation of deleted test/output dir
........
r79156 | florent.xicluna | 2010-03-20 17:21:02 -0500 (Sat, 20 Mar 2010) | 2 lines
Cleanup test_struct using check_warnings.
........
r79159 | florent.xicluna | 2010-03-20 17:26:42 -0500 (Sat, 20 Mar 2010) | 2 lines
Cleanup test_tarfile, and use check_warnings.
........
r79163 | michael.foord | 2010-03-20 19:53:39 -0500 (Sat, 20 Mar 2010) | 1 line
A faulty load_tests in a test module no longer halts test discovery. A placeholder test, that reports the failure, is created instead.
........
r79164 | michael.foord | 2010-03-20 19:55:58 -0500 (Sat, 20 Mar 2010) | 1 line
Change order of arguments in a unittest function.
........
r79173 | georg.brandl | 2010-03-21 04:09:38 -0500 (Sun, 21 Mar 2010) | 1 line
Document that GzipFile supports iteration.
........
r79176 | georg.brandl | 2010-03-21 04:17:41 -0500 (Sun, 21 Mar 2010) | 1 line
Introduce copy by slicing, used in later chapters.
........
r79194 | florent.xicluna | 2010-03-21 06:58:11 -0500 (Sun, 21 Mar 2010) | 2 lines
Use assertRaises and add a specific warning filter.
........
r79208 | andrew.kuchling | 2010-03-21 13:47:12 -0500 (Sun, 21 Mar 2010) | 1 line
Add items
........
r79212 | georg.brandl | 2010-03-21 14:01:38 -0500 (Sun, 21 Mar 2010) | 1 line
Fix plural.
........
................
r79260 | benjamin.peterson | 2010-03-21 16:17:57 -0700 (Sun, 21 Mar 2010) | 13 lines
Merged revisions 79138-79139 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79138 | benjamin.peterson | 2010-03-20 11:16:44 -0500 (Sat, 20 Mar 2010) | 1 line
document exitfunc fixer
........
r79139 | benjamin.peterson | 2010-03-20 11:17:37 -0500 (Sat, 20 Mar 2010) | 1 line
wrap
........
................
r79262 | benjamin.peterson | 2010-03-21 16:25:07 -0700 (Sun, 21 Mar 2010) | 9 lines
Recorded merge of revisions 79047 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79047 | senthil.kumaran | 2010-03-18 07:14:15 -0500 (Thu, 18 Mar 2010) | 3 lines
Fix for Issue8135 - urllib.unquote to support mixed percent escapes
........
................
r79264 | benjamin.peterson | 2010-03-21 17:15:53 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 79263 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79263 | michael.foord | 2010-03-21 19:06:30 -0500 (Sun, 21 Mar 2010) | 1 line
Issue 7815. __unittest in module globals trims frames from reported stacktraces in unittest.
........
................
r79267 | benjamin.peterson | 2010-03-21 18:13:48 -0700 (Sun, 21 Mar 2010) | 13 lines
Merged revisions 79265-79266 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79265 | michael.foord | 2010-03-21 20:01:34 -0500 (Sun, 21 Mar 2010) | 1 line
-f/--failfast command line option for unittest. Issue 8074. Documentation still needed. Plus minor change to test_unittest to allow it to be run with python -m test.unittest
........
r79266 | michael.foord | 2010-03-21 20:02:23 -0500 (Sun, 21 Mar 2010) | 1 line
Fix failing test committed by accident.
........
................
r79269 | benjamin.peterson | 2010-03-21 18:46:47 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 79268 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79268 | michael.foord | 2010-03-21 20:41:11 -0500 (Sun, 21 Mar 2010) | 1 line
Removing Python 2.3 compatibility code from unittest.
........
................
r79271 | victor.stinner | 2010-03-21 18:58:35 -0700 (Sun, 21 Mar 2010) | 4 lines
Issue #4282: Fix the main function of the profile module for a non-ASCII
script, open the file in binary mode and not in text mode with the default
(utf8) encoding.
................
r79273 | benjamin.peterson | 2010-03-21 19:02:37 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 79270 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79270 | michael.foord | 2010-03-21 20:56:54 -0500 (Sun, 21 Mar 2010) | 1 line
expected failure should not trigger failfast behavior in unittest.
........
................
r79275 | benjamin.peterson | 2010-03-21 19:53:52 -0700 (Sun, 21 Mar 2010) | 9 lines
Merged revisions 79274 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79274 | michael.foord | 2010-03-21 21:49:08 -0500 (Sun, 21 Mar 2010) | 1 line
Correct usage message displayed for python -m unittest -h
........
................
r79276 | victor.stinner | 2010-03-22 05:11:44 -0700 (Mon, 22 Mar 2010) | 7 lines
Fix a crash in _elementtree related to lone unicode surrogates.
Fix a segfault on:
>>> import _elementtree
>>> _elementtree.iterparse('/bin/sh', ("\uDC80", "\ud808\udf45"))
................
r79281 | victor.stinner | 2010-03-22 05:50:40 -0700 (Mon, 22 Mar 2010) | 16 lines
Merged revisions 79278,79280 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79278 | victor.stinner | 2010-03-22 13:24:37 +0100 (lun., 22 mars 2010) | 2 lines
Issue #1583863: An unicode subclass can now override the __str__ method
........
r79280 | victor.stinner | 2010-03-22 13:36:28 +0100 (lun., 22 mars 2010) | 5 lines
Fix the NEWS about my last commit: an unicode subclass can now override the
__unicode__ method (and not the __str__ method).
Simplify also the testcase.
........
................
r79287 | antoine.pitrou | 2010-03-22 07:49:10 -0700 (Mon, 22 Mar 2010) | 13 lines
Merged revisions 79226,79286 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79226 | antoine.pitrou | 2010-03-21 20:33:38 +0100 (dim., 21 mars 2010) | 4 lines
Issue #3890: Fix recv() and recv_into() on non-blocking SSL sockets.
........
r79286 | antoine.pitrou | 2010-03-22 15:41:48 +0100 (lun., 22 mars 2010) | 3 lines
Fix an occasional test_ftplib failure, following r79226.
........
................
r79289 | antoine.pitrou | 2010-03-22 08:07:09 -0700 (Mon, 22 Mar 2010) | 3 lines
Fix a blunder in r79287. This part is, obviously, poorly tested (if at all).
................
r79298 | r.david.murray | 2010-03-22 10:48:48 -0700 (Mon, 22 Mar 2010) | 11 lines
Merged revisions 79294 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79294 | r.david.murray | 2010-03-22 11:55:09 -0400 (Mon, 22 Mar 2010) | 4 lines
Issue #7860: platform.uname now reports the correct 'machine' type
when Python is running in WOW64 mode on 64 bit Windows. Patch by
Brian Curtin.
........
................
r79301 | antoine.pitrou | 2010-03-22 13:11:09 -0700 (Mon, 22 Mar 2010) | 11 lines
Merged revisions 79299 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79299 | antoine.pitrou | 2010-03-22 20:59:46 +0100 (lun., 22 mars 2010) | 5 lines
Issue #7512: shutil.copystat() could raise an OSError when the filesystem
didn't support chflags() (for example ZFS under FreeBSD). The error is
now silenced.
........
................
Added:
python/branches/py3k-jit/Doc/includes/email-headers.py
- copied unchanged from r79301, /python/branches/py3k/Doc/includes/email-headers.py
Removed:
python/branches/py3k-jit/Doc/library/objects.rst
python/branches/py3k-jit/Tools/modulator/
Modified:
python/branches/py3k-jit/ (props changed)
python/branches/py3k-jit/.hgignore
python/branches/py3k-jit/Demo/classes/Complex.py (props changed)
python/branches/py3k-jit/Demo/classes/Dates.py (props changed)
python/branches/py3k-jit/Demo/classes/Dbm.py (props changed)
python/branches/py3k-jit/Demo/classes/Range.py (props changed)
python/branches/py3k-jit/Demo/classes/Rev.py (props changed)
python/branches/py3k-jit/Demo/classes/Vec.py (props changed)
python/branches/py3k-jit/Demo/classes/bitvec.py (props changed)
python/branches/py3k-jit/Demo/md5test/md5driver.py (props changed)
python/branches/py3k-jit/Demo/pdist/FSProxy.py (props changed)
python/branches/py3k-jit/Demo/pdist/client.py (props changed)
python/branches/py3k-jit/Demo/pdist/cmdfw.py (props changed)
python/branches/py3k-jit/Demo/pdist/cmptree.py (props changed)
python/branches/py3k-jit/Demo/pdist/cvslib.py (props changed)
python/branches/py3k-jit/Demo/pdist/cvslock.py (props changed)
python/branches/py3k-jit/Demo/pdist/mac.py (props changed)
python/branches/py3k-jit/Demo/pdist/rcsclient.py (props changed)
python/branches/py3k-jit/Demo/pdist/rcslib.py (props changed)
python/branches/py3k-jit/Demo/pdist/security.py (props changed)
python/branches/py3k-jit/Demo/pdist/server.py (props changed)
python/branches/py3k-jit/Demo/pdist/sumtree.py (props changed)
python/branches/py3k-jit/Demo/sockets/broadcast.py (props changed)
python/branches/py3k-jit/Demo/sockets/ftp.py (props changed)
python/branches/py3k-jit/Demo/sockets/radio.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/Balloon.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/BtnBox.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/CmpImg.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/ComboBox.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/Control.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/DirList.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/DirTree.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/NoteBook.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/OptMenu.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/PanedWin.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/PopMenu.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/SHList1.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/SHList2.py (props changed)
python/branches/py3k-jit/Demo/tix/samples/Tree.py (props changed)
python/branches/py3k-jit/Demo/tkinter/guido/AttrDialog.py (props changed)
python/branches/py3k-jit/Demo/tkinter/guido/ManPage.py (props changed)
python/branches/py3k-jit/Demo/tkinter/guido/ShellWindow.py (props changed)
python/branches/py3k-jit/Demo/tkinter/guido/hanoi.py (props changed)
python/branches/py3k-jit/Demo/tkinter/guido/hello.py (props changed)
python/branches/py3k-jit/Demo/tkinter/guido/imagedraw.py (props changed)
python/branches/py3k-jit/Demo/tkinter/guido/imageview.py (props changed)
python/branches/py3k-jit/Demo/tkinter/guido/listtree.py (props changed)
python/branches/py3k-jit/Demo/tkinter/guido/wish.py (props changed)
python/branches/py3k-jit/Doc/distutils/sourcedist.rst
python/branches/py3k-jit/Doc/extending/extending.rst
python/branches/py3k-jit/Doc/extending/newtypes.rst
python/branches/py3k-jit/Doc/faq/windows.rst
python/branches/py3k-jit/Doc/includes/minidom-example.py
python/branches/py3k-jit/Doc/library/2to3.rst
python/branches/py3k-jit/Doc/library/argparse.rst
python/branches/py3k-jit/Doc/library/asyncore.rst
python/branches/py3k-jit/Doc/library/datetime.rst
python/branches/py3k-jit/Doc/library/doctest.rst
python/branches/py3k-jit/Doc/library/email-examples.rst
python/branches/py3k-jit/Doc/library/functions.rst
python/branches/py3k-jit/Doc/library/gzip.rst
python/branches/py3k-jit/Doc/library/index.rst
python/branches/py3k-jit/Doc/library/logging.rst
python/branches/py3k-jit/Doc/library/multiprocessing.rst
python/branches/py3k-jit/Doc/library/pdb.rst
python/branches/py3k-jit/Doc/library/random.rst
python/branches/py3k-jit/Doc/library/shutil.rst
python/branches/py3k-jit/Doc/library/sqlite3.rst
python/branches/py3k-jit/Doc/library/stdtypes.rst
python/branches/py3k-jit/Doc/library/subprocess.rst
python/branches/py3k-jit/Doc/library/sys.rst
python/branches/py3k-jit/Doc/library/sysconfig.rst
python/branches/py3k-jit/Doc/library/test.rst
python/branches/py3k-jit/Doc/library/threading.rst
python/branches/py3k-jit/Doc/library/unittest.rst
python/branches/py3k-jit/Doc/library/xml.dom.minidom.rst
python/branches/py3k-jit/Doc/library/xml.etree.elementtree.rst
python/branches/py3k-jit/Doc/library/zipfile.rst
python/branches/py3k-jit/Doc/library/zlib.rst
python/branches/py3k-jit/Doc/reference/expressions.rst
python/branches/py3k-jit/Doc/reference/simple_stmts.rst
python/branches/py3k-jit/Doc/tutorial/datastructures.rst
python/branches/py3k-jit/Doc/tutorial/introduction.rst
python/branches/py3k-jit/Doc/whatsnew/2.7.rst
python/branches/py3k-jit/Lib/compileall.py
python/branches/py3k-jit/Lib/ctypes/test/test_internals.py
python/branches/py3k-jit/Lib/http/client.py
python/branches/py3k-jit/Lib/logging/__init__.py
python/branches/py3k-jit/Lib/macpath.py
python/branches/py3k-jit/Lib/mailbox.py
python/branches/py3k-jit/Lib/pipes.py
python/branches/py3k-jit/Lib/platform.py
python/branches/py3k-jit/Lib/profile.py
python/branches/py3k-jit/Lib/shutil.py
python/branches/py3k-jit/Lib/ssl.py
python/branches/py3k-jit/Lib/test/regrtest.py
python/branches/py3k-jit/Lib/test/test_builtin.py
python/branches/py3k-jit/Lib/test/test_bytes.py
python/branches/py3k-jit/Lib/test/test_cgi.py
python/branches/py3k-jit/Lib/test/test_descr.py
python/branches/py3k-jit/Lib/test/test_extcall.py
python/branches/py3k-jit/Lib/test/test_ftplib.py
python/branches/py3k-jit/Lib/test/test_global.py
python/branches/py3k-jit/Lib/test/test_http_cookies.py
python/branches/py3k-jit/Lib/test/test_httplib.py
python/branches/py3k-jit/Lib/test/test_imp.py
python/branches/py3k-jit/Lib/test/test_importhooks.py
python/branches/py3k-jit/Lib/test/test_inspect.py
python/branches/py3k-jit/Lib/test/test_mailbox.py
python/branches/py3k-jit/Lib/test/test_pep277.py
python/branches/py3k-jit/Lib/test/test_pipes.py
python/branches/py3k-jit/Lib/test/test_platform.py
python/branches/py3k-jit/Lib/test/test_posix.py
python/branches/py3k-jit/Lib/test/test_set.py
python/branches/py3k-jit/Lib/test/test_tarfile.py
python/branches/py3k-jit/Lib/test/test_tempfile.py
python/branches/py3k-jit/Lib/test/test_thread.py
python/branches/py3k-jit/Lib/test/test_unicode.py
python/branches/py3k-jit/Lib/test/test_unittest.py
python/branches/py3k-jit/Lib/test/test_xml_etree.py
python/branches/py3k-jit/Lib/unittest/__init__.py
python/branches/py3k-jit/Lib/unittest/__main__.py
python/branches/py3k-jit/Lib/unittest/case.py
python/branches/py3k-jit/Lib/unittest/loader.py
python/branches/py3k-jit/Lib/unittest/main.py
python/branches/py3k-jit/Lib/unittest/result.py
python/branches/py3k-jit/Lib/unittest/runner.py
python/branches/py3k-jit/Lib/unittest/suite.py
python/branches/py3k-jit/Lib/unittest/util.py
python/branches/py3k-jit/Mac/BuildScript/build-installer.py
python/branches/py3k-jit/Makefile.pre.in
python/branches/py3k-jit/Misc/ACKS
python/branches/py3k-jit/Misc/NEWS
python/branches/py3k-jit/Misc/Porting
python/branches/py3k-jit/Modules/_cursesmodule.c (contents, props changed)
python/branches/py3k-jit/Modules/_elementtree.c
python/branches/py3k-jit/Modules/_io/fileio.c
python/branches/py3k-jit/Modules/signalmodule.c
python/branches/py3k-jit/Objects/unicodeobject.c
python/branches/py3k-jit/Parser/myreadline.c
python/branches/py3k-jit/Python/ceval.c
python/branches/py3k-jit/Tools/README
python/branches/py3k-jit/Tools/scripts/mailerdaemon.py (props changed)
python/branches/py3k-jit/Tools/scripts/reindent-rst.py
Modified: python/branches/py3k-jit/.hgignore
==============================================================================
--- python/branches/py3k-jit/.hgignore (original)
+++ python/branches/py3k-jit/.hgignore Mon Mar 22 22:57:17 2010
@@ -1,8 +1,8 @@
.gdb_history
.purify
.svn
-Makefile
-Makefile.pre
+Makefile$
+Makefile.pre$
TAGS
autom4te.cache
build
Modified: python/branches/py3k-jit/Doc/distutils/sourcedist.rst
==============================================================================
--- python/branches/py3k-jit/Doc/distutils/sourcedist.rst (original)
+++ python/branches/py3k-jit/Doc/distutils/sourcedist.rst Mon Mar 22 22:57:17 2010
@@ -54,9 +54,9 @@
requires the :program:`compress` program. Notice that this format is now
pending for deprecation and will be removed in the future versions of Python.
-When using any ``tar`` format (``gztar``, ``bztar``, ``ztar`` or ``tar``), you
-can specify under Unix the ``owner`` and ``group`` names that will be set for
-each member of the archive.
+When using any ``tar`` format (``gztar``, ``bztar``, ``ztar`` or
+``tar``) under Unix, you can specify the ``owner`` and ``group`` names
+that will be set for each member of the archive.
For example, if you want all files of the archive to be owned by root::
Modified: python/branches/py3k-jit/Doc/extending/extending.rst
==============================================================================
--- python/branches/py3k-jit/Doc/extending/extending.rst (original)
+++ python/branches/py3k-jit/Doc/extending/extending.rst Mon Mar 22 22:57:17 2010
@@ -381,12 +381,7 @@
A more substantial example module is included in the Python source distribution
as :file:`Modules/xxmodule.c`. This file may be used as a template or simply
-read as an example. The :program:`modulator.py` script included in the source
-distribution or Windows install provides a simple graphical user interface for
-declaring the functions and objects which a module should implement, and can
-generate a template which can be filled in. The script lives in the
-:file:`Tools/modulator/` directory; see the :file:`README` file there for more
-information.
+read as an example.
.. _compilation:
Modified: python/branches/py3k-jit/Doc/extending/newtypes.rst
==============================================================================
--- python/branches/py3k-jit/Doc/extending/newtypes.rst (original)
+++ python/branches/py3k-jit/Doc/extending/newtypes.rst Mon Mar 22 22:57:17 2010
@@ -236,7 +236,7 @@
We've added an extra include::
- #include "structmember.h"
+ #include <structmember.h>
This include provides declarations that we use to handle attributes, as
described a bit later.
Modified: python/branches/py3k-jit/Doc/faq/windows.rst
==============================================================================
--- python/branches/py3k-jit/Doc/faq/windows.rst (original)
+++ python/branches/py3k-jit/Doc/faq/windows.rst Mon Mar 22 22:57:17 2010
@@ -445,13 +445,15 @@
How do I emulate os.kill() in Windows?
--------------------------------------
-Use win32api::
+To terminate a process, you can use ctypes::
+
+ import ctypes
def kill(pid):
"""kill function for Win32"""
- import win32api
- handle = win32api.OpenProcess(1, 0, pid)
- return (0 != win32api.TerminateProcess(handle, 0))
+ kernel32 = ctypes.windll.kernel32
+ handle = kernel32.OpenProcess(1, 0, pid)
+ return (0 != kernel32.TerminateProcess(handle, 0))
Why does os.path.isdir() fail on NT shared directories?
Modified: python/branches/py3k-jit/Doc/includes/minidom-example.py
==============================================================================
--- python/branches/py3k-jit/Doc/includes/minidom-example.py (original)
+++ python/branches/py3k-jit/Doc/includes/minidom-example.py Mon Mar 22 22:57:17 2010
@@ -19,11 +19,11 @@
dom = xml.dom.minidom.parseString(document)
def getText(nodelist):
- rc = ""
+ rc = []
for node in nodelist:
if node.nodeType == node.TEXT_NODE:
- rc = rc + node.data
- return rc
+ rc.append(node.data)
+ return ''.join(rc)
def handleSlideshow(slideshow):
print("<html>")
Modified: python/branches/py3k-jit/Doc/library/2to3.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/2to3.rst (original)
+++ python/branches/py3k-jit/Doc/library/2to3.rst Mon Mar 22 22:57:17 2010
@@ -130,8 +130,8 @@
Fixes dictionary iteration methods. :meth:`dict.iteritems` is converted to
:meth:`dict.items`, :meth:`dict.iterkeys` to :meth:`dict.keys`, and
:meth:`dict.itervalues` to :meth:`dict.values`. Similarly,
- :meth:`dict.viewitems`, :meth:`dict.viewkeys` and :meth:`dict.viewvalues`
- are converted respectively to :meth:`dict.items`, :meth:`dict.keys` and
+ :meth:`dict.viewitems`, :meth:`dict.viewkeys` and :meth:`dict.viewvalues` are
+ converted respectively to :meth:`dict.items`, :meth:`dict.keys` and
:meth:`dict.values`. It also wraps existing usages of :meth:`dict.items`,
:meth:`dict.keys`, and :meth:`dict.values` in a call to :class:`list`.
@@ -148,6 +148,11 @@
Removes usage of :func:`execfile`. The argument to :func:`execfile` is
wrapped in calls to :func:`open`, :func:`compile`, and :func:`exec`.
+.. 2to3fixer:: exitfunc
+
+ Changes assignment of :attr:`sys.exitfunc` to use of the :mod:`atexit`
+ module.
+
.. 2to3fixer:: filter
Wraps :func:`filter` usage in a :class:`list` call.
Modified: python/branches/py3k-jit/Doc/library/argparse.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/argparse.rst (original)
+++ python/branches/py3k-jit/Doc/library/argparse.rst Mon Mar 22 22:57:17 2010
@@ -4,7 +4,7 @@
.. module:: argparse
:synopsis: Command-line option and argument parsing library.
.. moduleauthor:: Steven Bethard <steven.bethard at gmail.com>
-.. versionadded:: 2.7
+.. versionadded:: 3.2
.. sectionauthor:: Steven Bethard <steven.bethard at gmail.com>
@@ -67,7 +67,7 @@
Creating a parser
^^^^^^^^^^^^^^^^^
-Mose uses of the :mod:`argparse` module will start out by creating an
+The first step in using the :mod:`argparse` is creating an
:class:`ArgumentParser` object::
>>> parser = argparse.ArgumentParser(description='Process some integers.')
Modified: python/branches/py3k-jit/Doc/library/asyncore.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/asyncore.rst (original)
+++ python/branches/py3k-jit/Doc/library/asyncore.rst Mon Mar 22 22:57:17 2010
@@ -201,7 +201,8 @@
.. method:: bind(address)
Bind the socket to *address*. The socket must not already be bound. (The
- format of *address* depends on the address family --- see above.) To mark
+ format of *address* depends on the address family --- refer to the
+ :mod:`socket` documentation for more information.) To mark
the socket as re-usable (setting the :const:`SO_REUSEADDR` option), call
the :class:`dispatcher` object's :meth:`set_reuse_addr` method.
Modified: python/branches/py3k-jit/Doc/library/datetime.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/datetime.rst (original)
+++ python/branches/py3k-jit/Doc/library/datetime.rst Mon Mar 22 22:57:17 2010
@@ -1454,8 +1454,8 @@
Note that there are unavoidable subtleties twice per year in a :class:`tzinfo`
subclass accounting for both standard and daylight time, at the DST transition
points. For concreteness, consider US Eastern (UTC -0500), where EDT begins the
-minute after 1:59 (EST) on the first Sunday in April, and ends the minute after
-1:59 (EDT) on the last Sunday in October::
+minute after 1:59 (EST) on the second Sunday in March, and ends the minute after
+1:59 (EDT) on the first Sunday in November::
UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM
EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM
Modified: python/branches/py3k-jit/Doc/library/doctest.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/doctest.rst (original)
+++ python/branches/py3k-jit/Doc/library/doctest.rst Mon Mar 22 22:57:17 2010
@@ -625,7 +625,7 @@
For example, this test passes::
- >>> print(range(20)) #doctest: +NORMALIZE_WHITESPACE
+ >>> print(list(range(20))) #doctest: +NORMALIZE_WHITESPACE
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
@@ -634,28 +634,28 @@
is on a single line. This test also passes, and also requires a directive to do
so::
- >>> print(range(20)) # doctest: +ELLIPSIS
+ >>> print(list(range(20))) # doctest: +ELLIPSIS
[0, 1, ..., 18, 19]
Multiple directives can be used on a single physical line, separated by commas::
- >>> print(range(20)) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
+ >>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
[0, 1, ..., 18, 19]
If multiple directive comments are used for a single example, then they are
combined::
- >>> print(range(20)) # doctest: +ELLIPSIS
- ... # doctest: +NORMALIZE_WHITESPACE
+ >>> print(list(range(20))) # doctest: +ELLIPSIS
+ ... # doctest: +NORMALIZE_WHITESPACE
[0, 1, ..., 18, 19]
As the previous example shows, you can add ``...`` lines to your example
containing only directives. This can be useful when an example is too long for
a directive to comfortably fit on the same line::
- >>> print(range(5) + range(10,20) + range(30,40) + range(50,60))
+ >>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))
... # doctest: +ELLIPSIS
- [0, ..., 4, 10, ..., 19, 30, ..., 39, 50, ..., 59]
+ [0, ..., 4, 10, ..., 19, 30, ..., 39]
Note that since all options are disabled by default, and directives apply only
to the example they appear in, enabling options (via ``+`` in a directive) is
Modified: python/branches/py3k-jit/Doc/library/email-examples.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/email-examples.rst (original)
+++ python/branches/py3k-jit/Doc/library/email-examples.rst Mon Mar 22 22:57:17 2010
@@ -11,6 +11,12 @@
.. literalinclude:: ../includes/email-simple.py
+And parsing RFC822 headers can easily be done by the parse(filename) or
+parsestr(message_as_string) methods of the Parser() class:
+
+.. literalinclude:: ../includes/email-headers.py
+
+
Here's an example of how to send a MIME message containing a bunch of family
pictures that may be residing in a directory:
Modified: python/branches/py3k-jit/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/functions.rst (original)
+++ python/branches/py3k-jit/Doc/library/functions.rst Mon Mar 22 22:57:17 2010
@@ -328,7 +328,7 @@
This function can also be used to execute arbitrary code objects (such as
those created by :func:`compile`). In this case pass a code object instead
of a string. If the code object has been compiled with ``'exec'`` as the
- *kind* argument, :func:`eval`\'s return value will be ``None``.
+ *mode* argument, :func:`eval`\'s return value will be ``None``.
Hints: dynamic execution of statements is supported by the :func:`exec`
function. The :func:`globals` and :func:`locals` functions
@@ -1008,7 +1008,8 @@
Has two optional arguments which must be specified as keyword arguments.
*key* specifies a function of one argument that is used to extract a comparison
- key from each list element: ``key=str.lower``. The default value is ``None``.
+ key from each list element: ``key=str.lower``. The default value is ``None``
+ (compare the elements directly).
*reverse* is a boolean value. If set to ``True``, then the list elements are
sorted as if each comparison were reversed.
Modified: python/branches/py3k-jit/Doc/library/gzip.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/gzip.rst (original)
+++ python/branches/py3k-jit/Doc/library/gzip.rst Mon Mar 22 22:57:17 2010
@@ -67,7 +67,7 @@
writing as *fileobj*, and retrieve the resulting memory buffer using the
:class:`StringIO` object's :meth:`getvalue` method.
- :class:`GzipFile` supports the :keyword:`with` statement.
+ :class:`GzipFile` supports iteration and the :keyword:`with` statement.
.. versionchanged:: 3.1
Support for the :keyword:`with` statement was added.
Modified: python/branches/py3k-jit/Doc/library/index.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/index.rst (original)
+++ python/branches/py3k-jit/Doc/library/index.rst Mon Mar 22 22:57:17 2010
@@ -43,7 +43,6 @@
intro.rst
functions.rst
constants.rst
- objects.rst
stdtypes.rst
exceptions.rst
Modified: python/branches/py3k-jit/Doc/library/logging.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/logging.rst (original)
+++ python/branches/py3k-jit/Doc/library/logging.rst Mon Mar 22 22:57:17 2010
@@ -734,7 +734,11 @@
Provides an overriding level *lvl* for all loggers which takes precedence over
the logger's own level. When the need arises to temporarily throttle logging
- output down across the whole application, this function can be useful.
+ output down across the whole application, this function can be useful. Its
+ effect is to disable all logging calls of severity *lvl* and below, so that
+ if you call it with a value of INFO, then all INFO and DEBUG events would be
+ discarded, whereas those of severity WARNING and above would be processed
+ according to the logger's effective level.
.. function:: addLevelName(lvl, levelName)
Modified: python/branches/py3k-jit/Doc/library/multiprocessing.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/multiprocessing.rst (original)
+++ python/branches/py3k-jit/Doc/library/multiprocessing.rst Mon Mar 22 22:57:17 2010
@@ -1131,7 +1131,7 @@
Create a BaseManager object.
- Once created one should call :meth:`start` or :meth:`serve_forever` to ensure
+ Once created one should call :meth:`start` or ``get_server().serve_forever()`` to ensure
that the manager object refers to a started manager process.
*address* is the address on which the manager process listens for new
@@ -1147,10 +1147,6 @@
Start a subprocess to start the manager. If *initializer* is not ``None``
then the subprocess will call ``initializer(*initargs)`` when it starts.
- .. method:: serve_forever()
-
- Run the server in the current process.
-
.. method:: get_server()
Returns a :class:`Server` object which represents the actual server under
Deleted: python/branches/py3k-jit/Doc/library/objects.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/objects.rst Mon Mar 22 22:57:17 2010
+++ (empty file)
@@ -1,27 +0,0 @@
-
-.. _builtin:
-
-****************
-Built-in Objects
-****************
-
-.. index::
- pair: built-in; types
- pair: built-in; exceptions
- pair: built-in; functions
- pair: built-in; constants
- single: symbol table
-
-Names for built-in exceptions and functions and a number of constants are found
-in a separate symbol table. This table is searched last when the interpreter
-looks up the meaning of a name, so local and global user-defined names can
-override built-in names. Built-in types are described together here for easy
-reference.
-
-The tables in this chapter document the priorities of operators by listing them
-in order of ascending priority (within a table) and grouping operators that have
-the same priority in the same box. Binary operators of the same priority group
-from left to right. (Unary operators group from right to left, but there you
-have no real choice.) See :ref:`operator-summary` for the complete picture on
-operator priorities.
-
Modified: python/branches/py3k-jit/Doc/library/pdb.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/pdb.rst (original)
+++ python/branches/py3k-jit/Doc/library/pdb.rst Mon Mar 22 22:57:17 2010
@@ -22,7 +22,7 @@
The debugger is extensible --- it is actually defined as the class :class:`Pdb`.
This is currently undocumented but easily understood by reading the source. The
-extension interface uses the modules :mod:`bdb` (undocumented) and :mod:`cmd`.
+extension interface uses the modules :mod:`bdb` and :mod:`cmd`.
The debugger's prompt is ``(Pdb)``. Typical usage to run a program under control
of the debugger is::
Modified: python/branches/py3k-jit/Doc/library/random.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/random.rst (original)
+++ python/branches/py3k-jit/Doc/library/random.rst Mon Mar 22 22:57:17 2010
@@ -35,6 +35,18 @@
Optionally, a new generator can supply a :meth:`getrandbits` method --- this
allows :meth:`randrange` to produce selections over an arbitrarily large range.
+As an example of subclassing, the :mod:`random` module provides the
+:class:`WichmannHill` class that implements an alternative generator in pure
+Python. The class provides a backward compatible way to reproduce results from
+earlier versions of Python, which used the Wichmann-Hill algorithm as the core
+generator. Note that this Wichmann-Hill generator can no longer be recommended:
+its period is too short by contemporary standards, and the sequence generated is
+known to fail some stringent randomness tests. See the references below for a
+recent variant that repairs these flaws.
+
+The :mod:`random` module also provides the :class:`SystemRandom` class which
+uses the system function :func:`os.urandom` to generate random numbers
+from sources provided by the operating system.
Bookkeeping functions:
Modified: python/branches/py3k-jit/Doc/library/shutil.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/shutil.rst (original)
+++ python/branches/py3k-jit/Doc/library/shutil.rst Mon Mar 22 22:57:17 2010
@@ -236,7 +236,7 @@
*owner* and *group* are used when creating a tar archive. By default,
uses the current owner and group.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
.. function:: get_archive_formats()
@@ -255,7 +255,7 @@
You can register new formats or provide your own archiver for any existing
formats, by using :func:`register_archive_format`.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
.. function:: register_archive_format(name, function, [extra_args, [description]])
@@ -269,14 +269,14 @@
*description* is used by :func:`get_archive_formats` which returns the
list of archivers. Defaults to an empty list.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
.. function:: unregister_archive_format(name)
Remove the archive format *name* from the list of supported formats.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
Archiving example
Modified: python/branches/py3k-jit/Doc/library/sqlite3.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/sqlite3.rst (original)
+++ python/branches/py3k-jit/Doc/library/sqlite3.rst Mon Mar 22 22:57:17 2010
@@ -90,7 +90,7 @@
.. seealso::
- http://www.pysqlite.org
+ http://code.google.com/p/pysqlite/
The pysqlite web page -- sqlite3 is developed externally under the name
"pysqlite".
@@ -367,7 +367,7 @@
.. method:: Connection.enable_load_extension(enabled)
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
This routine allows/disallows the SQLite engine to load SQLite extensions
from shared libraries. SQLite extensions can define new functions,
@@ -378,7 +378,7 @@
.. method:: Connection.load_extension(path)
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
This routine loads a SQLite extension from a shared library. You have to
enable extension loading with ``enable_load_extension`` before you can use
Modified: python/branches/py3k-jit/Doc/library/stdtypes.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/stdtypes.rst (original)
+++ python/branches/py3k-jit/Doc/library/stdtypes.rst Mon Mar 22 22:57:17 2010
@@ -920,12 +920,12 @@
.. method:: str.format(*args, **kwargs)
- Perform a string formatting operation. The *format_string* argument can
- contain literal text or replacement fields delimited by braces ``{}``. Each
- replacement field contains either the numeric index of a positional argument,
- or the name of a keyword argument. Returns a copy of *format_string* where
- each replacement field is replaced with the string value of the corresponding
- argument.
+ Perform a string formatting operation. The string on which this method is
+ called can contain literal text or replacement fields delimited by braces
+ ``{}``. Each replacement field contains either the numeric index of a
+ positional argument, or the name of a keyword argument. Returns a copy of
+ the string where each replacement field is replaced with the string value of
+ the corresponding argument.
>>> "The sum of 1 + 2 is {0}".format(1+2)
'The sum of 1 + 2 is 3'
@@ -1704,6 +1704,10 @@
altered after it is created; it can therefore be used as a dictionary key or as
an element of another set.
+Non-empty sets (not frozensets) can be created by placing a comma-separated list
+of elements within braces, for example: ``{'jack', 'sjoerd'}``, in addition to the
+:class:`set` constructor.
+
The constructors for both classes work the same:
.. class:: set([iterable])
Modified: python/branches/py3k-jit/Doc/library/subprocess.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/subprocess.rst (original)
+++ python/branches/py3k-jit/Doc/library/subprocess.rst Mon Mar 22 22:57:17 2010
@@ -210,7 +210,7 @@
Run command with arguments. Wait for command to complete, then return the
:attr:`returncode` attribute.
- The arguments are the same as for the Popen constructor. Example::
+ The arguments are the same as for the :class:`Popen` constructor. Example::
>>> retcode = subprocess.call(["ls", "-l"])
@@ -229,7 +229,7 @@
:exc:`CalledProcessError` object will have the return code in the
:attr:`returncode` attribute.
- The arguments are the same as for the Popen constructor. Example::
+ The arguments are the same as for the :class:`Popen` constructor. Example::
>>> subprocess.check_call(["ls", "-l"])
0
@@ -423,6 +423,9 @@
The process ID of the child process.
+ Note that if you set the *shell* argument to ``True``, this is the process ID
+ of the spawned shell.
+
.. attribute:: Popen.returncode
Modified: python/branches/py3k-jit/Doc/library/sys.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/sys.rst (original)
+++ python/branches/py3k-jit/Doc/library/sys.rst Mon Mar 22 22:57:17 2010
@@ -127,13 +127,12 @@
.. index:: object: traceback
- If no exception is being handled anywhere on the stack, a tuple containing three
- ``None`` values is returned. Otherwise, the values returned are ``(type, value,
- traceback)``. Their meaning is: *type* gets the exception type of the exception
- being handled (a class object); *value* gets the exception parameter (its
- :dfn:`associated value` or the second argument to :keyword:`raise`, which is
- always a class instance if the exception type is a class object); *traceback*
- gets a traceback object (see the Reference Manual) which encapsulates the call
+ If no exception is being handled anywhere on the stack, a tuple containing
+ three ``None`` values is returned. Otherwise, the values returned are
+ ``(type, value, traceback)``. Their meaning is: *type* gets the type of the
+ exception being handled (a subclass of :exc:`BaseException`); *value* gets
+ the exception instance (an instance of the exception type); *traceback* gets
+ a traceback object (see the Reference Manual) which encapsulates the call
stack at the point where the exception originally occurred.
.. warning::
@@ -508,9 +507,7 @@
more information.)
The meaning of the variables is the same as that of the return values from
- :func:`exc_info` above. (Since there is only one interactive thread,
- thread-safety is not a concern for these variables, unlike for ``exc_type``
- etc.)
+ :func:`exc_info` above.
.. data:: maxsize
@@ -819,6 +816,10 @@
available only if Python was compiled with :option:`--with-tsc`. To understand
the output of this dump, read :file:`Python/ceval.c` in the Python sources.
+ .. impl-detail::
+ This function is intimately bound to CPython implementation details and
+ thus not likely to be implemented elsewhere.
+
.. data:: stdin
stdout
Modified: python/branches/py3k-jit/Doc/library/sysconfig.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/sysconfig.rst (original)
+++ python/branches/py3k-jit/Doc/library/sysconfig.rst Mon Mar 22 22:57:17 2010
@@ -5,7 +5,7 @@
:synopsis: Python's configuration information
.. moduleauthor:: Tarek Ziade <tarek at ziade.org>
.. sectionauthor:: Tarek Ziade <tarek at ziade.org>
-.. versionadded:: 2.7
+.. versionadded:: 3.2
.. index::
single: configuration information
Modified: python/branches/py3k-jit/Doc/library/test.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/test.rst (original)
+++ python/branches/py3k-jit/Doc/library/test.rst Mon Mar 22 22:57:17 2010
@@ -324,7 +324,7 @@
w.reset()
assert len(w.warnings) == 0
- .. versionchanged:: 2.7
+ .. versionchanged:: 3.2
New optional attributes ``*filters`` and ``quiet``.
Modified: python/branches/py3k-jit/Doc/library/threading.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/threading.rst (original)
+++ python/branches/py3k-jit/Doc/library/threading.rst Mon Mar 22 22:57:17 2010
@@ -647,9 +647,6 @@
Return true if and only if the internal flag is true.
- .. versionchanged:: 2.6
- The ``is_set()`` syntax is new.
-
.. method:: set()
Set the internal flag to true. All threads waiting for it to become true
Modified: python/branches/py3k-jit/Doc/library/unittest.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/unittest.rst (original)
+++ python/branches/py3k-jit/Doc/library/unittest.rst Mon Mar 22 22:57:17 2010
@@ -785,7 +785,7 @@
will be included in the error message. This method is used by default
when comparing strings with :meth:`assertEqual`.
- If specified *msg* will be used as the error message on failure.
+ If specified, *msg* will be used as the error message on failure.
.. versionadded:: 3.1
@@ -806,7 +806,7 @@
Tests that *first* is or is not in *second* with an explanatory error
message as appropriate.
- If specified *msg* will be used as the error message on failure.
+ If specified, *msg* will be used as the error message on failure.
.. versionadded:: 3.1
@@ -819,12 +819,31 @@
Duplicate elements are ignored when comparing *actual* and *expected*.
It is the equivalent of ``assertEqual(set(expected), set(actual))``
- but it works with sequences of unhashable objects as well.
+ but it works with sequences of unhashable objects as well. Because
+ duplicates are ignored, this method has been deprecated in favour of
+ :meth:`assertItemsEqual`.
- If specified *msg* will be used as the error message on failure.
+ If specified, *msg* will be used as the error message on failure.
.. versionadded:: 3.1
+ .. deprecated:: 3.2
+
+ .. method:: assertItemsEqual(actual, expected, msg=None)
+
+ Test that sequence *expected* contains the same elements as *actual*,
+ regardless of their order. When they don't, an error message listing the
+ differences between the sequences will be generated.
+
+ Duplicate elements are *not* ignored when comparing *actual* and
+ *expected*. It verifies if each element has the same count in both
+ sequences. It is the equivalent of ``assertEqual(sorted(expected),
+ sorted(actual))`` but it works with sequences of unhashable objects as
+ well.
+
+ If specified, *msg* will be used as the error message on failure.
+
+ .. versionadded:: 3.2
.. method:: assertSetEqual(set1, set2, msg=None)
@@ -835,7 +854,7 @@
Fails if either of *set1* or *set2* does not have a :meth:`set.difference`
method.
- If specified *msg* will be used as the error message on failure.
+ If specified, *msg* will be used as the error message on failure.
.. versionadded:: 3.1
@@ -847,7 +866,7 @@
method will be used by default to compare dictionaries in
calls to :meth:`assertEqual`.
- If specified *msg* will be used as the error message on failure.
+ If specified, *msg* will be used as the error message on failure.
.. versionadded:: 3.1
@@ -858,7 +877,7 @@
superset of those in *expected*. If not, an error message listing
the missing keys and mismatched values is generated.
- If specified *msg* will be used as the error message on failure.
+ If specified, *msg* will be used as the error message on failure.
.. versionadded:: 3.1
@@ -872,7 +891,7 @@
These methods are used by default when comparing lists or tuples with
:meth:`assertEqual`.
- If specified *msg* will be used as the error message on failure.
+ If specified, *msg* will be used as the error message on failure.
.. versionadded:: 3.1
@@ -884,7 +903,7 @@
be raised. If the sequences are different an error message is
constructed that shows the difference between the two.
- If specified *msg* will be used as the error message on failure.
+ If specified, *msg* will be used as the error message on failure.
This method is used to implement :meth:`assertListEqual` and
:meth:`assertTupleEqual`.
@@ -1225,7 +1244,7 @@
:class:`TestLoader` objects have the following methods:
-
+a
.. method:: loadTestsFromTestCase(testCaseClass)
Return a suite of all tests cases contained in the :class:`TestCase`\ -derived
Modified: python/branches/py3k-jit/Doc/library/xml.dom.minidom.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/xml.dom.minidom.rst (original)
+++ python/branches/py3k-jit/Doc/library/xml.dom.minidom.rst Mon Mar 22 22:57:17 2010
@@ -82,22 +82,12 @@
dom3 = parseString("<myxml>Some data</myxml>")
assert dom3.documentElement.tagName == "myxml"
-When you are finished with a DOM, you should clean it up. This is necessary
-because some versions of Python do not support garbage collection of objects
-that refer to each other in a cycle. Until this restriction is removed from all
-versions of Python, it is safest to write your code as if cycles would not be
-cleaned up.
-
-The way to clean up a DOM is to call its :meth:`unlink` method::
-
- dom1.unlink()
- dom2.unlink()
- dom3.unlink()
-
-:meth:`unlink` is a :mod:`xml.dom.minidom`\ -specific extension to the DOM API.
-After calling :meth:`unlink` on a node, the node and its descendants are
-essentially useless.
-
+When you are finished with a DOM tree, you may optionally call the
+:meth:`unlink` method to encourage early cleanup of the now-unneeded
+objects. :meth:`unlink` is a :mod:`xml.dom.minidom`\ -specific
+extension to the DOM API that renders the node and its descendants are
+essentially useless. Otherwise, Python's garbage collector will
+eventually take care of the objects in the tree.
.. seealso::
Modified: python/branches/py3k-jit/Doc/library/xml.etree.elementtree.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/xml.etree.elementtree.rst (original)
+++ python/branches/py3k-jit/Doc/library/xml.etree.elementtree.rst Mon Mar 22 22:57:17 2010
@@ -35,7 +35,7 @@
docs. Fredrik Lundh's page is also the location of the development version of
the xml.etree.ElementTree.
-.. versionchanged:: 2.7
+.. versionchanged:: 3.2
The ElementTree API is updated to 1.3. For more information, see
`Introducing ElementTree 1.3
<http://effbot.org/zone/elementtree-13-intro.htm>`_.
@@ -80,7 +80,7 @@
optional parser instance. If not given, the standard :class:`XMLParser`
parser is used. Returns an :class:`Element` instance.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
.. function:: iselement(element)
@@ -133,7 +133,7 @@
attributes in this namespace will be serialized with the given prefix, if at
all possible.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
.. function:: SubElement(parent, tag, attrib={}, **extra)
@@ -167,7 +167,7 @@
any specific sequence, except that ``"".join(tostringlist(element)) ==
tostring(element)``.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
.. function:: XML(text, parser=None)
@@ -282,7 +282,7 @@
Appends *subelements* from a sequence object with zero or more elements.
Raises :exc:`AssertionError` if a subelement is not a valid object.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
.. method:: find(match)
@@ -336,7 +336,7 @@
Finds all matching subelements, by tag name or path. Returns an iterable
yielding all matching elements in document order.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
.. method:: itertext()
@@ -344,7 +344,7 @@
Creates a text iterator. The iterator loops over this element and all
subelements, in document order, and returns all inner text.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
.. method:: makeelement(tag, attrib)
@@ -446,7 +446,7 @@
getroot().iterfind(match). Returns an iterable yielding all matching
elements in document order.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
.. method:: parse(source, parser=None)
@@ -559,7 +559,7 @@
the public identifier. *system* is the system identifier. This method
does not exist on the default :class:`TreeBuilder` class.
- .. versionadded:: 2.7
+ .. versionadded:: 3.2
.. _elementtree-xmlparser-objects:
Modified: python/branches/py3k-jit/Doc/library/zipfile.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/zipfile.rst (original)
+++ python/branches/py3k-jit/Doc/library/zipfile.rst Mon Mar 22 22:57:17 2010
@@ -288,7 +288,7 @@
member of the given :class:`ZipInfo` instance. By default, the
:class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`.
- .. versionchanged:: 2.7
+ .. versionchanged:: 3.2
The *compression_type* argument.
The following data attributes are also available:
Modified: python/branches/py3k-jit/Doc/library/zlib.rst
==============================================================================
--- python/branches/py3k-jit/Doc/library/zlib.rst (original)
+++ python/branches/py3k-jit/Doc/library/zlib.rst Mon Mar 22 22:57:17 2010
@@ -96,14 +96,18 @@
Decompresses the data in *string*, returning a string containing the
uncompressed data. The *wbits* parameter controls the size of the window
- buffer. If *bufsize* is given, it is used as the initial size of the output
+ buffer, and is discussed further below.
+ If *bufsize* is given, it is used as the initial size of the output
buffer. Raises the :exc:`error` exception if any error occurs.
The absolute value of *wbits* is the base two logarithm of the size of the
history buffer (the "window size") used when compressing data. Its absolute
value should be between 8 and 15 for the most recent versions of the zlib
library, larger values resulting in better compression at the expense of greater
- memory usage. The default value is 15. When *wbits* is negative, the standard
+ memory usage. When decompressing a stream, *wbits* must not be smaller
+ than the size originally used to compress the stream; using a too-small
+ value will result in an exception. The default value is therefore the
+ highest value, 15. When *wbits* is negative, the standard
:program:`gzip` header is suppressed; this is an undocumented feature of the
zlib library, used for compatibility with :program:`unzip`'s compression file
format.
Modified: python/branches/py3k-jit/Doc/reference/expressions.rst
==============================================================================
--- python/branches/py3k-jit/Doc/reference/expressions.rst (original)
+++ python/branches/py3k-jit/Doc/reference/expressions.rst Mon Mar 22 22:57:17 2010
@@ -1152,8 +1152,6 @@
Conditional Expressions
=======================
-.. versionadded:: 2.5
-
.. index::
pair: conditional; expression
pair: ternary; operator
Modified: python/branches/py3k-jit/Doc/reference/simple_stmts.rst
==============================================================================
--- python/branches/py3k-jit/Doc/reference/simple_stmts.rst (original)
+++ python/branches/py3k-jit/Doc/reference/simple_stmts.rst Mon Mar 22 22:57:17 2010
@@ -146,16 +146,12 @@
* Otherwise: the name is bound to the object in the global namespace or the
outer namespace determined by :keyword:`nonlocal`, respectively.
+ .. index:: single: destructor
+
The name is rebound if it was already bound. This may cause the reference
count for the object previously bound to the name to reach zero, causing the
object to be deallocated and its destructor (if it has one) to be called.
- .. index:: single: destructor
-
- The name is rebound if it was already bound. This may cause the reference count
- for the object previously bound to the name to reach zero, causing the object to
- be deallocated and its destructor (if it has one) to be called.
-
* If the target is a target list enclosed in parentheses or in square brackets:
The object must be an iterable with the same number of items as there are
targets in the target list, and its items are assigned, from left to right,
Modified: python/branches/py3k-jit/Doc/tutorial/datastructures.rst
==============================================================================
--- python/branches/py3k-jit/Doc/tutorial/datastructures.rst (original)
+++ python/branches/py3k-jit/Doc/tutorial/datastructures.rst Mon Mar 22 22:57:17 2010
@@ -153,6 +153,11 @@
>>> queue
['Michael', 'Terry', 'Graham']
+However, since lists are implemented as an array of elements, they are not the
+optimal data structure to use as a queue (the ``pop(0)`` needs to move all
+following elements). See :ref:`tut-list-tools` for a look at
+:class:`collections.deque`, which is designed to work efficiently as a queue.
+
.. _tut-listcomps:
Modified: python/branches/py3k-jit/Doc/tutorial/introduction.rst
==============================================================================
--- python/branches/py3k-jit/Doc/tutorial/introduction.rst (original)
+++ python/branches/py3k-jit/Doc/tutorial/introduction.rst Mon Mar 22 22:57:17 2010
@@ -482,6 +482,12 @@
>>> 3*a[:3] + ['Boo!']
['spam', 'eggs', 100, 'spam', 'eggs', 100, 'spam', 'eggs', 100, 'Boo!']
+All slice operations return a new list containing the requested elements. This
+means that the following slice returns a shallow copy of the list *a*::
+
+ >>> a[:]
+ ['spam', 'eggs', 100, 1234]
+
Unlike strings, which are *immutable*, it is possible to change individual
elements of a list::
Modified: python/branches/py3k-jit/Doc/whatsnew/2.7.rst
==============================================================================
--- python/branches/py3k-jit/Doc/whatsnew/2.7.rst (original)
+++ python/branches/py3k-jit/Doc/whatsnew/2.7.rst Mon Mar 22 22:57:17 2010
@@ -222,11 +222,70 @@
:pep:`378` - Format Specifier for Thousands Separator
PEP written by Raymond Hettinger; implemented by Eric Smith.
+PEP 389: The argparse Module for Parsing Command Lines
+======================================================
+
+XXX write this section.
+
+.. seealso::
+
+ :pep:`389` - argparse - New Command Line Parsing Module
+ PEP written and implemented by Steven Bethard.
+
+PEP 391: Dictionary-Based Configuration For Logging
+====================================================
+
+XXX write this section.
+
+.. seealso::
+
+ :pep:`391` - Dictionary-Based Configuration For Logging
+ PEP written and implemented by Vinay Sajip.
+
+PEP 3106: Dictionary Views
+====================================================
+
+XXX write this section.
+
+.. seealso::
+
+ :pep:`3106` - Revamping dict.keys(), .values() and .items()
+ PEP written by Guido van Rossum.
+ Backported to 2.7 by Alexandre Vassalotti; :issue:`1967`.
+
+
Other Language Changes
======================
Some smaller changes made to the core Python language are:
+* The syntax for set literals has been backported from Python 3.x.
+ Curly brackets are used to surround the contents of the resulting
+ mutable set; set literals are
+ distinguished from dictionaries by not containing colons and values.
+ ``{}`` continues to represent an empty dictionary; use
+ ``set()`` for an empty set.
+
+ >>> {1,2,3,4,5}
+ set([1, 2, 3, 4, 5])
+ >>> set()
+ set([])
+ >>> {}
+ {}
+
+ Backported by Alexandre Vassalotti; :issue:`2335`.
+
+* Dictionary and set comprehensions are another feature backported from
+ 3.x, generalizing list/generator comprehensions to use
+ the literal syntax for sets and dictionaries.
+
+ >>> {x:x*x for x in range(6)}
+ {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
+ >>> {'a'*x for x in range(6)}
+ set(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])
+
+ Backported by Alexandre Vassalotti; :issue:`2333`.
+
* The :keyword:`with` statement can now use multiple context managers
in one statement. Context managers are processed from left to right
and each one is treated as beginning a new :keyword:`with` statement.
@@ -363,7 +422,10 @@
* The :class:`file` object will now set the :attr:`filename` attribute
on the :exc:`IOError` exception when trying to open a directory
- on POSIX platforms. (Noted by Jan Kaliszewski; :issue:`4764`.)
+ on POSIX platforms (noted by Jan Kaliszewski; :issue:`4764`), and
+ now explicitly checks for and forbids writing to read-only file objects
+ instead of trusting the C library to catch and report the error
+ (fixed by Stefan Krah; :issue:`5677`).
* The Python tokenizer now translates line endings itself, so the
:func:`compile` built-in function can now accept code using any
@@ -375,6 +437,10 @@
Python3-warning mode, Python 2.7 will now warn about this odd usage.
(Noted by James Lingard; :issue:`7362`.)
+* When a module object is garbage-collected, the module's dictionary is
+ now only cleared if no one else is holding a reference to the
+ dictionary (:issue:`7140`).
+
.. ======================================================================
@@ -498,6 +564,10 @@
(Contributed by Maru Newby after a suggestion by
Senthil Kumaran; :issue:`5142`.)
+* The :mod:`binascii` module now supports the buffer API, so it can be
+ used with :class:`memoryview` instances and other similar buffer objects.
+ (Backported from 3.x by Florent Xicluna; :issue:`7703`.)
+
* The :mod:`bz2` module's :class:`BZ2File` now supports the context
management protocol, so you can write ``with bz2.BZ2File(...) as f: ...``.
(Contributed by Hagen Fuerstenau; :issue:`3860`.)
@@ -566,7 +636,10 @@
* The :mod:`ctypes` module now always converts ``None`` to a C NULL
pointer for arguments declared as pointers. (Changed by Thomas
- Heller; :issue:`4606`.)
+ Heller; :issue:`4606`.) The underlying `libffi library
+ <http://sourceware.org/libffi/>`__ has been updated to version
+ 3.0.9, containing various fixes for different platforms. (Updated
+ by Matthias Klose; :issue:`8142`.)
* New method: the :mod:`datetime` module's :class:`timedelta` class
gained a :meth:`total_seconds` method that returns the number of seconds
@@ -592,46 +665,6 @@
left-alignment. This has been changed to right-alignment, which seems
more sensible for numeric types. (Changed by Mark Dickinson; :issue:`6857`.)
-* Distutils is being more actively developed, thanks to Tarek Ziadé
- who has taken over maintenance of the package, so there are a number
- of fixes and improvments.
-
- A new :file:`setup.py` subcommand, ``check``, will check that the
- arguments being passed to the :func:`setup` function are complete
- and correct (:issue:`5732`).
-
- Byte-compilation by the ``install_lib`` subcommand is now only done
- if the ``sys.dont_write_bytecode`` setting allows it (:issue:`7071`).
-
- :func:`distutils.sdist.add_defaults` now uses
- *package_dir* and *data_files* to create the MANIFEST file.
- :mod:`distutils.sysconfig` now reads the :envvar:`AR` and
- :envvar:`ARFLAGS` environment variables.
-
- .. ARFLAGS done in #5941
-
- It is no longer mandatory to store clear-text passwords in the
- :file:`.pypirc` file when registering and uploading packages to PyPI. As long
- as the username is present in that file, the :mod:`distutils` package will
- prompt for the password if not present. (Added by Tarek Ziadé,
- based on an initial contribution by Nathan Van Gheem; :issue:`4394`.)
-
- A Distutils setup can now specify that a C extension is optional by
- setting the *optional* option setting to true. If this optional is
- supplied, failure to build the extension will not abort the build
- process, but instead simply not install the failing extension.
- (Contributed by Georg Brandl; :issue:`5583`.)
-
- The :class:`distutils.dist.DistributionMetadata` class'
- :meth:`read_pkg_file` method will read the contents of a package's
- :file:`PKG-INFO` metadata file. For an example of its use, see
- :ref:`reading-metadata`.
- (Contributed by Tarek Ziadé; :issue:`7457`.)
-
- :file:`setup.py` files will now accept a :option:`--no-user-cfg` switch
- to skip reading the :file:`~/.pydistutils.cfg` file. (Suggested by
- by Michael Hoffman, and implemented by Paul Winkler; :issue:`1180`.)
-
* The :class:`Fraction` class now accepts two rational numbers
as arguments to its constructor.
(Implemented by Mark Dickinson; :issue:`5812`.)
@@ -649,9 +682,12 @@
otherwise. (Contributed by Antoine Pitrou; :issue:`4688`.)
* The :mod:`gzip` module's :class:`GzipFile` now supports the context
- management protocol, so you can write ``with gzip.GzipFile(...) as f: ...``.
- (Contributed by Hagen Fuerstenau; :issue:`3860`.)
- It's now possible to override the modification time
+ management protocol, so you can write ``with gzip.GzipFile(...) as f: ...``
+ (contributed by Hagen Fuerstenau; :issue:`3860`), and it now implements
+ the :class:`io.BufferedIOBase` ABC, so you can wrap it with
+ :class:`io.BufferedReader` for faster processing
+ (contributed by Nir Aides; :issue:`7471`).
+ It's also now possible to override the modification time
recorded in a gzipped file by providing an optional timestamp to
the constructor. (Contributed by Jacques Frechet; :issue:`4272`.)
@@ -663,6 +699,11 @@
supports buffering, resulting in much faster reading of HTTP responses.
(Contributed by Kristjan Valur Jonsson; :issue:`4879`.)
+ The :class:`HTTPConnection` and :class:`HTTPSConnection` classes
+ now support a *source_address* parameter, a ``(host, port)`` 2-tuple
+ giving the source address that will be used for the connection.
+ (Contributed by Eldon Ziegler; :issue:`3972`.)
+
* The :mod:`imaplib` module now supports IPv6 addresses.
(Contributed by Derek Morr; :issue:`1655`.)
@@ -756,6 +797,10 @@
contributed by Travis H.; :issue:`6508`. Support for initgroups added
by Jean-Paul Calderone; :issue:`7333`.)
+ The :func:`os.fork` function now re-initializes the import lock in
+ the child process; this fixes problems on Solaris when :func:`fork`
+ is called from a thread. (Fixed by Zsolt Cserna; :issue:`7242`.)
+
The :func:`normpath` function now preserves Unicode; if its input path
is a Unicode string, the return value is also a Unicode string.
(Fixed by Matt Giuca; :issue:`5827`.)
@@ -774,6 +819,10 @@
named pipes like a regular file by opening them for reading, and
this would block indefinitely. (Fixed by Antoine Pitrou; :issue:`3002`.)
+ New function: :func:`make_archive` takes a filename, archive type
+ (zip or tar-format), and a directory path, and creates an archive
+ containing the directory's contents. (Added by Tarek Ziadé.)
+
* New functions: in the :mod:`site` module, three new functions
return various site- and user-specific paths.
:func:`getsitepackages` returns a list containing all
@@ -785,9 +834,24 @@
to store data.
(Contributed by Tarek Ziadé; :issue:`6693`.)
+ The :mod:`site` module now reports exceptions occurring
+ when the :mod:`sitecustomize` module is imported, and will no longer
+ catch and swallow the :exc:`KeyboardError` exception. (Fixed by
+ Victor Stinner; :issue:`3137`.)
+
* The :mod:`socket` module's :class:`SSL` objects now support the
- buffer API, which fixed a test suite failure. (Fixed by Antoine Pitrou;
- :issue:`7133`.)
+ buffer API, which fixed a test suite failure. (Fixed by Antoine
+ Pitrou; :issue:`7133`.)
+
+ The :func:`create_connection` function
+ gained a *source_address* parameter, a ``(host, port)`` 2-tuple
+ giving the source address that will be used for the connection.
+ (Contributed by Eldon Ziegler; :issue:`3972`.)
+
+ The :meth:`recv_into` and `recvfrom_into` methods will now write
+ into objects that support the buffer API, most usefully
+ the :class:`bytearray` and :class:`memoryview` objects. (Implemented by
+ Antoine Pitrou; :issue:`8104`.)
* The :mod:`SocketServer` module's :class:`TCPServer` class now
has a :attr:`disable_nagle_algorithm` class attribute.
@@ -796,6 +860,13 @@
prevent buffering many small sends into a single TCP packet.
(Contributed by Kristjan Valur Jonsson; :issue:`6192`.)
+* Updated module: the :mod:`sqlite` module has been updated to
+ version 2.6.0 of the `pysqlite package <http://code.google.com/p/pysqlite/>`__. Version 2.6.0 includes a number of bugfixes, and adds
+ the ability to load SQLite extensions from shared libraries.
+ Call the ``enable_load_extension(True)`` method to enable extensions,
+ and then call :meth:`load_extension` to load a particular shared library.
+ (Updated by Gerhard Häring.)
+
* The :mod:`struct` module will no longer silently ignore overflow
errors when a value is too large for a particular integer format
code (one of ``bBhHiIlLqQ``); it now always raises a
@@ -852,6 +923,8 @@
resulting archive. This is more powerful than the existing
*exclude* argument, which has therefore been deprecated.
(Added by Lars Gustäbel; :issue:`6856`.)
+ The :class:`TarFile` class also now supports the context manager protocol.
+ (Added by Lars Gustäbel; :issue:`7232`.)
* The :mod:`threading` module's :meth:`Event.wait` method now returns
the internal flag on exit. This means the method will usually
@@ -860,9 +933,22 @@
a timeout was provided and the operation timed out.
(Contributed by Tim Lesher; :issue:`1674032`.)
+* The Unicode database provided by the :mod:`unicodedata` module
+ remains at version 5.1.0, but Python now uses it internally to
+ determine which characters are numeric, whitespace, or represent
+ line breaks. The database also now includes information from the
+ :file:`Unihan.txt` data file. (Patch by Anders Chrigström
+ and Amaury Forgeot d'Arc; :issue:`1571184`.)
+
* The :class:`UserDict` class is now a new-style class. (Changed by
Benjamin Peterson.)
+* The ElementTree library, :mod:`xml.etree`, no longer escapes
+ ampersands and angle brackets when outputting an XML processing
+ instruction (which looks like `<?xml-stylesheet href="#style1"?>`)
+ or comment (which looks like `<!-- comment -->`).
+ (Patch by Neil Muller; :issue:`2746`.)
+
* The :mod:`zipfile` module's :class:`ZipFile` now supports the context
management protocol, so you can write ``with zipfile.ZipFile(...) as f: ...``.
(Contributed by Brian Curtin; :issue:`5511`.)
@@ -877,18 +963,81 @@
accepts a file object, in addition to the path names accepted in earlier
versions. (Contributed by Gabriel Genellina; :issue:`4756`.)
+ The :meth:`writestr` method now has an optional *compress_type* parameter
+ that lets you override the default compression method specified in the
+ :class:`ZipFile` constructor. (Contributed by Ronald Oussoren;
+ :issue:`6003`.)
+
* XXX the :mod:`shutil` module has now a :func:`make_archive` function
- (see the module doc, contributed by Tarek)
+ (see the module doc, contributed by Tarek)
+
+
+New module: sysconfig
+---------------------------------
+
+XXX A new :mod:`sysconfig` module has been extracted from
+:mod:`distutils` and put in the standard library.
+
+The :mod:`sysconfig` module provides access to Python's configuration
+information like the list of installation paths and the configuration
+variables relevant for the current platform. (contributed by Tarek)
+
+Updated module: ElementTree 1.3
+---------------------------------
+
+XXX write this.
.. ======================================================================
.. whole new modules get described in subsections here
-* XXX A new :mod:`sysconfig` module has been extracted from :mod:`distutils`
- and put in the standard library.
- The :mod:`sysconfig` module provides access to Python's configuration
- information like the list of installation paths and the configuration
- variables relevant for the current platform.
+Distutils Enhancements
+---------------------------------
+
+Distutils is being more actively developed, thanks to Tarek Ziadé
+who has taken over maintenance of the package, so there are a number
+of fixes and improvements.
+
+A new :file:`setup.py` subcommand, ``check``, will check that the
+arguments being passed to the :func:`setup` function are complete
+and correct (:issue:`5732`).
+
+Byte-compilation by the ``install_lib`` subcommand is now only done
+if the ``sys.dont_write_bytecode`` setting allows it (:issue:`7071`).
+
+:func:`distutils.sdist.add_defaults` now uses
+*package_dir* and *data_files* to create the MANIFEST file.
+:mod:`distutils.sysconfig` now reads the :envvar:`AR` and
+:envvar:`ARFLAGS` environment variables.
+
+.. ARFLAGS done in #5941
+
+It is no longer mandatory to store clear-text passwords in the
+:file:`.pypirc` file when registering and uploading packages to PyPI. As long
+as the username is present in that file, the :mod:`distutils` package will
+prompt for the password if not present. (Added by Tarek Ziadé,
+based on an initial contribution by Nathan Van Gheem; :issue:`4394`.)
+
+A Distutils setup can now specify that a C extension is optional by
+setting the *optional* option setting to true. If this optional is
+supplied, failure to build the extension will not abort the build
+process, but instead simply not install the failing extension.
+(Contributed by Georg Brandl; :issue:`5583`.)
+
+The :class:`distutils.dist.DistributionMetadata` class'
+:meth:`read_pkg_file` method will read the contents of a package's
+:file:`PKG-INFO` metadata file. For an example of its use, see
+:ref:`reading-metadata`.
+(Contributed by Tarek Ziadé; :issue:`7457`.)
+
+:file:`setup.py` files will now accept a :option:`--no-user-cfg` switch
+to skip reading the :file:`~/.pydistutils.cfg` file. (Suggested by
+by Michael Hoffman, and implemented by Paul Winkler; :issue:`1180`.)
+
+When creating a tar-format archive, the ``sdist`` subcommand now
+allows specifying the user id and group that will own the files in the
+archives using the :option:`--owner` and :option:`--group` switches
+(:issue:`6516`).
Unit Testing Enhancements
@@ -948,7 +1097,8 @@
* :meth:`assertMultiLineEqual` compares two strings, and if they're
not equal, displays a helpful comparison that highlights the
- differences in the two strings.
+ differences in the two strings. This comparison is now used by
+ default when Unicode strings are compared with :meth:`assertEqual`.)
* :meth:`assertRegexpMatches` checks whether its first argument is a
string matching a regular expression provided as its second argument.
@@ -960,25 +1110,29 @@
* :meth:`assertIn` and :meth:`assertNotIn` tests whether
*first* is or is not in *second*.
-* :meth:`assertSameElements` tests whether two provided sequences
+* :meth:`assertItemsEqual` tests whether two provided sequences
contain the same elements.
* :meth:`assertSetEqual` compares whether two sets are equal, and
only reports the differences between the sets in case of error.
* Similarly, :meth:`assertListEqual` and :meth:`assertTupleEqual`
- compare the specified types and explain the differences.
+ compare the specified types and explain any differences without necessarily
+ printing their full values; these methods are now used by default
+ when comparing lists and tuples using :meth:`assertEqual`.
More generally, :meth:`assertSequenceEqual` compares two sequences
and can optionally check whether both sequences are of a
particular type.
* :meth:`assertDictEqual` compares two dictionaries and reports the
- differences. :meth:`assertDictContainsSubset` checks whether
+ differences; it's now used by default when you compare two dictionaries
+ using :meth:`assertEqual`. :meth:`assertDictContainsSubset` checks whether
all of the key/value pairs in *first* are found in *second*.
-* :meth:`assertAlmostEqual` and :meth:`assertNotAlmostEqual` short-circuit
- (automatically pass or fail without checking decimal places) if the objects
- are equal.
+* :meth:`assertAlmostEqual` and :meth:`assertNotAlmostEqual` test
+ whether *first* and *second* are approximately equal by computing
+ their difference, rounding the result to an optionally-specified number
+ of *places* (the default is 7), and comparing to zero.
* :meth:`loadTestsFromName` properly honors the ``suiteClass`` attribute of
the :class:`TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)
@@ -1232,6 +1386,14 @@
Other Changes and Fixes
=======================
+* Two benchmark scripts, :file:`iobench` and :file:`ccbench`, were
+ added to the :file:`Tools` directory. :file:`iobench` measures the
+ speed of built-in file I/O objects (as returned by :func:`open`)
+ while performing various operations, and :file:`ccbench` is a
+ concurrency benchmark that tries to measure computing throughput,
+ thread switching latency, and IO processing bandwidth when
+ performing several tasks using a varying number of threads.
+
* When importing a module from a :file:`.pyc` or :file:`.pyo` file
with an existing :file:`.py` counterpart, the :attr:`co_filename`
attributes of the resulting code objects are overwritten when the
@@ -1283,6 +1445,14 @@
nothing when a negative length is requested, as other file-like
objects do. (:issue:`7348`).
+In the standard library:
+
+* The ElementTree library, :mod:`xml.etree`, no longer escapes
+ ampersands and angle brackets when outputting an XML processing
+ instruction (which looks like `<?xml-stylesheet href="#style1"?>`)
+ or comment (which looks like `<!-- comment -->`).
+ (Patch by Neil Muller; :issue:`2746`.)
+
For C extensions:
* C extensions that use integer format codes with the ``PyArg_Parse*``
Modified: python/branches/py3k-jit/Lib/compileall.py
==============================================================================
--- python/branches/py3k-jit/Lib/compileall.py (original)
+++ python/branches/py3k-jit/Lib/compileall.py Mon Mar 22 22:57:17 2010
@@ -97,8 +97,6 @@
print('Compiling', fullname, '...')
try:
ok = py_compile.compile(fullname, None, dfile, True)
- except KeyboardInterrupt:
- raise KeyboardInterrupt
except py_compile.PyCompileError as err:
if quiet:
print('*** Error compiling', fullname, '...')
Modified: python/branches/py3k-jit/Lib/ctypes/test/test_internals.py
==============================================================================
--- python/branches/py3k-jit/Lib/ctypes/test/test_internals.py (original)
+++ python/branches/py3k-jit/Lib/ctypes/test/test_internals.py Mon Mar 22 22:57:17 2010
@@ -23,16 +23,16 @@
def test_ints(self):
i = 42000123
- rc = grc(i)
+ refcnt = grc(i)
ci = c_int(i)
- self.assertEqual(rc, grc(i))
+ self.assertEqual(refcnt, grc(i))
self.assertEqual(ci._objects, None)
def test_c_char_p(self):
s = b"Hello, World"
- rc = grc(s)
+ refcnt = grc(s)
cs = c_char_p(s)
- self.assertEqual(rc + 1, grc(s))
+ self.assertEqual(refcnt + 1, grc(s))
self.assertSame(cs._objects, s)
def test_simple_struct(self):
Modified: python/branches/py3k-jit/Lib/http/client.py
==============================================================================
--- python/branches/py3k-jit/Lib/http/client.py (original)
+++ python/branches/py3k-jit/Lib/http/client.py Mon Mar 22 22:57:17 2010
@@ -1121,6 +1121,8 @@
class BadStatusLine(HTTPException):
def __init__(self, line):
+ if not line:
+ line = repr(line)
self.args = line,
self.line = line
Modified: python/branches/py3k-jit/Lib/logging/__init__.py
==============================================================================
--- python/branches/py3k-jit/Lib/logging/__init__.py (original)
+++ python/branches/py3k-jit/Lib/logging/__init__.py Mon Mar 22 22:57:17 2010
@@ -1555,7 +1555,7 @@
def disable(level):
"""
- Disable all logging calls less severe than 'level'.
+ Disable all logging calls of severity 'level' and below.
"""
root.manager.disable = level
Modified: python/branches/py3k-jit/Lib/macpath.py
==============================================================================
--- python/branches/py3k-jit/Lib/macpath.py (original)
+++ python/branches/py3k-jit/Lib/macpath.py Mon Mar 22 22:57:17 2010
@@ -193,7 +193,10 @@
path = components[0] + colon
for c in components[1:]:
path = join(path, c)
- path = Carbon.File.FSResolveAliasFile(path, 1)[0].as_pathname()
+ try:
+ path = Carbon.File.FSResolveAliasFile(path, 1)[0].as_pathname()
+ except Carbon.File.Error:
+ pass
return path
supports_unicode_filenames = False
Modified: python/branches/py3k-jit/Lib/mailbox.py
==============================================================================
--- python/branches/py3k-jit/Lib/mailbox.py (original)
+++ python/branches/py3k-jit/Lib/mailbox.py Mon Mar 22 22:57:17 2010
@@ -882,17 +882,9 @@
raise KeyError('No message with key: %s' % key)
else:
raise
- try:
- if self._locked:
- _lock_file(f)
- try:
- f.close()
- os.remove(os.path.join(self._path, str(key)))
- finally:
- if self._locked:
- _unlock_file(f)
- finally:
+ else:
f.close()
+ os.remove(path)
def __setitem__(self, key, message):
"""Replace the keyed message; raise KeyError if it doesn't exist."""
Modified: python/branches/py3k-jit/Lib/pipes.py
==============================================================================
--- python/branches/py3k-jit/Lib/pipes.py (original)
+++ python/branches/py3k-jit/Lib/pipes.py Mon Mar 22 22:57:17 2010
@@ -253,10 +253,13 @@
_funnychars = '"`$\\' # Unsafe inside "double quotes"
def quote(file):
+ ''' return a shell-escaped version of the file string '''
for c in file:
if c not in _safechars:
break
else:
+ if not file:
+ return "''"
return file
if '\'' not in file:
return '\'' + file + '\''
Modified: python/branches/py3k-jit/Lib/platform.py
==============================================================================
--- python/branches/py3k-jit/Lib/platform.py (original)
+++ python/branches/py3k-jit/Lib/platform.py Mon Mar 22 22:57:17 2010
@@ -1103,7 +1103,11 @@
# http://support.microsoft.com/kb/888731 and
# http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM
if not machine:
- machine = os.environ.get('PROCESSOR_ARCHITECTURE', '')
+ # WOW64 processes mask the native architecture
+ if "PROCESSOR_ARCHITEW6432" in os.environ:
+ machine = os.environ.get("PROCESSOR_ARCHITEW6432", '')
+ else:
+ machine = os.environ.get('PROCESSOR_ARCHITECTURE', '')
if not processor:
processor = os.environ.get('PROCESSOR_IDENTIFIER', machine)
Modified: python/branches/py3k-jit/Lib/profile.py
==============================================================================
--- python/branches/py3k-jit/Lib/profile.py (original)
+++ python/branches/py3k-jit/Lib/profile.py Mon Mar 22 22:57:17 2010
@@ -602,11 +602,8 @@
if (len(args) > 0):
sys.argv[:] = args
sys.path.insert(0, os.path.dirname(sys.argv[0]))
- fp = open(sys.argv[0])
- try:
+ with open(sys.argv[0], 'rb') as fp:
script = fp.read()
- finally:
- fp.close()
run('exec(%r)' % script, options.outfile, options.sort)
else:
parser.print_usage()
Modified: python/branches/py3k-jit/Lib/shutil.py
==============================================================================
--- python/branches/py3k-jit/Lib/shutil.py (original)
+++ python/branches/py3k-jit/Lib/shutil.py Mon Mar 22 22:57:17 2010
@@ -11,6 +11,7 @@
import fnmatch
from warnings import warn
import collections
+import errno
try:
from pwd import getpwnam
@@ -105,8 +106,11 @@
if hasattr(os, 'chmod'):
os.chmod(dst, mode)
if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):
- os.chflags(dst, st.st_flags)
-
+ try:
+ os.chflags(dst, st.st_flags)
+ except OSError as why:
+ if not hasattr(errno, 'EOPNOTSUPP') or why.errno != errno.EOPNOTSUPP:
+ raise
def copy(src, dst):
"""Copy data and mode bits ("cp src dst").
Modified: python/branches/py3k-jit/Lib/ssl.py
==============================================================================
--- python/branches/py3k-jit/Lib/ssl.py (original)
+++ python/branches/py3k-jit/Lib/ssl.py Mon Mar 22 22:57:17 2010
@@ -240,16 +240,9 @@
if self._sslobj:
if flags != 0:
raise ValueError(
- "non-zero flags not allowed in calls to recv_into() on %s" %
- self.__class__)
- while True:
- try:
- return self.read(buflen)
- except SSLError as x:
- if x.args[0] == SSL_ERROR_WANT_READ:
- continue
- else:
- raise x
+ "non-zero flags not allowed in calls to recv() on %s" %
+ self.__class__)
+ return self.read(buflen)
else:
return socket.recv(self, buflen, flags)
@@ -264,15 +257,7 @@
raise ValueError(
"non-zero flags not allowed in calls to recv_into() on %s" %
self.__class__)
- while True:
- try:
- v = self.read(nbytes, buffer)
- return v
- except SSLError as x:
- if x.args[0] == SSL_ERROR_WANT_READ:
- continue
- else:
- raise x
+ return self.read(nbytes, buffer)
else:
return socket.recv_into(self, buffer, nbytes, flags)
Modified: python/branches/py3k-jit/Lib/test/regrtest.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/regrtest.py (original)
+++ python/branches/py3k-jit/Lib/test/regrtest.py Mon Mar 22 22:57:17 2010
@@ -786,7 +786,8 @@
# the corresponding method names.
resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr',
- 'os.environ', 'sys.path', 'sys.path_hooks', '__import__')
+ 'os.environ', 'sys.path', 'sys.path_hooks', '__import__',
+ 'warnings.filters')
def get_sys_argv(self):
return id(sys.argv), sys.argv, sys.argv[:]
@@ -838,6 +839,12 @@
def restore___import__(self, import_):
__builtins__.__import__ = import_
+ def get_warnings_filters(self):
+ return id(warnings.filters), warnings.filters, warnings.filters[:]
+ def restore_warnings_filters(self, saved_filters):
+ warnings.filters = saved_filters[1]
+ warnings.filters[:] = saved_filters[2]
+
def resource_info(self):
for name in self.resources:
method_suffix = name.replace('.', '_')
Modified: python/branches/py3k-jit/Lib/test/test_builtin.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_builtin.py (original)
+++ python/branches/py3k-jit/Lib/test/test_builtin.py Mon Mar 22 22:57:17 2010
@@ -2,15 +2,11 @@
import platform
import unittest
-from test.support import fcmp, TESTFN, unlink, run_unittest
+from test.support import fcmp, TESTFN, unlink, run_unittest, check_warnings
from operator import neg
import sys, warnings, random, collections, io
-warnings.filterwarnings("ignore", "hex../oct.. of negative int",
- FutureWarning, __name__)
-warnings.filterwarnings("ignore", "integer argument expected",
- DeprecationWarning, "unittest")
import builtins
class Squares:
@@ -427,9 +423,10 @@
g = {}
l = {}
- import warnings
- warnings.filterwarnings("ignore", "global statement", module="<string>")
- exec('global a; a = 1; b = 2', g, l)
+ with check_warnings():
+ warnings.filterwarnings("ignore", "global statement",
+ module="<string>")
+ exec('global a; a = 1; b = 2', g, l)
if '__builtins__' in g:
del g['__builtins__']
if '__builtins__' in l:
Modified: python/branches/py3k-jit/Lib/test/test_bytes.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_bytes.py (original)
+++ python/branches/py3k-jit/Lib/test/test_bytes.py Mon Mar 22 22:57:17 2010
@@ -27,12 +27,6 @@
class BaseBytesTest(unittest.TestCase):
- def setUp(self):
- self.warning_filters = warnings.filters[:]
-
- def tearDown(self):
- warnings.filters = self.warning_filters
-
def test_basics(self):
b = self.type2test()
self.assertEqual(type(b), self.type2test)
@@ -127,15 +121,19 @@
self.assertFalse(b3 <= b2)
def test_compare_to_str(self):
- warnings.simplefilter('ignore', BytesWarning)
- # Byte comparisons with unicode should always fail!
- # Test this for all expected byte orders and Unicode character sizes
- self.assertEqual(self.type2test(b"\0a\0b\0c") == "abc", False)
- self.assertEqual(self.type2test(b"\0\0\0a\0\0\0b\0\0\0c") == "abc", False)
- self.assertEqual(self.type2test(b"a\0b\0c\0") == "abc", False)
- self.assertEqual(self.type2test(b"a\0\0\0b\0\0\0c\0\0\0") == "abc", False)
- self.assertEqual(self.type2test() == str(), False)
- self.assertEqual(self.type2test() != str(), True)
+ with test.support.check_warnings():
+ warnings.simplefilter('ignore', BytesWarning)
+ # Byte comparisons with unicode should always fail!
+ # Test this for all expected byte orders and Unicode character
+ # sizes.
+ self.assertEqual(self.type2test(b"\0a\0b\0c") == "abc", False)
+ self.assertEqual(self.type2test(b"\0\0\0a\0\0\0b\0\0\0c") == "abc",
+ False)
+ self.assertEqual(self.type2test(b"a\0b\0c\0") == "abc", False)
+ self.assertEqual(self.type2test(b"a\0\0\0b\0\0\0c\0\0\0") == "abc",
+ False)
+ self.assertEqual(self.type2test() == str(), False)
+ self.assertEqual(self.type2test() != str(), True)
def test_reversed(self):
input = list(map(ord, "Hello"))
@@ -829,22 +827,17 @@
# Test various combinations of bytes and bytearray
#
- def setUp(self):
- self.warning_filters = warnings.filters[:]
-
- def tearDown(self):
- warnings.filters = self.warning_filters
-
def test_repr_str(self):
- warnings.simplefilter('ignore', BytesWarning)
- for f in str, repr:
- self.assertEqual(f(bytearray()), "bytearray(b'')")
- self.assertEqual(f(bytearray([0])), "bytearray(b'\\x00')")
- self.assertEqual(f(bytearray([0, 1, 254, 255])),
- "bytearray(b'\\x00\\x01\\xfe\\xff')")
- self.assertEqual(f(b"abc"), "b'abc'")
- self.assertEqual(f(b"'"), '''b"'"''') # '''
- self.assertEqual(f(b"'\""), r"""b'\'"'""") # '
+ with test.support.check_warnings():
+ warnings.simplefilter('ignore', BytesWarning)
+ for f in str, repr:
+ self.assertEqual(f(bytearray()), "bytearray(b'')")
+ self.assertEqual(f(bytearray([0])), "bytearray(b'\\x00')")
+ self.assertEqual(f(bytearray([0, 1, 254, 255])),
+ "bytearray(b'\\x00\\x01\\xfe\\xff')")
+ self.assertEqual(f(b"abc"), "b'abc'")
+ self.assertEqual(f(b"'"), '''b"'"''') # '''
+ self.assertEqual(f(b"'\""), r"""b'\'"'""") # '
def test_compare_bytes_to_bytearray(self):
self.assertEqual(b"abc" == bytes(b"abc"), True)
@@ -888,13 +881,14 @@
self.assertEqual(b, bytearray(sample))
def test_to_str(self):
- warnings.simplefilter('ignore', BytesWarning)
- self.assertEqual(str(b''), "b''")
- self.assertEqual(str(b'x'), "b'x'")
- self.assertEqual(str(b'\x80'), "b'\\x80'")
- self.assertEqual(str(bytearray(b'')), "bytearray(b'')")
- self.assertEqual(str(bytearray(b'x')), "bytearray(b'x')")
- self.assertEqual(str(bytearray(b'\x80')), "bytearray(b'\\x80')")
+ with test.support.check_warnings():
+ warnings.simplefilter('ignore', BytesWarning)
+ self.assertEqual(str(b''), "b''")
+ self.assertEqual(str(b'x'), "b'x'")
+ self.assertEqual(str(b'\x80'), "b'\\x80'")
+ self.assertEqual(str(bytearray(b'')), "bytearray(b'')")
+ self.assertEqual(str(bytearray(b'x')), "bytearray(b'x')")
+ self.assertEqual(str(bytearray(b'\x80')), "bytearray(b'\\x80')")
def test_literal(self):
tests = [
@@ -940,11 +934,16 @@
def test_compare(self):
if sys.flags.bytes_warning:
- warnings.simplefilter('error', BytesWarning)
- self.assertRaises(BytesWarning, operator.eq, b'', '')
- self.assertRaises(BytesWarning, operator.ne, b'', '')
- self.assertRaises(BytesWarning, operator.eq, bytearray(b''), '')
- self.assertRaises(BytesWarning, operator.ne, bytearray(b''), '')
+ with test.support.check_warnings():
+ warnings.simplefilter('error', BytesWarning)
+ with self.assertRaises(BytesWarning):
+ b'' == ''
+ with self.assertRaises(BytesWarning):
+ b'' != ''
+ with self.assertRaises(BytesWarning):
+ bytearray(b'') == ''
+ with self.assertRaises(BytesWarning):
+ bytearray(b'') != ''
else:
# self.skipTest("BytesWarning is needed for this test: use -bb option")
pass
Modified: python/branches/py3k-jit/Lib/test/test_cgi.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_cgi.py (original)
+++ python/branches/py3k-jit/Lib/test/test_cgi.py Mon Mar 22 22:57:17 2010
@@ -131,7 +131,7 @@
if isinstance(expect, dict):
# test dict interface
self.assertEqual(len(expect), len(fs))
- self.assertEqual(norm(expect.keys()), norm(fs.keys()))
+ self.assertItemsEqual(expect.keys(), fs.keys())
##self.assertEqual(norm(expect.values()), norm(fs.values()))
##self.assertEqual(norm(expect.items()), norm(fs.items()))
self.assertEqual(fs.getvalue("nonexistent field", "default"), "default")
Modified: python/branches/py3k-jit/Lib/test/test_descr.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_descr.py (original)
+++ python/branches/py3k-jit/Lib/test/test_descr.py Mon Mar 22 22:57:17 2010
@@ -4164,6 +4164,15 @@
x.a = 42
self.assertEqual(x.a, 42)
+ # Also check type_getattro for correctness.
+ class Meta(type):
+ pass
+ class X(object):
+ __metaclass__ = Meta
+ X.a = 42
+ Meta.a = Descr("a")
+ self.assertEqual(X.a, 42)
+
def test_getattr_hooks(self):
# issue 4230
Modified: python/branches/py3k-jit/Lib/test/test_extcall.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_extcall.py (original)
+++ python/branches/py3k-jit/Lib/test/test_extcall.py Mon Mar 22 22:57:17 2010
@@ -1,3 +1,4 @@
+
"""Doctest for method/function calls.
We're going the use these types for extra testing
@@ -65,17 +66,17 @@
>>> g()
Traceback (most recent call last):
...
- TypeError: g() takes at least 1 positional argument (0 given)
+ TypeError: g() takes at least 1 argument (0 given)
>>> g(*())
Traceback (most recent call last):
...
- TypeError: g() takes at least 1 positional argument (0 given)
+ TypeError: g() takes at least 1 argument (0 given)
>>> g(*(), **{})
Traceback (most recent call last):
...
- TypeError: g() takes at least 1 positional argument (0 given)
+ TypeError: g() takes at least 1 argument (0 given)
>>> g(1)
1 () {}
@@ -261,13 +262,37 @@
... print(a,b)
>>> f(**x)
1 2
+
+A obscure message:
+
+ >>> def f(a, b):
+ ... pass
+ >>> f(b=1)
+ Traceback (most recent call last):
+ ...
+ TypeError: f() takes exactly 2 arguments (1 given)
+
+The number of arguments passed in includes keywords:
+
+ >>> def f(a):
+ ... pass
+ >>> f(6, a=4, *(1, 2, 3))
+ Traceback (most recent call last):
+ ...
+ TypeError: f() takes exactly 1 argument (5 given)
+ >>> def f(a, *, kw):
+ ... pass
+ >>> f(6, 4, kw=4)
+ Traceback (most recent call last):
+ ...
+ TypeError: f() takes exactly 2 arguments (3 given)
"""
+import sys
from test import support
def test_main():
- from test import test_extcall # self import
- support.run_doctest(test_extcall, True)
+ support.run_doctest(sys.modules[__name__], True)
if __name__ == '__main__':
test_main()
Modified: python/branches/py3k-jit/Lib/test/test_ftplib.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_ftplib.py (original)
+++ python/branches/py3k-jit/Lib/test/test_ftplib.py Mon Mar 22 22:57:17 2010
@@ -296,7 +296,9 @@
try:
return super(SSLConnection, self).send(data)
except ssl.SSLError as err:
- if err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN):
+ if err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN,
+ ssl.SSL_ERROR_WANT_READ,
+ ssl.SSL_ERROR_WANT_WRITE):
return 0
raise
@@ -304,6 +306,9 @@
try:
return super(SSLConnection, self).recv(buffer_size)
except ssl.SSLError as err:
+ if err.args[0] in (ssl.SSL_ERROR_WANT_READ,
+ ssl.SSL_ERROR_WANT_WRITE):
+ return ''
if err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN):
self.handle_close()
return b''
Modified: python/branches/py3k-jit/Lib/test/test_global.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_global.py (original)
+++ python/branches/py3k-jit/Lib/test/test_global.py Mon Mar 22 22:57:17 2010
@@ -1,13 +1,22 @@
"""Verify that warnings are issued for global statements following use."""
-from test.support import run_unittest, check_syntax_error
+from test.support import run_unittest, check_syntax_error, check_warnings
import unittest
import warnings
-warnings.filterwarnings("error", module="<test string>")
+
class GlobalTests(unittest.TestCase):
+ def setUp(self):
+ self._warnings_manager = check_warnings()
+ self._warnings_manager.__enter__()
+ warnings.filterwarnings("error", module="<test string>")
+
+ def tearDown(self):
+ self._warnings_manager.__exit__(None, None, None)
+
+
def test1(self):
prog_text_1 = """\
def wrong1():
Modified: python/branches/py3k-jit/Lib/test/test_http_cookies.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_http_cookies.py (original)
+++ python/branches/py3k-jit/Lib/test/test_http_cookies.py Mon Mar 22 22:57:17 2010
@@ -1,15 +1,22 @@
# Simple test suite for http/cookies.py
-from test.support import run_unittest, run_doctest
+from test.support import run_unittest, run_doctest, check_warnings
import unittest
from http import cookies
import warnings
-warnings.filterwarnings("ignore",
- ".* class is insecure.*",
- DeprecationWarning)
class CookieTests(unittest.TestCase):
+
+ def setUp(self):
+ self._warnings_manager = check_warnings()
+ self._warnings_manager.__enter__()
+ warnings.filterwarnings("ignore", ".* class is insecure.*",
+ DeprecationWarning)
+
+ def tearDown(self):
+ self._warnings_manager.__exit__(None, None, None)
+
def test_basic(self):
cases = [
{ 'data': 'chips=ahoy; vienna=finger',
Modified: python/branches/py3k-jit/Lib/test/test_httplib.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_httplib.py (original)
+++ python/branches/py3k-jit/Lib/test/test_httplib.py Mon Mar 22 22:57:17 2010
@@ -106,6 +106,10 @@
resp = client.HTTPResponse(sock)
self.assertRaises(client.BadStatusLine, resp.begin)
+ def test_bad_status_repr(self):
+ exc = client.BadStatusLine('')
+ self.assertEquals(repr(exc), '''BadStatusLine("\'\'",)''')
+
def test_partial_reads(self):
# if we have a lenght, the system knows when to close itself
# same behaviour than when we read the whole thing with read()
Modified: python/branches/py3k-jit/Lib/test/test_imp.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_imp.py (original)
+++ python/branches/py3k-jit/Lib/test/test_imp.py Mon Mar 22 22:57:17 2010
@@ -104,7 +104,14 @@
'cp1258' : b'\xc0',
}
- special_char = known_locales.get(fs_encoding)
+ if sys.platform == 'darwin':
+ self.assertEqual(fs_encoding, 'utf-8')
+ # Mac OS X uses the Normal Form D decomposition
+ # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html
+ special_char = b'a\xcc\x88'
+ else:
+ special_char = known_locales.get(fs_encoding)
+
if not special_char:
self.skipTest("can't run this test with %s as filesystem encoding"
% fs_encoding)
@@ -155,7 +162,7 @@
reload()."""
def test_source(self):
- # XXX (ncoghlan): It would be nice to use test_support.CleanImport
+ # XXX (ncoghlan): It would be nice to use test.support.CleanImport
# here, but that breaks because the os module registers some
# handlers in copy_reg on import. Since CleanImport doesn't
# revert that registration, the module is left in a broken
Modified: python/branches/py3k-jit/Lib/test/test_importhooks.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_importhooks.py (original)
+++ python/branches/py3k-jit/Lib/test/test_importhooks.py Mon Mar 22 22:57:17 2010
@@ -221,15 +221,9 @@
def testBlocker(self):
mname = "exceptions" # an arbitrary harmless builtin module
- if mname in sys.modules:
- del sys.modules[mname]
+ support.unload(mname)
sys.meta_path.append(ImportBlocker(mname))
- try:
- __import__(mname)
- except ImportError:
- pass
- else:
- self.fail("'%s' was not supposed to be importable" % mname)
+ self.assertRaises(ImportError, __import__, mname)
def testImpWrapper(self):
i = ImpWrapper()
Modified: python/branches/py3k-jit/Lib/test/test_inspect.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_inspect.py (original)
+++ python/branches/py3k-jit/Lib/test/test_inspect.py Mon Mar 22 22:57:17 2010
@@ -166,12 +166,12 @@
def test_trace(self):
self.assertEqual(len(git.tr), 3)
- self.assertEqual(revise(*git.tr[0][1:]),
- (modfile, 43, 'argue', [' spam(a, b, c)\n'], 0))
- self.assertEqual(revise(*git.tr[1][1:]),
- (modfile, 9, 'spam', [' eggs(b + d, c + f)\n'], 0))
- self.assertEqual(revise(*git.tr[2][1:]),
- (modfile, 18, 'eggs', [' q = y / 0\n'], 0))
+ self.assertEqual(git.tr[0][1:], (modfile, 43, 'argue',
+ [' spam(a, b, c)\n'], 0))
+ self.assertEqual(git.tr[1][1:], (modfile, 9, 'spam',
+ [' eggs(b + d, c + f)\n'], 0))
+ self.assertEqual(git.tr[2][1:], (modfile, 18, 'eggs',
+ [' q = y / 0\n'], 0))
def test_frame(self):
args, varargs, varkw, locals = inspect.getargvalues(mod.fr)
Modified: python/branches/py3k-jit/Lib/test/test_mailbox.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_mailbox.py (original)
+++ python/branches/py3k-jit/Lib/test/test_mailbox.py Mon Mar 22 22:57:17 2010
@@ -968,6 +968,13 @@
key0 = self._box.add(msg0)
refmsg0 = self._box.get_message(key0)
+ def test_issue7627(self):
+ msg0 = mailbox.MHMessage(self._template % 0)
+ key0 = self._box.add(msg0)
+ self._box.lock()
+ self._box.remove(key0)
+ self._box.unlock()
+
def test_pack(self):
# Pack the contents of the mailbox
msg0 = mailbox.MHMessage(self._template % 0)
Modified: python/branches/py3k-jit/Lib/test/test_pep277.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_pep277.py (original)
+++ python/branches/py3k-jit/Lib/test/test_pep277.py Mon Mar 22 22:57:17 2010
@@ -1,6 +1,7 @@
# Test the Unicode versions of normal file functions
# open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir
import sys, os, unittest
+from unicodedata import normalize
from test import support
filenames = [
@@ -13,8 +14,21 @@
'\u05d4\u05e9\u05e7\u05e6\u05e5\u05e1',
'\u66e8\u66e9\u66eb',
'\u66e8\u05e9\u3093\u0434\u0393\xdf',
+ # Specific code points: fn, NFC(fn) and NFKC(fn) all differents
+ '\u2000\u2000\u2000A',
+ '\u2001\u2001\u2001A',
+ '\u2003\u2003\u2003A', # == NFC('\u2001\u2001\u2001A')
+ '\u0020\u0020\u0020A', # '\u0020' == ' ' == NFKC('\u2000')
+ # '\u0020' == NFKC('\u2001') == NFKC('\u2003')
+ '\u1fee\u1ffd',
+ # Specific code points: NFC(fn), NFD(fn), NFKC(fn) and NFKD(fn) all differents
+ '\u0385\u03d3\u03d4',
+ '\u00a8\u0301\u03d2\u0301\u03d2\u0308', # == NFD('\u0385\u03d3\u03d4')
+ '\u0020\u0308\u0301\u038e\u03ab', # == NFKC('\u0385\u03d3\u03d4')
+ '\u1e9b\u1fc1\u1fcd\u1fce\u1fcf\u1fdd\u1fde\u1fdf\u1fed',
]
+
# Destroy directory dirname and all files under it, to one level.
def deltree(dirname):
# Don't hide legitimate errors: if one of these suckers exists, it's
@@ -25,43 +39,51 @@
os.unlink(os.path.join(dirname, fname))
os.rmdir(dirname)
+
class UnicodeFileTests(unittest.TestCase):
- files = [os.path.join(support.TESTFN, f) for f in filenames]
+ files = set(filenames)
+ normal_form = None
def setUp(self):
try:
os.mkdir(support.TESTFN)
except OSError:
pass
+ files = set()
for name in self.files:
+ name = os.path.join(support.TESTFN, self.norm(name))
try:
f = open(name, 'wb')
except UnicodeEncodeError:
if not os.path.supports_unicode_filenames:
- raise unittest.SkipTest("only NT+ and systems with Unicode"
- "-friendly filesystem encoding")
+ self.skipTest("only NT+ and systems with Unicode-friendly"
+ "filesystem encoding")
f.write((name+'\n').encode("utf-8"))
f.close()
os.stat(name)
+ files.add(name)
+ self.files = files
def tearDown(self):
deltree(support.TESTFN)
+ def norm(self, s):
+ if self.normal_form:
+ return normalize(self.normal_form, s)
+ return s
+
def _apply_failure(self, fn, filename, expected_exception,
check_fn_in_exception = True):
- try:
+ with self.assertRaises(expected_exception) as c:
fn(filename)
- raise support.TestFailed("Expected to fail calling '%s(%r)'"
- % (fn.__name__, filename))
- except expected_exception as details:
- # the "filename" exception attribute may be encoded
- if isinstance(details.filename, bytes):
- filename = filename.encode(sys.getfilesystemencoding())
- if check_fn_in_exception and details.filename != filename:
- raise support.TestFailed("Function '%s(%r) failed with "
- "bad filename in the exception: %r"
- % (fn.__name__, filename,
- details.filename))
+ exc_filename = c.exception.filename
+ # the "filename" exception attribute may be encoded
+ if isinstance(exc_filename, bytes):
+ filename = filename.encode(sys.getfilesystemencoding())
+ if check_fn_in_exception:
+ self.assertEqual(exc_filename, filename, "Function '%s(%r) failed "
+ "with bad filename in the exception: %r" %
+ (fn.__name__, filename, exc_filename))
def test_failures(self):
# Pass non-existing Unicode filenames all over the place.
@@ -82,39 +104,90 @@
f.close()
os.stat(name)
+ def test_normalize(self):
+ files = set(self.files)
+ others = set()
+ for nf in set(['NFC', 'NFD', 'NFKC', 'NFKD']):
+ others |= set(normalize(nf, file) for file in files)
+ others -= files
+ if sys.platform == 'darwin':
+ files = set(normalize('NFD', file) for file in files)
+ for name in others:
+ if sys.platform == 'darwin' and normalize('NFD', name) in files:
+ # Mac OS X decomposes Unicode names, using Normal Form D.
+ # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html
+ os.stat(name)
+ continue
+ self._apply_failure(open, name, IOError)
+ self._apply_failure(os.stat, name, OSError)
+ self._apply_failure(os.chdir, name, OSError)
+ self._apply_failure(os.rmdir, name, OSError)
+ self._apply_failure(os.remove, name, OSError)
+ # listdir may append a wildcard to the filename, so dont check
+ self._apply_failure(os.listdir, name, OSError, False)
+
def test_listdir(self):
- f1 = os.listdir(support.TESTFN)
- f2 = os.listdir(str(support.TESTFN.encode("utf-8"),
- sys.getfilesystemencoding()))
- sf2 = set(os.path.join(str(support.TESTFN), f)
- for f in f2)
- self.assertEqual(len(f1), len(self.files))
- self.assertEqual(sf2, set(self.files))
+ sf0 = set(self.files)
+ f1 = os.listdir(support.TESTFN.encode(sys.getfilesystemencoding()))
+ f2 = os.listdir(support.TESTFN)
+ if sys.platform == 'darwin':
+ # Mac OS X returns canonically decomposed Unicode (Normal Form D)
+ # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html
+ sf0 = set(normalize('NFD', f) for f in self.files)
+ f2 = [normalize('NFD', f) for f in f2]
+ sf2 = set(os.path.join(support.TESTFN, f) for f in f2)
+ self.assertEqual(sf0, sf2)
+ self.assertEqual(len(f1), len(f2))
def test_rename(self):
for name in self.files:
- os.rename(name,"tmp")
- os.rename("tmp",name)
+ os.rename(name, "tmp")
+ os.rename("tmp", name)
def test_directory(self):
- dirname = os.path.join(support.TESTFN,'Gr\xfc\xdf-\u66e8\u66e9\u66eb')
+ dirname = os.path.join(support.TESTFN, 'Gr\xfc\xdf-\u66e8\u66e9\u66eb')
filename = '\xdf-\u66e8\u66e9\u66eb'
oldwd = os.getcwd()
os.mkdir(dirname)
os.chdir(dirname)
- f = open(filename, 'wb')
- f.write((filename + '\n').encode("utf-8"))
- f.close()
- os.access(filename,os.R_OK)
- os.remove(filename)
- os.chdir(oldwd)
- os.rmdir(dirname)
+ try:
+ with open(filename, 'wb') as f:
+ f.write((filename + '\n').encode("utf-8"))
+ os.access(filename,os.R_OK)
+ os.remove(filename)
+ finally:
+ os.chdir(oldwd)
+ os.rmdir(dirname)
+
+
+class UnicodeNFCFileTests(UnicodeFileTests):
+ normal_form = 'NFC'
+
+
+class UnicodeNFDFileTests(UnicodeFileTests):
+ normal_form = 'NFD'
+
+
+class UnicodeNFKCFileTests(UnicodeFileTests):
+ normal_form = 'NFKC'
+
+
+class UnicodeNFKDFileTests(UnicodeFileTests):
+ normal_form = 'NFKD'
+
def test_main():
try:
- support.run_unittest(UnicodeFileTests)
+ support.run_unittest(
+ UnicodeFileTests,
+ UnicodeNFCFileTests,
+ UnicodeNFDFileTests,
+ UnicodeNFKCFileTests,
+ UnicodeNFKDFileTests,
+ )
finally:
deltree(support.TESTFN)
+
if __name__ == "__main__":
test_main()
Modified: python/branches/py3k-jit/Lib/test/test_pipes.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_pipes.py (original)
+++ python/branches/py3k-jit/Lib/test/test_pipes.py Mon Mar 22 22:57:17 2010
@@ -82,6 +82,8 @@
self.assertEqual(pipes.quote("test%s'name'" % u),
'"test\\%s\'name\'"' % u)
+ self.assertEqual(pipes.quote(''), "''")
+
def testRepr(self):
t = pipes.Template()
self.assertEqual(repr(t), "<Template instance, steps=[]>")
Modified: python/branches/py3k-jit/Lib/test/test_platform.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_platform.py (original)
+++ python/branches/py3k-jit/Lib/test/test_platform.py Mon Mar 22 22:57:17 2010
@@ -127,6 +127,27 @@
res = platform.uname()
self.assertTrue(any(res))
+ @unittest.skipUnless(sys.platform.startswith('win'), "windows only test")
+ def test_uname_win32_ARCHITEW6432(self):
+ # Issue 7860: make sure we get architecture from the correct variable
+ # on 64 bit Windows: if PROCESSOR_ARCHITEW6432 exists we should be
+ # using it, per
+ # http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx
+ try:
+ with test_support.EnvironmentVarGuard() as environ:
+ if 'PROCESSOR_ARCHITEW6432' in environ:
+ del environ['PROCESSOR_ARCHITEW6432']
+ environ['PROCESSOR_ARCHITECTURE'] = 'foo'
+ platform._uname_cache = None
+ system, node, release, version, machine, processor = platform.uname()
+ self.assertEqual(machine, 'foo')
+ environ['PROCESSOR_ARCHITEW6432'] = 'bar'
+ platform._uname_cache = None
+ system, node, release, version, machine, processor = platform.uname()
+ self.assertEqual(machine, 'bar')
+ finally:
+ platform._uname_cache = None
+
def test_java_ver(self):
res = platform.java_ver()
if sys.platform == 'java':
Modified: python/branches/py3k-jit/Lib/test/test_posix.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_posix.py (original)
+++ python/branches/py3k-jit/Lib/test/test_posix.py Mon Mar 22 22:57:17 2010
@@ -13,8 +13,6 @@
import unittest
import warnings
-warnings.filterwarnings('ignore', '.* potential security risk .*',
- RuntimeWarning)
class PosixTester(unittest.TestCase):
@@ -22,9 +20,14 @@
# create empty file
fp = open(support.TESTFN, 'w+')
fp.close()
+ self._warnings_manager = support.check_warnings()
+ self._warnings_manager.__enter__()
+ warnings.filterwarnings('ignore', '.* potential security risk .*',
+ RuntimeWarning)
def tearDown(self):
support.unlink(support.TESTFN)
+ self._warnings_manager.__exit__(None, None, None)
def testNoArgFunctions(self):
# test posix functions which take no arguments and have
Modified: python/branches/py3k-jit/Lib/test/test_set.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_set.py (original)
+++ python/branches/py3k-jit/Lib/test/test_set.py Mon Mar 22 22:57:17 2010
@@ -907,7 +907,8 @@
class TestBasicOpsMixedStringBytes(TestBasicOps):
def setUp(self):
- self.warning_filters = warnings.filters[:]
+ self._warning_filters = support.check_warnings()
+ self._warning_filters.__enter__()
warnings.simplefilter('ignore', BytesWarning)
self.case = "string and bytes set"
self.values = ["a", "b", b"a", b"b"]
@@ -917,7 +918,7 @@
self.repr = "{'a', b'a', 'b', b'b'}"
def tearDown(self):
- warnings.filters = self.warning_filters
+ self._warning_filters.__exit__(None, None, None)
#==============================================================================
Modified: python/branches/py3k-jit/Lib/test/test_tarfile.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_tarfile.py (original)
+++ python/branches/py3k-jit/Lib/test/test_tarfile.py Mon Mar 22 22:57:17 2010
@@ -68,7 +68,7 @@
"fileobj.readlines() failed")
self.assertTrue(len(lines2) == 114,
"fileobj.readlines() failed")
- self.assertTrue(lines2[83] == \
+ self.assertTrue(lines2[83] ==
"I will gladly admit that Python is not the fastest running scripting language.\n",
"fileobj.readlines() failed")
@@ -706,11 +706,12 @@
name = os.path.join(tempdir, name)
open(name, "wb").close()
- def exclude(name):
- return os.path.isfile(name)
+ exclude = os.path.isfile
tar = tarfile.open(tmpname, self.mode, encoding="iso8859-1")
- tar.add(tempdir, arcname="empty_dir", exclude=exclude)
+ with support.check_warnings(("use the filter argument",
+ DeprecationWarning)):
+ tar.add(tempdir, arcname="empty_dir", exclude=exclude)
tar.close()
tar = tarfile.open(tmpname, "r")
@@ -888,10 +889,12 @@
tar = tarfile.open(tmpname)
member = tar.next()
- self.assertFalse(member is None, "unable to read longname member")
- self.assertTrue(tarinfo.name == member.name and \
- tarinfo.linkname == member.linkname, \
- "unable to read longname member")
+ self.assertIsNotNone(member,
+ "unable to read longname member")
+ self.assertEqual(tarinfo.name, member.name,
+ "unable to read longname member")
+ self.assertEqual(tarinfo.linkname, member.linkname,
+ "unable to read longname member")
def test_longname_1023(self):
self._test(("longnam/" * 127) + "longnam")
@@ -993,7 +996,7 @@
"test": "\xe4\xf6\xfc",
"\xe4\xf6\xfc": "test"}
- tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT, \
+ tar = tarfile.open(tmpname, "w", format=tarfile.PAX_FORMAT,
pax_headers=pax_headers)
tar.addfile(tarfile.TarInfo("test"))
tar.close()
Modified: python/branches/py3k-jit/Lib/test/test_tempfile.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_tempfile.py (original)
+++ python/branches/py3k-jit/Lib/test/test_tempfile.py Mon Mar 22 22:57:17 2010
@@ -8,9 +8,6 @@
import unittest
from test import support
-warnings.filterwarnings("ignore",
- category=RuntimeWarning,
- message="mktemp", module=__name__)
if hasattr(os, 'stat'):
import stat
@@ -39,6 +36,16 @@
str_check = re.compile(r"[a-zA-Z0-9_-]{6}$")
+ def setUp(self):
+ self._warnings_manager = support.check_warnings()
+ self._warnings_manager.__enter__()
+ warnings.filterwarnings("ignore", category=RuntimeWarning,
+ message="mktemp", module=__name__)
+
+ def tearDown(self):
+ self._warnings_manager.__exit__(None, None, None)
+
+
def failOnException(self, what, ei=None):
if ei is None:
ei = sys.exc_info()
@@ -98,6 +105,7 @@
def setUp(self):
self.r = tempfile._RandomNameSequence()
+ super().setUp()
def test_get_six_char_str(self):
# _RandomNameSequence returns a six-character string
@@ -499,11 +507,13 @@
# We must also suppress the RuntimeWarning it generates.
def setUp(self):
self.dir = tempfile.mkdtemp()
+ super().setUp()
def tearDown(self):
if self.dir:
os.rmdir(self.dir)
self.dir = None
+ super().tearDown()
class mktemped:
_unlink = os.unlink
Modified: python/branches/py3k-jit/Lib/test/test_thread.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_thread.py (original)
+++ python/branches/py3k-jit/Lib/test/test_thread.py Mon Mar 22 22:57:17 2010
@@ -63,10 +63,10 @@
def test_stack_size(self):
# Various stack size tests.
- self.assertEquals(thread.stack_size(), 0, "intial stack size is not 0")
+ self.assertEqual(thread.stack_size(), 0, "initial stack size is not 0")
thread.stack_size(0)
- self.assertEquals(thread.stack_size(), 0, "stack_size not reset to default")
+ self.assertEqual(thread.stack_size(), 0, "stack_size not reset to default")
if os.name not in ("nt", "os2", "posix"):
return
@@ -86,7 +86,7 @@
fail_msg = "stack_size(%d) failed - should succeed"
for tss in (262144, 0x100000, 0):
thread.stack_size(tss)
- self.assertEquals(thread.stack_size(), tss, fail_msg % tss)
+ self.assertEqual(thread.stack_size(), tss, fail_msg % tss)
verbose_print("successfully set stack_size(%d)" % tss)
for tss in (262144, 0x100000):
@@ -115,7 +115,7 @@
thread.start_new_thread(task, ())
while not started:
time.sleep(0.01)
- self.assertEquals(thread._count(), orig + 1)
+ self.assertEqual(thread._count(), orig + 1)
# Allow the task to finish.
mut.release()
# The only reliable way to be sure that the thread ended from the
@@ -126,7 +126,7 @@
del task
while not done:
time.sleep(0.01)
- self.assertEquals(thread._count(), orig)
+ self.assertEqual(thread._count(), orig)
class Barrier:
@@ -199,7 +199,8 @@
self.read_fd, self.write_fd = os.pipe()
@unittest.skipIf(sys.platform.startswith('win'),
- "This test is only appropriate for POSIX-like systems.")
+ "This test is only appropriate for POSIX-like systems.")
+ @support.reap_threads
def test_forkinthread(self):
def thread1():
try:
Modified: python/branches/py3k-jit/Lib/test/test_unicode.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_unicode.py (original)
+++ python/branches/py3k-jit/Lib/test/test_unicode.py Mon Mar 22 22:57:17 2010
@@ -31,18 +31,11 @@
return None
codecs.register(search_function)
-class UnicodeTest(
- string_tests.CommonTest,
- string_tests.MixinStrUnicodeUserStringTest,
- string_tests.MixinStrUnicodeTest,
- ):
- type2test = str
-
- def setUp(self):
- self.warning_filters = warnings.filters[:]
+class UnicodeTest(string_tests.CommonTest,
+ string_tests.MixinStrUnicodeUserStringTest,
+ string_tests.MixinStrUnicodeTest):
- def tearDown(self):
- warnings.filters = self.warning_filters
+ type2test = str
def checkequalnofix(self, result, object, methodname, *args):
method = getattr(object, methodname)
@@ -283,11 +276,12 @@
self.assertRaises(TypeError, 'replace'.replace, "r", 42)
def test_bytes_comparison(self):
- warnings.simplefilter('ignore', BytesWarning)
- self.assertEqual('abc' == b'abc', False)
- self.assertEqual('abc' != b'abc', True)
- self.assertEqual('abc' == bytearray(b'abc'), False)
- self.assertEqual('abc' != bytearray(b'abc'), True)
+ with support.check_warnings():
+ warnings.simplefilter('ignore', BytesWarning)
+ self.assertEqual('abc' == b'abc', False)
+ self.assertEqual('abc' != b'abc', True)
+ self.assertEqual('abc' == bytearray(b'abc'), False)
+ self.assertEqual('abc' != bytearray(b'abc'), True)
def test_comparison(self):
# Comparisons:
@@ -1227,6 +1221,14 @@
self.assertRaises(MemoryError, alloc)
self.assertRaises(MemoryError, alloc)
+ def test_format_subclass(self):
+ class S(str):
+ def __str__(self):
+ return '__str__ overridden'
+ s = S('xxx')
+ self.assertEquals("%s" % s, '__str__ overridden')
+ self.assertEquals("{}".format(s), '__str__ overridden')
+
def test_main():
support.run_unittest(__name__)
Modified: python/branches/py3k-jit/Lib/test/test_unittest.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_unittest.py (original)
+++ python/branches/py3k-jit/Lib/test/test_unittest.py Mon Mar 22 22:57:17 2010
@@ -291,6 +291,21 @@
suite = loader.loadTestsFromModule(m, use_load_tests=False)
self.assertEquals(load_tests_args, [])
+ def test_loadTestsFromModule__faulty_load_tests(self):
+ m = types.ModuleType('m')
+
+ def load_tests(loader, tests, pattern):
+ raise TypeError('some failure')
+ m.load_tests = load_tests
+
+ loader = unittest.TestLoader()
+ suite = loader.loadTestsFromModule(m)
+ self.assertIsInstance(suite, unittest.TestSuite)
+ self.assertEqual(suite.countTestCases(), 1)
+ test = list(suite)[0]
+
+ self.assertRaisesRegexp(TypeError, "some failure", test.m)
+
################################################################
### /Tests for TestLoader.loadTestsFromModule()
@@ -2081,6 +2096,42 @@
'Tests getDescription() for a method with a longer '
'docstring.'))
+ def testStackFrameTrimming(self):
+ class Frame(object):
+ class tb_frame(object):
+ f_globals = {}
+ result = unittest.TestResult()
+ self.assertFalse(result._is_relevant_tb_level(Frame))
+
+ Frame.tb_frame.f_globals['__unittest'] = True
+ self.assertTrue(result._is_relevant_tb_level(Frame))
+
+ def testFailFast(self):
+ result = unittest.TestResult()
+ result._exc_info_to_string = lambda *_: ''
+ result.failfast = True
+ result.addError(None, None)
+ self.assertTrue(result.shouldStop)
+
+ result = unittest.TestResult()
+ result._exc_info_to_string = lambda *_: ''
+ result.failfast = True
+ result.addFailure(None, None)
+ self.assertTrue(result.shouldStop)
+
+ result = unittest.TestResult()
+ result._exc_info_to_string = lambda *_: ''
+ result.failfast = True
+ result.addUnexpectedSuccess(None)
+ self.assertTrue(result.shouldStop)
+
+ def testFailFastSetByRunner(self):
+ runner = unittest.TextTestRunner(stream=io.StringIO(), failfast=True)
+ def test(result):
+ self.assertTrue(result.failfast)
+ result = runner.run(test)
+
+
classDict = dict(unittest.TestResult.__dict__)
for m in ('addSkip', 'addExpectedFailure', 'addUnexpectedSuccess',
'__init__'):
@@ -2156,21 +2207,23 @@
class Bar(Foo):
def test2(self): pass
-class LoggingTestCase(unittest.TestCase):
- """A test case which logs its calls."""
-
- def __init__(self, events):
- super(LoggingTestCase, self).__init__('test')
- self.events = events
-
- def setUp(self):
- self.events.append('setUp')
-
- def test(self):
- self.events.append('test')
-
- def tearDown(self):
- self.events.append('tearDown')
+def getLoggingTestCase():
+ class LoggingTestCase(unittest.TestCase):
+ """A test case which logs its calls."""
+
+ def __init__(self, events):
+ super(LoggingTestCase, self).__init__('test')
+ self.events = events
+
+ def setUp(self):
+ self.events.append('setUp')
+
+ def test(self):
+ self.events.append('test')
+
+ def tearDown(self):
+ self.events.append('tearDown')
+ return LoggingTestCase
class ResultWithNoStartTestRunStopTestRun(object):
"""An object honouring TestResult before startTestRun/stopTestRun."""
@@ -2297,7 +2350,7 @@
events = []
result = LoggingResult(events)
- class Foo(LoggingTestCase):
+ class Foo(getLoggingTestCase()):
def setUp(self):
super(Foo, self).setUp()
raise RuntimeError('raised by Foo.setUp')
@@ -2310,7 +2363,7 @@
def test_run_call_order__error_in_setUp_default_result(self):
events = []
- class Foo(LoggingTestCase):
+ class Foo(getLoggingTestCase()):
def defaultTestResult(self):
return LoggingResult(self.events)
@@ -2334,7 +2387,7 @@
events = []
result = LoggingResult(events)
- class Foo(LoggingTestCase):
+ class Foo(getLoggingTestCase()):
def test(self):
super(Foo, self).test()
raise RuntimeError('raised by Foo.test')
@@ -2349,7 +2402,7 @@
def test_run_call_order__error_in_test_default_result(self):
events = []
- class Foo(LoggingTestCase):
+ class Foo(getLoggingTestCase()):
def defaultTestResult(self):
return LoggingResult(self.events)
@@ -2373,7 +2426,7 @@
events = []
result = LoggingResult(events)
- class Foo(LoggingTestCase):
+ class Foo(getLoggingTestCase()):
def test(self):
super(Foo, self).test()
self.fail('raised by Foo.test')
@@ -2386,7 +2439,7 @@
# "When a test fails with a default result stopTestRun is still called."
def test_run_call_order__failure_in_test_default_result(self):
- class Foo(LoggingTestCase):
+ class Foo(getLoggingTestCase()):
def defaultTestResult(self):
return LoggingResult(self.events)
def test(self):
@@ -2410,7 +2463,7 @@
events = []
result = LoggingResult(events)
- class Foo(LoggingTestCase):
+ class Foo(getLoggingTestCase()):
def tearDown(self):
super(Foo, self).tearDown()
raise RuntimeError('raised by Foo.tearDown')
@@ -2423,7 +2476,7 @@
# "When tearDown errors with a default result stopTestRun is still called."
def test_run_call_order__error_in_tearDown_default_result(self):
- class Foo(LoggingTestCase):
+ class Foo(getLoggingTestCase()):
def defaultTestResult(self):
return LoggingResult(self.events)
def tearDown(self):
@@ -2758,22 +2811,45 @@
self.assertRaises(self.failureException, self.assertDictEqual, [], d)
self.assertRaises(self.failureException, self.assertDictEqual, 1, 1)
- self.assertSameElements([1, 2, 3], [3, 2, 1])
- self.assertSameElements([1, 2] + [3] * 100, [1] * 100 + [2, 3])
- self.assertSameElements(['foo', 'bar', 'baz'], ['bar', 'baz', 'foo'])
- self.assertRaises(self.failureException, self.assertSameElements,
+ def testAssertItemsEqual(self):
+ a = object()
+ self.assertItemsEqual([1, 2, 3], [3, 2, 1])
+ self.assertItemsEqual(['foo', 'bar', 'baz'], ['bar', 'baz', 'foo'])
+ self.assertItemsEqual([a, a, 2, 2, 3], (a, 2, 3, a, 2))
+ self.assertItemsEqual([1, "2", "a", "a"], ["a", "2", True, "a"])
+ self.assertRaises(self.failureException, self.assertItemsEqual,
+ [1, 2] + [3] * 100, [1] * 100 + [2, 3])
+ self.assertRaises(self.failureException, self.assertItemsEqual,
+ [1, "2", "a", "a"], ["a", "2", True, 1])
+ self.assertRaises(self.failureException, self.assertItemsEqual,
[10], [10, 11])
- self.assertRaises(self.failureException, self.assertSameElements,
+ self.assertRaises(self.failureException, self.assertItemsEqual,
[10, 11], [10])
+ self.assertRaises(self.failureException, self.assertItemsEqual,
+ [10, 11, 10], [10, 11])
# Test that sequences of unhashable objects can be tested for sameness:
- self.assertSameElements([[1, 2], [3, 4]], [[3, 4], [1, 2]])
+ self.assertItemsEqual([[1, 2], [3, 4], 0], [False, [3, 4], [1, 2]])
- self.assertSameElements([{'a': 1}, {'b': 2}], [{'b': 2}, {'a': 1}])
- self.assertRaises(self.failureException, self.assertSameElements,
+ # hashable types, but not orderable
+ self.assertRaises(self.failureException, self.assertItemsEqual,
+ [], [divmod, 'x', 1, 5j, 2j, frozenset()])
+ # comparing dicts raises a py3k warning
+ self.assertItemsEqual([{'a': 1}, {'b': 2}], [{'b': 2}, {'a': 1}])
+ # comparing heterogenous non-hashable sequences raises a py3k warning
+ self.assertItemsEqual([1, 'x', divmod, []], [divmod, [], 'x', 1])
+ self.assertRaises(self.failureException, self.assertItemsEqual,
+ [], [divmod, [], 'x', 1, 5j, 2j, set()])
+ self.assertRaises(self.failureException, self.assertItemsEqual,
[[1]], [[2]])
- self.assertRaises(self.failureException, self.assertSameElements,
- [{'a': 1}, {'b': 2}], [{'b': 2}, {'a': 2}])
+
+ # Same elements, but not same sequence length
+ self.assertRaises(self.failureException, self.assertItemsEqual,
+ [1, 1, 2], [2, 1])
+ self.assertRaises(self.failureException, self.assertItemsEqual,
+ [1, 1, "2", "a", "a"], ["2", "2", True, "a"])
+ self.assertRaises(self.failureException, self.assertItemsEqual,
+ [1, {'b': 2}, None, True], [{'b': 2}, True, None])
def testAssertSetEqual(self):
set1 = set()
@@ -2991,7 +3067,8 @@
(self.failIfAlmostEqual, (3.0, 5.0)),
(self.failUnless, (True,)),
(self.failUnlessRaises, (TypeError, lambda _: 3.14 + 'spam')),
- (self.failIf, (False,))
+ (self.failIf, (False,)),
+ (self.assertSameElements, ([1, 1, 2, 3], [1, 2, 3]))
)
for meth, args in old:
with warnings.catch_warnings(record=True) as w:
@@ -3338,8 +3415,8 @@
"^Missing: 'key'$",
"^Missing: 'key' : oops$"])
- def testAssertSameElements(self):
- self.assertMessages('assertSameElements', ([], [None]),
+ def testAssertItemsEqual(self):
+ self.assertMessages('assertItemsEqual', ([], [None]),
[r"\[None\]$", "^oops$",
r"\[None\]$",
r"\[None\] : oops$"])
@@ -3908,13 +3985,15 @@
program._do_discovery(['-p', 'fish'], Loader=Loader)
self.assertEqual(program.test, 'tests')
self.assertEqual(Loader.args, [('.', 'fish', None)])
+ self.assertFalse(program.failfast)
Loader.args = []
program = object.__new__(TestProgram)
- program._do_discovery(['-p', 'eggs', '-s', 'fish', '-v'], Loader=Loader)
+ program._do_discovery(['-p', 'eggs', '-s', 'fish', '-v', '-f'], Loader=Loader)
self.assertEqual(program.test, 'tests')
self.assertEqual(Loader.args, [('fish', 'eggs', None)])
self.assertEqual(program.verbosity, 2)
+ self.assertTrue(program.failfast)
class TestSetups(unittest.TestCase):
Modified: python/branches/py3k-jit/Lib/test/test_xml_etree.py
==============================================================================
--- python/branches/py3k-jit/Lib/test/test_xml_etree.py (original)
+++ python/branches/py3k-jit/Lib/test/test_xml_etree.py Mon Mar 22 22:57:17 2010
@@ -597,8 +597,8 @@
</ns0:root>
>>> parser = ET.XMLParser()
- >>> parser.version # XXX: Upgrade to 2.0.1?
- 'Expat 2.0.0'
+ >>> parser.version # doctest: +ELLIPSIS
+ 'Expat ...'
>>> parser.feed(open(SIMPLE_XMLFILE).read())
>>> print(serialize(parser.close()))
<root>
Modified: python/branches/py3k-jit/Lib/unittest/__init__.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/__init__.py (original)
+++ python/branches/py3k-jit/Lib/unittest/__init__.py Mon Mar 22 22:57:17 2010
@@ -52,6 +52,7 @@
# Expose obsolete functions for backwards compatibility
__all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases'])
+__unittest = True
from .result import TestResult
from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf,
Modified: python/branches/py3k-jit/Lib/unittest/__main__.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/__main__.py (original)
+++ python/branches/py3k-jit/Lib/unittest/__main__.py Mon Mar 22 22:57:17 2010
@@ -4,5 +4,9 @@
if sys.argv[0].endswith("__main__.py"):
sys.argv[0] = "unittest"
-from .main import main
+__unittest = True
+
+from .main import main, TestProgram, USAGE_AS_MAIN
+TestProgram.USAGE = USAGE_AS_MAIN
+
main(module=None)
Modified: python/branches/py3k-jit/Lib/unittest/case.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/case.py (original)
+++ python/branches/py3k-jit/Lib/unittest/case.py Mon Mar 22 22:57:17 2010
@@ -11,6 +11,8 @@
from .util import (strclass, safe_repr, sorted_list_difference,
unorderable_list_difference)
+__unittest = True
+
class SkipTest(Exception):
"""
@@ -700,10 +702,9 @@
msg: Optional message to use on failure instead of a list of
differences.
- For more general containership equality, assertSameElements will work
- with things other than sets. This uses ducktyping to support
- different types of sets, and is optimized for sets specifically
- (parameters must support a difference method).
+ assertSetEqual uses ducktyping to support different types of sets, and
+ is optimized for sets specifically (parameters must support a
+ difference method).
"""
try:
difference1 = set1.difference(set2)
@@ -809,6 +810,8 @@
set(actual))`` but it works with sequences of unhashable objects as
well.
"""
+ warnings.warn('assertSameElements is deprecated',
+ DeprecationWarning)
try:
expected = set(expected_seq)
actual = set(actual_seq)
@@ -838,6 +841,44 @@
standardMsg = '\n'.join(errors)
self.fail(self._formatMessage(msg, standardMsg))
+
+ def assertItemsEqual(self, expected_seq, actual_seq, msg=None):
+ """An unordered sequence / set specific comparison. It asserts that
+ expected_seq and actual_seq contain the same elements. It is
+ the equivalent of::
+
+ self.assertEqual(sorted(expected_seq), sorted(actual_seq))
+
+ Raises with an error message listing which elements of expected_seq
+ are missing from actual_seq and vice versa if any.
+
+ Asserts that each element has the same count in both sequences.
+ Example:
+ - [0, 1, 1] and [1, 0, 1] compare equal.
+ - [0, 0, 1] and [0, 1] compare unequal.
+ """
+ try:
+ expected = sorted(expected_seq)
+ actual = sorted(actual_seq)
+ except TypeError:
+ # Unsortable items (example: set(), complex(), ...)
+ expected = list(expected_seq)
+ actual = list(actual_seq)
+ missing, unexpected = unorderable_list_difference(expected, actual)
+ else:
+ return self.assertSequenceEqual(expected, actual, msg=msg)
+
+ errors = []
+ if missing:
+ errors.append('Expected, but missing:\n %s' %
+ safe_repr(missing))
+ if unexpected:
+ errors.append('Unexpected, but present:\n %s' %
+ safe_repr(unexpected))
+ if errors:
+ standardMsg = '\n'.join(errors)
+ self.fail(self._formatMessage(msg, standardMsg))
+
def assertMultiLineEqual(self, first, second, msg=None):
"""Assert that two multi-line strings are equal."""
self.assert_(isinstance(first, str), (
Modified: python/branches/py3k-jit/Lib/unittest/loader.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/loader.py (original)
+++ python/branches/py3k-jit/Lib/unittest/loader.py Mon Mar 22 22:57:17 2010
@@ -10,6 +10,7 @@
from . import case, suite, util
+__unittest = True
# what about .pyc or .pyo (etc)
# we would need to avoid loading the same tests multiple times
@@ -18,17 +19,19 @@
def _make_failed_import_test(name, suiteClass):
- message = 'Failed to import test module: %s' % name
- if hasattr(traceback, 'format_exc'):
- # Python 2.3 compatibility
- # format_exc returns two frames of discover.py as well
- message += '\n%s' % traceback.format_exc()
-
- def testImportFailure(self):
- raise ImportError(message)
- attrs = {name: testImportFailure}
- ModuleImportFailure = type('ModuleImportFailure', (case.TestCase,), attrs)
- return suiteClass((ModuleImportFailure(name),))
+ message = 'Failed to import test module: %s\n%s' % (name, traceback.format_exc())
+ return _make_failed_test('ModuleImportFailure', name, ImportError(message),
+ suiteClass)
+
+def _make_failed_load_tests(name, exception, suiteClass):
+ return _make_failed_test('LoadTestsFailure', name, exception, suiteClass)
+
+def _make_failed_test(classname, methodname, exception, suiteClass):
+ def testFailure(self):
+ raise exception
+ attrs = {methodname: testFailure}
+ TestClass = type(classname, (case.TestCase,), attrs)
+ return suiteClass((TestClass(methodname),))
class TestLoader(object):
@@ -63,7 +66,11 @@
load_tests = getattr(module, 'load_tests', None)
tests = self.suiteClass(tests)
if use_load_tests and load_tests is not None:
- return load_tests(self, tests, None)
+ try:
+ return load_tests(self, tests, None)
+ except Exception as e:
+ return _make_failed_load_tests(module.__name__, e,
+ self.suiteClass)
return tests
def loadTestsFromName(self, name, module=None):
@@ -234,7 +241,11 @@
for test in self._find_tests(full_path, pattern):
yield test
else:
- yield load_tests(self, tests, pattern)
+ try:
+ yield load_tests(self, tests, pattern)
+ except Exception as e:
+ yield _make_failed_load_tests(package.__name__, e,
+ self.suiteClass)
defaultTestLoader = TestLoader()
Modified: python/branches/py3k-jit/Lib/unittest/main.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/main.py (original)
+++ python/branches/py3k-jit/Lib/unittest/main.py Mon Mar 22 22:57:17 2010
@@ -6,6 +6,8 @@
from . import loader, runner
+__unittest = True
+
USAGE_AS_MAIN = """\
Usage: %(progName)s [options] [tests]
@@ -14,6 +16,7 @@
-h, --help Show this message
-v, --verbose Verbose output
-q, --quiet Minimal output
+ -f, --failfast Stop on first failure
Examples:
%(progName)s test_module - run tests from test_module
@@ -28,6 +31,7 @@
Options:
-v, --verbose Verbose output
+ -f, --failfast Stop on first failure
-s directory Directory to start discovery ('.' default)
-p pattern Pattern to match test files ('test*.py' default)
-t directory Top level directory of project (default to
@@ -44,6 +48,7 @@
-h, --help Show this message
-v, --verbose Verbose output
-q, --quiet Minimal output
+ -f, --failfast Stop on first failure
Examples:
%(progName)s - run default set of tests
@@ -53,21 +58,15 @@
in MyTestCase
"""
-if __name__ == '__main__':
- USAGE = USAGE_AS_MAIN
-else:
- USAGE = USAGE_FROM_MODULE
-
-
class TestProgram(object):
"""A command-line program that runs a set of tests; this is primarily
for making test modules conveniently executable.
"""
- USAGE = USAGE
+ USAGE = USAGE_FROM_MODULE
def __init__(self, module='__main__', defaultTest=None,
argv=None, testRunner=None,
testLoader=loader.defaultTestLoader, exit=True,
- verbosity=1):
+ verbosity=1, failfast=False):
if isinstance(module, str):
self.module = __import__(module)
for part in module.split('.')[1:]:
@@ -78,6 +77,7 @@
argv = sys.argv
self.exit = exit
+ self.failfast = failfast
self.verbosity = verbosity
self.defaultTest = defaultTest
self.testRunner = testRunner
@@ -98,9 +98,9 @@
return
import getopt
- long_opts = ['help','verbose','quiet']
+ long_opts = ['help', 'verbose', 'quiet', 'failfast']
try:
- options, args = getopt.getopt(argv[1:], 'hHvq', long_opts)
+ options, args = getopt.getopt(argv[1:], 'hHvqf', long_opts)
for opt, value in options:
if opt in ('-h','-H','--help'):
self.usageExit()
@@ -108,6 +108,8 @@
self.verbosity = 0
if opt in ('-v','--verbose'):
self.verbosity = 2
+ if opt in ('-f','--failfast'):
+ self.failfast = True
if len(args) == 0 and self.defaultTest is None:
# createTests will load tests from self.module
self.testNames = None
@@ -135,6 +137,8 @@
parser = optparse.OptionParser()
parser.add_option('-v', '--verbose', dest='verbose', default=False,
help='Verbose output', action='store_true')
+ parser.add_option('-f', '--failfast', dest='failfast', default=False,
+ help='Stop on first fail or error', action='store_true')
parser.add_option('-s', '--start-directory', dest='start', default='.',
help="Directory to start discovery ('.' default)")
parser.add_option('-p', '--pattern', dest='pattern', default='test*.py',
@@ -149,6 +153,7 @@
for name, value in zip(('start', 'pattern', 'top'), args):
setattr(options, name, value)
+ self.failfast = options.failfast
if options.verbose:
self.verbosity = 2
@@ -164,9 +169,10 @@
self.testRunner = runner.TextTestRunner
if isinstance(self.testRunner, type):
try:
- testRunner = self.testRunner(verbosity=self.verbosity)
+ testRunner = self.testRunner(verbosity=self.verbosity,
+ failfast=self.failfast)
except TypeError:
- # didn't accept the verbosity argument
+ # didn't accept the verbosity or failfast arguments
testRunner = self.testRunner()
else:
# it is assumed to be a TestRunner instance
Modified: python/branches/py3k-jit/Lib/unittest/result.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/result.py (original)
+++ python/branches/py3k-jit/Lib/unittest/result.py Mon Mar 22 22:57:17 2010
@@ -3,7 +3,17 @@
import traceback
from . import util
+from functools import wraps
+__unittest = True
+
+def failfast(method):
+ @wraps(method)
+ def inner(self, *args, **kw):
+ if getattr(self, 'failfast', False):
+ self.stop()
+ return method(self, *args, **kw)
+ return inner
class TestResult(object):
"""Holder for test result information.
@@ -19,6 +29,7 @@
_previousTestClass = None
_moduleSetUpFailed = False
def __init__(self, stream=None, descriptions=None, verbosity=None):
+ self.failfast = False
self.failures = []
self.errors = []
self.testsRun = 0
@@ -49,12 +60,14 @@
See stopTest for a method called after each test.
"""
+ @failfast
def addError(self, test, err):
"""Called when an error has occurred. 'err' is a tuple of values as
returned by sys.exc_info().
"""
self.errors.append((test, self._exc_info_to_string(err, test)))
+ @failfast
def addFailure(self, test, err):
"""Called when an error has occurred. 'err' is a tuple of values as
returned by sys.exc_info()."""
@@ -73,6 +86,7 @@
self.expectedFailures.append(
(test, self._exc_info_to_string(err, test)))
+ @failfast
def addUnexpectedSuccess(self, test):
"""Called when a test was expected to fail, but succeed."""
self.unexpectedSuccesses.append(test)
@@ -98,11 +112,7 @@
return ''.join(traceback.format_exception(exctype, value, tb))
def _is_relevant_tb_level(self, tb):
- globs = tb.tb_frame.f_globals
- is_relevant = '__name__' in globs and \
- globs["__name__"].startswith("unittest")
- del globs
- return is_relevant
+ return '__unittest' in tb.tb_frame.f_globals
def _count_relevant_tb_levels(self, tb):
length = 0
Modified: python/branches/py3k-jit/Lib/unittest/runner.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/runner.py (original)
+++ python/branches/py3k-jit/Lib/unittest/runner.py Mon Mar 22 22:57:17 2010
@@ -5,6 +5,8 @@
from . import result
+__unittest = True
+
class _WritelnDecorator(object):
"""Used to decorate file-like objects with a handy 'writeln' method"""
@@ -122,10 +124,11 @@
resultclass = TextTestResult
def __init__(self, stream=sys.stderr, descriptions=True, verbosity=1,
- resultclass=None):
+ failfast=False, resultclass=None):
self.stream = _WritelnDecorator(stream)
self.descriptions = descriptions
self.verbosity = verbosity
+ self.failfast = failfast
if resultclass is not None:
self.resultclass = resultclass
@@ -135,6 +138,7 @@
def run(self, test):
"Run the given test case or test suite."
result = self._makeResult()
+ result.failfast = self.failfast
startTime = time.time()
startTestRun = getattr(result, 'startTestRun', None)
if startTestRun is not None:
Modified: python/branches/py3k-jit/Lib/unittest/suite.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/suite.py (original)
+++ python/branches/py3k-jit/Lib/unittest/suite.py Mon Mar 22 22:57:17 2010
@@ -5,6 +5,8 @@
from . import case
from . import util
+__unittest = True
+
class BaseTestSuite(object):
"""A simple test suite that doesn't provide class or module shared fixtures.
Modified: python/branches/py3k-jit/Lib/unittest/util.py
==============================================================================
--- python/branches/py3k-jit/Lib/unittest/util.py (original)
+++ python/branches/py3k-jit/Lib/unittest/util.py Mon Mar 22 22:57:17 2010
@@ -1,5 +1,8 @@
"""Various utility functions."""
+__unittest = True
+
+
def safe_repr(obj):
try:
return repr(obj)
Modified: python/branches/py3k-jit/Mac/BuildScript/build-installer.py
==============================================================================
--- python/branches/py3k-jit/Mac/BuildScript/build-installer.py (original)
+++ python/branches/py3k-jit/Mac/BuildScript/build-installer.py Mon Mar 22 22:57:17 2010
@@ -40,16 +40,19 @@
if ln.startswith(variable):
value = ln[len(variable):].strip()
return value[1:-1]
+ raise RuntimeError, "Cannot find variable %s" % variable[:-1]
def getVersion():
return grepValue(os.path.join(SRCDIR, 'configure'), 'PACKAGE_VERSION')
+def getVersionTuple():
+ return tuple([int(n) for n in getVersion().split('.')])
+
def getFullVersion():
fn = os.path.join(SRCDIR, 'Include', 'patchlevel.h')
for ln in open(fn):
if 'PY_VERSION' in ln:
return ln.split()[-1][1:-1]
-
raise RuntimeError, "Cannot find full version??"
# The directory we'll use to create the build (will be erased and recreated)
@@ -61,12 +64,33 @@
DEPSRC = os.path.expanduser('~/Universal/other-sources')
# Location of the preferred SDK
+
+### There are some issues with the SDK selection below here,
+### The resulting binary doesn't work on all platforms that
+### it should. Always default to the 10.4u SDK until that
+### isue is resolved.
+###
+##if int(os.uname()[2].split('.')[0]) == 8:
+## # Explicitly use the 10.4u (universal) SDK when
+## # building on 10.4, the system headers are not
+## # useable for a universal build
+## SDKPATH = "/Developer/SDKs/MacOSX10.4u.sdk"
+##else:
+## SDKPATH = "/"
+
SDKPATH = "/Developer/SDKs/MacOSX10.4u.sdk"
-#SDKPATH = "/"
universal_opts_map = { '32-bit': ('i386', 'ppc',),
'64-bit': ('x86_64', 'ppc64',),
- 'all': ('i386', 'ppc', 'x86_64', 'ppc64',) }
+ 'intel': ('i386', 'x86_64'),
+ '3-way': ('ppc', 'i386', 'x86_64'),
+ 'all': ('i386', 'ppc', 'x86_64', 'ppc64',) }
+default_target_map = {
+ '64-bit': '10.5',
+ '3-way': '10.5',
+ 'intel': '10.5',
+ 'all': '10.5',
+}
UNIVERSALOPTS = tuple(universal_opts_map.keys())
@@ -84,6 +108,17 @@
# $MACOSX_DEPLOYMENT_TARGET -> minimum OS X level
DEPTARGET = '10.3'
+target_cc_map = {
+ '10.3': 'gcc-4.0',
+ '10.4': 'gcc-4.0',
+ '10.5': 'gcc-4.0',
+ '10.6': 'gcc-4.2',
+}
+
+CC = target_cc_map[DEPTARGET]
+
+PYTHON_3 = getVersionTuple() >= (3, 0)
+
USAGE = textwrap.dedent("""\
Usage: build_python [options]
@@ -104,177 +139,203 @@
# [The recipes are defined here for convenience but instantiated later after
# command line options have been processed.]
def library_recipes():
- return [
- dict(
- name="Bzip2 1.0.4",
- url="http://www.bzip.org/1.0.4/bzip2-1.0.4.tar.gz",
- checksum='fc310b254f6ba5fbb5da018f04533688',
- configure=None,
- install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
- shellQuote(os.path.join(WORKDIR, 'libraries')),
- ' -arch '.join(ARCHLIST),
- SDKPATH,
+ result = []
+
+ if DEPTARGET < '10.5':
+ result.extend([
+ dict(
+ name="Bzip2 1.0.5",
+ url="http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz",
+ checksum='3c15a0c8d1d3ee1c46a1634d00617b1a',
+ configure=None,
+ install='make install CC=%s PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
+ CC,
+ shellQuote(os.path.join(WORKDIR, 'libraries')),
+ ' -arch '.join(ARCHLIST),
+ SDKPATH,
+ ),
),
- ),
- dict(
- name="ZLib 1.2.3",
- url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz",
- checksum='debc62758716a169df9f62e6ab2bc634',
- configure=None,
- install='make install prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
- shellQuote(os.path.join(WORKDIR, 'libraries')),
- ' -arch '.join(ARCHLIST),
- SDKPATH,
+ dict(
+ name="ZLib 1.2.3",
+ url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz",
+ checksum='debc62758716a169df9f62e6ab2bc634',
+ configure=None,
+ install='make install CC=%s prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%(
+ CC,
+ shellQuote(os.path.join(WORKDIR, 'libraries')),
+ ' -arch '.join(ARCHLIST),
+ SDKPATH,
+ ),
),
- ),
- dict(
- # Note that GNU readline is GPL'd software
- name="GNU Readline 5.1.4",
- url="http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz" ,
- checksum='7ee5a692db88b30ca48927a13fd60e46',
- patchlevel='0',
- patches=[
- # The readline maintainers don't do actual micro releases, but
- # just ship a set of patches.
- 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-001',
- 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-002',
- 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-003',
- 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-004',
- ]
- ),
+ dict(
+ # Note that GNU readline is GPL'd software
+ name="GNU Readline 5.1.4",
+ url="http://ftp.gnu.org/pub/gnu/readline/readline-5.1.tar.gz" ,
+ checksum='7ee5a692db88b30ca48927a13fd60e46',
+ patchlevel='0',
+ patches=[
+ # The readline maintainers don't do actual micro releases, but
+ # just ship a set of patches.
+ 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-001',
+ 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-002',
+ 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-003',
+ 'http://ftp.gnu.org/pub/gnu/readline/readline-5.1-patches/readline51-004',
+ ]
+ ),
+ dict(
+ name="SQLite 3.6.11",
+ url="http://www.sqlite.org/sqlite-3.6.11.tar.gz",
+ checksum='7ebb099696ab76cc6ff65dd496d17858',
+ configure_pre=[
+ '--enable-threadsafe',
+ '--enable-tempstore',
+ '--enable-shared=no',
+ '--enable-static=yes',
+ '--disable-tcl',
+ ]
+ ),
+ dict(
+ name="NCurses 5.5",
+ url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz",
+ checksum='e73c1ac10b4bfc46db43b2ddfd6244ef',
+ configure_pre=[
+ "--without-cxx",
+ "--without-ada",
+ "--without-progs",
+ "--without-curses-h",
+ "--enable-shared",
+ "--with-shared",
+ "--datadir=/usr/share",
+ "--sysconfdir=/etc",
+ "--sharedstatedir=/usr/com",
+ "--with-terminfo-dirs=/usr/share/terminfo",
+ "--with-default-terminfo-dir=/usr/share/terminfo",
+ "--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib"%(getVersion(),),
+ "--enable-termcap",
+ ],
+ patches=[
+ "ncurses-5.5.patch",
+ ],
+ useLDFlags=False,
+ install='make && make install DESTDIR=%s && cd %s/usr/local/lib && ln -fs ../../../Library/Frameworks/Python.framework/Versions/%s/lib/lib* .'%(
+ shellQuote(os.path.join(WORKDIR, 'libraries')),
+ shellQuote(os.path.join(WORKDIR, 'libraries')),
+ getVersion(),
+ ),
+ ),
+ ])
+ result.extend([
dict(
- name="SQLite 3.6.11",
- url="http://www.sqlite.org/sqlite-3.6.11.tar.gz",
- checksum='7ebb099696ab76cc6ff65dd496d17858',
+ name="Sleepycat DB 4.7.25",
+ url="http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz",
+ checksum='ec2b87e833779681a0c3a814aa71359e',
+ buildDir="build_unix",
+ configure="../dist/configure",
configure_pre=[
- '--enable-threadsafe',
- '--enable-tempstore',
- '--enable-shared=no',
- '--enable-static=yes',
- '--disable-tcl',
+ '--includedir=/usr/local/include/db4',
]
),
+ ])
- dict(
- name="NCurses 5.5",
- url="http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.5.tar.gz",
- checksum='e73c1ac10b4bfc46db43b2ddfd6244ef',
- configure_pre=[
- "--without-cxx",
- "--without-ada",
- "--without-progs",
- "--without-curses-h",
- "--enable-shared",
- "--with-shared",
- "--datadir=/usr/share",
- "--sysconfdir=/etc",
- "--sharedstatedir=/usr/com",
- "--with-terminfo-dirs=/usr/share/terminfo",
- "--with-default-terminfo-dir=/usr/share/terminfo",
- "--libdir=/Library/Frameworks/Python.framework/Versions/%s/lib"%(getVersion(),),
- "--enable-termcap",
- ],
- patches=[
- "ncurses-5.5.patch",
- ],
- useLDFlags=False,
- install='make && make install DESTDIR=%s && cd %s/usr/local/lib && ln -fs ../../../Library/Frameworks/Python.framework/Versions/%s/lib/lib* .'%(
- shellQuote(os.path.join(WORKDIR, 'libraries')),
- shellQuote(os.path.join(WORKDIR, 'libraries')),
- getVersion(),
- ),
- ),
-]
+ return result
-# Instructions for building packages inside the .mpkg.
-PKG_RECIPES = [
- dict(
- name="PythonFramework",
- long_name="Python Framework",
- source="/Library/Frameworks/Python.framework",
- readme="""\
- This package installs Python.framework, that is the python
- interpreter and the standard library. This also includes Python
- wrappers for lots of Mac OS X API's.
- """,
- postflight="scripts/postflight.framework",
- selected='selected',
- ),
- dict(
- name="PythonApplications",
- long_name="GUI Applications",
- source="/Applications/Python %(VER)s",
- readme="""\
- This package installs IDLE (an interactive Python IDE),
- Python Launcher and Build Applet (create application bundles
- from python scripts).
- It also installs a number of examples and demos.
- """,
- required=False,
- selected='selected',
- ),
- dict(
- name="PythonUnixTools",
- long_name="UNIX command-line tools",
- source="/usr/local/bin",
- readme="""\
- This package installs the unix tools in /usr/local/bin for
- compatibility with older releases of Python. This package
- is not necessary to use Python.
- """,
- required=False,
- selected='selected',
- ),
- dict(
- name="PythonDocumentation",
- long_name="Python Documentation",
- topdir="/Library/Frameworks/Python.framework/Versions/%(VER)s/Resources/English.lproj/Documentation",
- source="/pydocs",
- readme="""\
- This package installs the python documentation at a location
- that is useable for pydoc and IDLE. If you have installed Xcode
- it will also install a link to the documentation in
- /Developer/Documentation/Python
- """,
- postflight="scripts/postflight.documentation",
- required=False,
- selected='selected',
- ),
- dict(
- name="PythonProfileChanges",
- long_name="Shell profile updater",
- readme="""\
- This packages updates your shell profile to make sure that
- the Python tools are found by your shell in preference of
- the system provided Python tools.
-
- If you don't install this package you'll have to add
- "/Library/Frameworks/Python.framework/Versions/%(VER)s/bin"
- to your PATH by hand.
- """,
- postflight="scripts/postflight.patch-profile",
- topdir="/Library/Frameworks/Python.framework",
- source="/empty-dir",
- required=False,
- selected='unselected',
- ),
- dict(
- name="PythonSystemFixes",
- long_name="Fix system Python",
- readme="""\
- This package updates the system python installation on
- Mac OS X 10.3 to ensure that you can build new python extensions
- using that copy of python after installing this version.
+# Instructions for building packages inside the .mpkg.
+def pkg_recipes():
+ unselected_for_python3 = ('selected', 'unselected')[PYTHON_3]
+ result = [
+ dict(
+ name="PythonFramework",
+ long_name="Python Framework",
+ source="/Library/Frameworks/Python.framework",
+ readme="""\
+ This package installs Python.framework, that is the python
+ interpreter and the standard library. This also includes Python
+ wrappers for lots of Mac OS X API's.
""",
- postflight="../Tools/fixapplepython23.py",
- topdir="/Library/Frameworks/Python.framework",
- source="/empty-dir",
- required=False,
- selected='unselected',
- )
-]
+ postflight="scripts/postflight.framework",
+ selected='selected',
+ ),
+ dict(
+ name="PythonApplications",
+ long_name="GUI Applications",
+ source="/Applications/Python %(VER)s",
+ readme="""\
+ This package installs IDLE (an interactive Python IDE),
+ Python Launcher and Build Applet (create application bundles
+ from python scripts).
+
+ It also installs a number of examples and demos.
+ """,
+ required=False,
+ selected='selected',
+ ),
+ dict(
+ name="PythonUnixTools",
+ long_name="UNIX command-line tools",
+ source="/usr/local/bin",
+ readme="""\
+ This package installs the unix tools in /usr/local/bin for
+ compatibility with older releases of Python. This package
+ is not necessary to use Python.
+ """,
+ required=False,
+ selected='selected',
+ ),
+ dict(
+ name="PythonDocumentation",
+ long_name="Python Documentation",
+ topdir="/Library/Frameworks/Python.framework/Versions/%(VER)s/Resources/English.lproj/Documentation",
+ source="/pydocs",
+ readme="""\
+ This package installs the python documentation at a location
+ that is useable for pydoc and IDLE. If you have installed Xcode
+ it will also install a link to the documentation in
+ /Developer/Documentation/Python
+ """,
+ postflight="scripts/postflight.documentation",
+ required=False,
+ selected='selected',
+ ),
+ dict(
+ name="PythonProfileChanges",
+ long_name="Shell profile updater",
+ readme="""\
+ This packages updates your shell profile to make sure that
+ the Python tools are found by your shell in preference of
+ the system provided Python tools.
+
+ If you don't install this package you'll have to add
+ "/Library/Frameworks/Python.framework/Versions/%(VER)s/bin"
+ to your PATH by hand.
+ """,
+ postflight="scripts/postflight.patch-profile",
+ topdir="/Library/Frameworks/Python.framework",
+ source="/empty-dir",
+ required=False,
+ selected=unselected_for_python3,
+ ),
+ ]
+
+ if DEPTARGET < '10.4':
+ result.append(
+ dict(
+ name="PythonSystemFixes",
+ long_name="Fix system Python",
+ readme="""\
+ This package updates the system python installation on
+ Mac OS X 10.3 to ensure that you can build new python extensions
+ using that copy of python after installing this version.
+ """,
+ postflight="../Tools/fixapplepython23.py",
+ topdir="/Library/Frameworks/Python.framework",
+ source="/empty-dir",
+ required=False,
+ selected=unselected_for_python3,
+ )
+ )
+ return result
def fatal(msg):
"""
@@ -322,10 +383,10 @@
"""
if platform.system() != 'Darwin':
- fatal("This script should be run on a Mac OS X 10.4 system")
+ fatal("This script should be run on a Mac OS X 10.4 (or later) system")
- if platform.release() <= '8.':
- fatal("This script should be run on a Mac OS X 10.4 system")
+ if int(platform.release().split('.')[0]) < 8:
+ fatal("This script should be run on a Mac OS X 10.4 (or later) system")
if not os.path.exists(SDKPATH):
fatal("Please install the latest version of Xcode and the %s SDK"%(
@@ -338,7 +399,7 @@
Parse arguments and update global settings.
"""
global WORKDIR, DEPSRC, SDKPATH, SRCDIR, DEPTARGET
- global UNIVERSALOPTS, UNIVERSALARCHS, ARCHLIST
+ global UNIVERSALOPTS, UNIVERSALARCHS, ARCHLIST, CC
if args is None:
args = sys.argv[1:]
@@ -355,6 +416,7 @@
print "Additional arguments"
sys.exit(1)
+ deptarget = None
for k, v in options:
if k in ('-h', '-?', '--help'):
print USAGE
@@ -374,11 +436,16 @@
elif k in ('--dep-target', ):
DEPTARGET=v
+ deptarget=v
elif k in ('--universal-archs', ):
if v in UNIVERSALOPTS:
UNIVERSALARCHS = v
ARCHLIST = universal_opts_map[UNIVERSALARCHS]
+ if deptarget is None:
+ # Select alternate default deployment
+ # target
+ DEPTARGET = default_target_map.get(v, '10.3')
else:
raise NotImplementedError, v
@@ -390,6 +457,8 @@
SDKPATH=os.path.abspath(SDKPATH)
DEPSRC=os.path.abspath(DEPSRC)
+ CC=target_cc_map[DEPTARGET]
+
print "Settings:"
print " * Source directory:", SRCDIR
print " * Build directory: ", WORKDIR
@@ -397,6 +466,7 @@
print " * Third-party source:", DEPSRC
print " * Deployment target:", DEPTARGET
print " * Universal architectures:", ARCHLIST
+ print " * C compiler:", CC
print ""
@@ -614,8 +684,8 @@
runCommand('make update')
runCommand('make html')
os.chdir(curDir)
- if os.path.exists(docdir):
- os.rmdir(docdir)
+ if not os.path.exists(docdir):
+ os.mkdir(docdir)
os.rename(os.path.join(buildDir, 'build', 'html'), docdir)
@@ -650,18 +720,20 @@
'libraries', 'usr', 'local', 'lib')
print "Running configure..."
runCommand("%s -C --enable-framework --enable-universalsdk=%s "
- "--with-universal-archs=%s --with-computed-gotos "
+ "--with-universal-archs=%s "
+ "%s "
"LDFLAGS='-g -L%s/libraries/usr/local/lib' "
"OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"%(
shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH),
UNIVERSALARCHS,
+ (' ', '--with-computed-gotos ')[PYTHON_3],
shellQuote(WORKDIR)[1:-1],
shellQuote(WORKDIR)[1:-1]))
print "Running make"
runCommand("make")
- print "Running make frameworkinstall"
+ print "Running make install"
runCommand("make install DESTDIR=%s"%(
shellQuote(rootDir)))
@@ -685,8 +757,6 @@
frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework')
gid = grp.getgrnam('admin').gr_gid
-
-
for dirpath, dirnames, filenames in os.walk(frmDir):
for dn in dirnames:
os.chmod(os.path.join(dirpath, dn), 0775)
@@ -733,12 +803,11 @@
os.chdir(curdir)
- # Remove the 'Current' link, that way we don't accidently mess with an already installed
- # version of python
- os.unlink(os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework', 'Versions', 'Current'))
-
-
-
+ if PYTHON_3:
+ # Remove the 'Current' link, that way we don't accidently mess
+ # with an already installed version of python 2
+ os.unlink(os.path.join(rootDir, 'Library', 'Frameworks',
+ 'Python.framework', 'Versions', 'Current'))
def patchFile(inPath, outPath):
data = fileContents(inPath)
@@ -872,9 +941,9 @@
IFPkgFlagPackageList=[
dict(
IFPkgFlagPackageLocation='%s-%s.pkg'%(item['name'], getVersion()),
- IFPkgFlagPackageSelection=item['selected'],
+ IFPkgFlagPackageSelection=item.get('selected', 'selected'),
)
- for item in PKG_RECIPES
+ for item in pkg_recipes()
],
IFPkgFormatVersion=0.10000000149011612,
IFPkgFlagBackgroundScaling="proportional",
@@ -901,7 +970,7 @@
pkgroot = os.path.join(outdir, 'Python.mpkg', 'Contents')
pkgcontents = os.path.join(pkgroot, 'Packages')
os.makedirs(pkgcontents)
- for recipe in PKG_RECIPES:
+ for recipe in pkg_recipes():
packageFromRecipe(pkgcontents, recipe)
rsrcDir = os.path.join(pkgroot, 'Resources')
@@ -949,9 +1018,9 @@
shutil.rmtree(outdir)
imagepath = os.path.join(outdir,
- 'python-%s-macosx'%(getFullVersion(),))
+ 'python-%s-macosx%s'%(getFullVersion(),DEPTARGET))
if INCLUDE_TIMESTAMP:
- imagepath = imagepath + '%04d-%02d-%02d'%(time.localtime()[:3])
+ imagepath = imagepath + '-%04d-%02d-%02d'%(time.localtime()[:3])
imagepath = imagepath + '.dmg'
os.mkdir(outdir)
@@ -1009,6 +1078,7 @@
checkEnvironment()
os.environ['MACOSX_DEPLOYMENT_TARGET'] = DEPTARGET
+ os.environ['CC'] = CC
if os.path.exists(WORKDIR):
shutil.rmtree(WORKDIR)
@@ -1055,11 +1125,8 @@
print >> fp, "# By:", pwd.getpwuid(os.getuid()).pw_gecos
fp.close()
-
-
# And copy it to a DMG
buildDMG()
-
if __name__ == "__main__":
main()
Modified: python/branches/py3k-jit/Makefile.pre.in
==============================================================================
--- python/branches/py3k-jit/Makefile.pre.in (original)
+++ python/branches/py3k-jit/Makefile.pre.in Mon Mar 22 22:57:17 2010
@@ -59,7 +59,7 @@
# Compiler options
OPT= @OPT@
BASECFLAGS= @BASECFLAGS@
-CFLAGS= $(BASECFLAGS) $(OPT) $(EXTRA_CFLAGS)
+CFLAGS= $(BASECFLAGS) @CFLAGS@ $(OPT) $(EXTRA_CFLAGS)
# Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
# be able to build extension modules using the directories specified in the
# environment variables
@@ -89,8 +89,8 @@
datarootdir= @datarootdir@
# Expanded directories
-BINDIR= $(exec_prefix)/bin
-LIBDIR= $(exec_prefix)/lib
+BINDIR= @bindir@
+LIBDIR= @libdir@
MANDIR= @mandir@
INCLUDEDIR= @includedir@
CONFINCLUDEDIR= $(exec_prefix)/include
@@ -418,8 +418,8 @@
# Build the shared modules
sharedmods: $(BUILDPYTHON)
@case $$MAKEFLAGS in \
- *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
- *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
+ *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
+ *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
esac
# Build static library
@@ -836,7 +836,7 @@
MACHDEPS= $(PLATDIR) $(EXTRAPLATDIR)
XMLLIBSUBDIRS= xml xml/dom xml/etree xml/parsers xml/sax
LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
- tkinter/test/test_ttk site-packages test test/data \
+ tkinter/test/test_ttk site-packages test \
test/decimaltestdata test/xmltestdata \
encodings \
email email/mime email/test email/test/data \
Modified: python/branches/py3k-jit/Misc/ACKS
==============================================================================
--- python/branches/py3k-jit/Misc/ACKS (original)
+++ python/branches/py3k-jit/Misc/ACKS Mon Mar 22 22:57:17 2010
@@ -838,6 +838,7 @@
Jean-Claude Wippler
Frank Wierzbicki
Lars Wirzenius
+John Wiseman
Chris Withers
Stefan Witzel
Irek Wlizlo
Modified: python/branches/py3k-jit/Misc/NEWS
==============================================================================
--- python/branches/py3k-jit/Misc/NEWS (original)
+++ python/branches/py3k-jit/Misc/NEWS Mon Mar 22 22:57:17 2010
@@ -12,6 +12,8 @@
Core and Builtins
-----------------
+- Issue #1583863: An str subclass can now override the __str__ method
+
- Issue #8014: Setting a T_UINT or T_PYSSIZET attribute of an object with
PyMemberDefs could produce an internal error; raise TypeError instead.
@@ -285,6 +287,21 @@
Library
-------
+- Issue #7512: shutil.copystat() could raise an OSError when the filesystem
+ didn't support chflags() (for example ZFS under FreeBSD). The error is
+ now silenced.
+
+- Issue #7860: platform.uname now reports the correct 'machine' type
+ when Python is running in WOW64 mode on 64 bit Windows.
+
+- Issue #3890: Fix recv() and recv_into() on non-blocking SSL sockets.
+
+- Issue #4282: Fix the main function of the profile module for a non-ASCII
+ script, open the file in binary mode and not in text mode with the default
+ (utf8) encoding.
+
+- Issue #8179: Fix macpath.realpath() on a non-existing path.
+
- Issue #8024: Update the Unicode database to 5.2.
- Issue #8168: py_compile now handles files with utf-8 BOMS.
@@ -846,6 +863,10 @@
Build
-----
+- Issue #1628484: The Makefile doesn't ignore the CFLAGS environment
+ variable anymore. It also forwards the LDFLAGS settings to the linker
+ when building a shared library.
+
- Issue #6716: Quote -x arguments of compileall in MSI installer.
Exclude 2to3 tests from compileall.
@@ -912,6 +933,9 @@
Tests
-----
+- Issue #8180: Fix test_pep277 on OS X and add more tests for special Unicode
+ normalization cases.
+
- Issue #7783: test.support.open_urlresource invalidates the outdated files
from the local cache.
Modified: python/branches/py3k-jit/Misc/Porting
==============================================================================
--- python/branches/py3k-jit/Misc/Porting (original)
+++ python/branches/py3k-jit/Misc/Porting Mon Mar 22 22:57:17 2010
@@ -31,7 +31,7 @@
it out of the config.c file.
Bang on it until you get a >>> prompt. (You may have to disable the
-importing of "site.py" by passing the -S options.)
+importing of "site.py" by passing the -S option.)
Then bang on it until it executes very simple Python statements.
Modified: python/branches/py3k-jit/Modules/_cursesmodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/_cursesmodule.c (original)
+++ python/branches/py3k-jit/Modules/_cursesmodule.c Mon Mar 22 22:57:17 2010
@@ -31,8 +31,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* CVS: $Id$ */
-
/*
A number of SysV or ncurses functions don't have wrappers yet; if you
@@ -215,7 +213,7 @@
return 1;
}
-/* Function versions of the 3 functions for tested whether curses has been
+/* Function versions of the 3 functions for testing whether curses has been
initialised or not. */
static int func_PyCursesSetupTermCalled(void)
Modified: python/branches/py3k-jit/Modules/_elementtree.c
==============================================================================
--- python/branches/py3k-jit/Modules/_elementtree.c (original)
+++ python/branches/py3k-jit/Modules/_elementtree.c Mon Mar 22 22:57:17 2010
@@ -2734,6 +2734,8 @@
char* event;
if (PyUnicode_Check(item)) {
event = _PyUnicode_AsString(item);
+ if (event == NULL)
+ goto error;
} else if (PyBytes_Check(item))
event = PyBytes_AS_STRING(item);
else {
Modified: python/branches/py3k-jit/Modules/_io/fileio.c
==============================================================================
--- python/branches/py3k-jit/Modules/_io/fileio.c (original)
+++ python/branches/py3k-jit/Modules/_io/fileio.c Mon Mar 22 22:57:17 2010
@@ -2,9 +2,15 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif
+#ifdef HAVE_FCNTL_H
#include <fcntl.h>
+#endif
#include <stddef.h> /* For offsetof */
#include "_iomodule.h"
Modified: python/branches/py3k-jit/Modules/signalmodule.c
==============================================================================
--- python/branches/py3k-jit/Modules/signalmodule.c (original)
+++ python/branches/py3k-jit/Modules/signalmodule.c Mon Mar 22 22:57:17 2010
@@ -7,12 +7,17 @@
#include "intrcheck.h"
#ifdef MS_WINDOWS
+#ifdef HAVE_PROCESS_H
#include <process.h>
#endif
+#endif
+#ifdef HAVE_SIGNAL_H
#include <signal.h>
-
+#endif
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
Modified: python/branches/py3k-jit/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k-jit/Objects/unicodeobject.c (original)
+++ python/branches/py3k-jit/Objects/unicodeobject.c Mon Mar 22 22:57:17 2010
@@ -9124,7 +9124,7 @@
case 's':
case 'r':
case 'a':
- if (PyUnicode_Check(v) && c == 's') {
+ if (PyUnicode_CheckExact(v) && c == 's') {
temp = v;
Py_INCREF(temp);
}
Modified: python/branches/py3k-jit/Parser/myreadline.c
==============================================================================
--- python/branches/py3k-jit/Parser/myreadline.c (original)
+++ python/branches/py3k-jit/Parser/myreadline.c Mon Mar 22 22:57:17 2010
@@ -36,66 +36,63 @@
my_fgets(char *buf, int len, FILE *fp)
{
char *p;
- for (;;) {
- if (PyOS_InputHook != NULL)
- (void)(PyOS_InputHook)();
- errno = 0;
- p = fgets(buf, len, fp);
- if (p != NULL)
- return 0; /* No error */
+ if (PyOS_InputHook != NULL)
+ (void)(PyOS_InputHook)();
+ errno = 0;
+ p = fgets(buf, len, fp);
+ if (p != NULL)
+ return 0; /* No error */
#ifdef MS_WINDOWS
- /* In the case of a Ctrl+C or some other external event
- interrupting the operation:
- Win2k/NT: ERROR_OPERATION_ABORTED is the most recent Win32
- error code (and feof() returns TRUE).
- Win9x: Ctrl+C seems to have no effect on fgets() returning
- early - the signal handler is called, but the fgets()
- only returns "normally" (ie, when Enter hit or feof())
+ /* In the case of a Ctrl+C or some other external event
+ interrupting the operation:
+ Win2k/NT: ERROR_OPERATION_ABORTED is the most recent Win32
+ error code (and feof() returns TRUE).
+ Win9x: Ctrl+C seems to have no effect on fgets() returning
+ early - the signal handler is called, but the fgets()
+ only returns "normally" (ie, when Enter hit or feof())
+ */
+ if (GetLastError()==ERROR_OPERATION_ABORTED) {
+ /* Signals come asynchronously, so we sleep a brief
+ moment before checking if the handler has been
+ triggered (we cant just return 1 before the
+ signal handler has been called, as the later
+ signal may be treated as a separate interrupt).
*/
- if (GetLastError()==ERROR_OPERATION_ABORTED) {
- /* Signals come asynchronously, so we sleep a brief
- moment before checking if the handler has been
- triggered (we cant just return 1 before the
- signal handler has been called, as the later
- signal may be treated as a separate interrupt).
- */
- Sleep(1);
- if (PyOS_InterruptOccurred()) {
- return 1; /* Interrupt */
- }
- /* Either the sleep wasn't long enough (need a
- short loop retrying?) or not interrupted at all
- (in which case we should revisit the whole thing!)
- Logging some warning would be nice. assert is not
- viable as under the debugger, the various dialogs
- mean the condition is not true.
- */
+ Sleep(1);
+ if (PyOS_InterruptOccurred()) {
+ return 1; /* Interrupt */
}
+ /* Either the sleep wasn't long enough (need a
+ short loop retrying?) or not interrupted at all
+ (in which case we should revisit the whole thing!)
+ Logging some warning would be nice. assert is not
+ viable as under the debugger, the various dialogs
+ mean the condition is not true.
+ */
+ }
#endif /* MS_WINDOWS */
- if (feof(fp)) {
- return -1; /* EOF */
- }
+ if (feof(fp)) {
+ return -1; /* EOF */
+ }
#ifdef EINTR
- if (errno == EINTR) {
- int s;
+ if (errno == EINTR) {
+ int s;
#ifdef WITH_THREAD
- PyEval_RestoreThread(_PyOS_ReadlineTState);
+ PyEval_RestoreThread(_PyOS_ReadlineTState);
#endif
- s = PyErr_CheckSignals();
+ s = PyErr_CheckSignals();
#ifdef WITH_THREAD
- PyEval_SaveThread();
+ PyEval_SaveThread();
#endif
- if (s < 0) {
- return 1;
- }
+ if (s < 0) {
+ return 1;
}
+ }
#endif
- if (PyOS_InterruptOccurred()) {
- return 1; /* Interrupt */
- }
- return -2; /* Error */
+ if (PyOS_InterruptOccurred()) {
+ return 1; /* Interrupt */
}
- /* NOTREACHED */
+ return -2; /* Error */
}
Modified: python/branches/py3k-jit/Python/ceval.c
==============================================================================
--- python/branches/py3k-jit/Python/ceval.c (original)
+++ python/branches/py3k-jit/Python/ceval.c Mon Mar 22 22:57:17 2010
@@ -3041,6 +3041,7 @@
register PyObject **fastlocals, **freevars;
PyThreadState *tstate = PyThreadState_GET();
PyObject *x, *u;
+ int total_args = co->co_argcount + co->co_kwonlyargcount;
if (globals == NULL) {
PyErr_SetString(PyExc_SystemError,
@@ -3057,9 +3058,7 @@
fastlocals = f->f_localsplus;
freevars = f->f_localsplus + co->co_nlocals;
- if (co->co_argcount > 0 ||
- co->co_kwonlyargcount > 0 ||
- co->co_flags & (CO_VARARGS | CO_VARKEYWORDS)) {
+ if (total_args || co->co_flags & (CO_VARARGS | CO_VARKEYWORDS)) {
int i;
int n = argcount;
PyObject *kwdict = NULL;
@@ -3067,7 +3066,7 @@
kwdict = PyDict_New();
if (kwdict == NULL)
goto fail;
- i = co->co_argcount + co->co_kwonlyargcount;
+ i = total_args;
if (co->co_flags & CO_VARARGS)
i++;
SETLOCAL(i, kwdict);
@@ -3076,13 +3075,12 @@
if (!(co->co_flags & CO_VARARGS)) {
PyErr_Format(PyExc_TypeError,
"%U() takes %s %d "
- "%spositional argument%s (%d given)",
+ "argument%s (%d given)",
co->co_name,
defcount ? "at most" : "exactly",
- co->co_argcount,
- kwcount ? "non-keyword " : "",
- co->co_argcount == 1 ? "" : "s",
- argcount);
+ total_args,
+ total_args == 1 ? "" : "s",
+ argcount + kwcount);
goto fail;
}
n = co->co_argcount;
@@ -3096,7 +3094,7 @@
u = PyTuple_New(argcount - n);
if (u == NULL)
goto fail;
- SETLOCAL(co->co_argcount + co->co_kwonlyargcount, u);
+ SETLOCAL(total_args, u);
for (i = n; i < argcount; i++) {
x = args[i];
Py_INCREF(x);
@@ -3116,18 +3114,14 @@
}
/* Speed hack: do raw pointer compares. As names are
normally interned this should almost always hit. */
- co_varnames = PySequence_Fast_ITEMS(co->co_varnames);
- for (j = 0;
- j < co->co_argcount + co->co_kwonlyargcount;
- j++) {
+ co_varnames = ((PyTupleObject *)(co->co_varnames))->ob_item;
+ for (j = 0; j < total_args; j++) {
PyObject *nm = co_varnames[j];
if (nm == keyword)
goto kw_found;
}
/* Slow fallback, just in case */
- for (j = 0;
- j < co->co_argcount + co->co_kwonlyargcount;
- j++) {
+ for (j = 0; j < total_args; j++) {
PyObject *nm = co_varnames[j];
int cmp = PyObject_RichCompareBool(
keyword, nm, Py_EQ);
@@ -3136,22 +3130,17 @@
else if (cmp < 0)
goto fail;
}
- /* Check errors from Compare */
- if (PyErr_Occurred())
+ if (j >= total_args && kwdict == NULL) {
+ PyErr_Format(PyExc_TypeError,
+ "%U() got an unexpected "
+ "keyword argument '%S'",
+ co->co_name,
+ keyword);
goto fail;
- if (j >= co->co_argcount + co->co_kwonlyargcount) {
- if (kwdict == NULL) {
- PyErr_Format(PyExc_TypeError,
- "%U() got an unexpected "
- "keyword argument '%S'",
- co->co_name,
- keyword);
- goto fail;
- }
- PyDict_SetItem(kwdict, keyword, value);
- continue;
}
-kw_found:
+ PyDict_SetItem(kwdict, keyword, value);
+ continue;
+ kw_found:
if (GETLOCAL(j) != NULL) {
PyErr_Format(PyExc_TypeError,
"%U() got multiple "
@@ -3165,20 +3154,18 @@
SETLOCAL(j, value);
}
if (co->co_kwonlyargcount > 0) {
- for (i = co->co_argcount;
- i < co->co_argcount + co->co_kwonlyargcount;
- i++) {
- PyObject *name, *def;
+ for (i = co->co_argcount; i < total_args; i++) {
+ PyObject *name;
if (GETLOCAL(i) != NULL)
continue;
name = PyTuple_GET_ITEM(co->co_varnames, i);
- def = NULL;
- if (kwdefs != NULL)
- def = PyDict_GetItem(kwdefs, name);
- if (def != NULL) {
- Py_INCREF(def);
- SETLOCAL(i, def);
- continue;
+ if (kwdefs != NULL) {
+ PyObject *def = PyDict_GetItem(kwdefs, name);
+ if (def) {
+ Py_INCREF(def);
+ SETLOCAL(i, def);
+ continue;
+ }
}
PyErr_Format(PyExc_TypeError,
"%U() needs keyword-only argument %S",
@@ -3190,16 +3177,19 @@
int m = co->co_argcount - defcount;
for (i = argcount; i < m; i++) {
if (GETLOCAL(i) == NULL) {
+ int j, given = 0;
+ for (j = 0; j < co->co_argcount; j++)
+ if (GETLOCAL(j))
+ given++;
PyErr_Format(PyExc_TypeError,
"%U() takes %s %d "
- "%spositional argument%s "
+ "argument%s "
"(%d given)",
co->co_name,
((co->co_flags & CO_VARARGS) ||
defcount) ? "at least"
: "exactly",
- m, kwcount ? "non-keyword " : "",
- m == 1 ? "" : "s", i);
+ m, m == 1 ? "" : "s", given);
goto fail;
}
}
@@ -3216,14 +3206,12 @@
}
}
}
- else {
- if (argcount > 0 || kwcount > 0) {
- PyErr_Format(PyExc_TypeError,
- "%U() takes no arguments (%d given)",
- co->co_name,
- argcount + kwcount);
- goto fail;
- }
+ else if (argcount > 0 || kwcount > 0) {
+ PyErr_Format(PyExc_TypeError,
+ "%U() takes no arguments (%d given)",
+ co->co_name,
+ argcount + kwcount);
+ goto fail;
}
/* Allocate and initialize storage for cell vars, and copy free
vars into frame. This isn't too efficient right now. */
@@ -3232,7 +3220,7 @@
Py_UNICODE *cellname, *argname;
PyObject *c;
- nargs = co->co_argcount + co->co_kwonlyargcount;
+ nargs = total_args;
if (co->co_flags & CO_VARARGS)
nargs++;
if (co->co_flags & CO_VARKEYWORDS)
Modified: python/branches/py3k-jit/Tools/README
==============================================================================
--- python/branches/py3k-jit/Tools/README (original)
+++ python/branches/py3k-jit/Tools/README Mon Mar 22 22:57:17 2010
@@ -21,9 +21,6 @@
and msgfmt.py generates a binary message catalog
from a catalog in text format.
-modulator Interactively generate boiler plate for an extension
- module. Works easiest if you have Tk.
-
pynche A Tkinter-based color editor.
scripts A number of useful single-file programs, e.g. tabnanny.py
Modified: python/branches/py3k-jit/Tools/scripts/reindent-rst.py
==============================================================================
--- python/branches/py3k-jit/Tools/scripts/reindent-rst.py (original)
+++ python/branches/py3k-jit/Tools/scripts/reindent-rst.py Mon Mar 22 22:57:17 2010
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
# Make a reST file compliant to our pre-commit hook.
# Currently just remove trailing whitespace.
More information about the Python-checkins
mailing list