summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-08-11 14:57:12 (GMT)
committerThomas Wouters <thomas@python.org>2006-08-11 14:57:12 (GMT)
commit0e3f591aeeef9ed715f8770320f4c4c7332a8794 (patch)
treec78451f502f6cd6b575a61105165ae9194e29a42 /Lib/test
parent3cf5b1eef99fbd85bbd2bcd2e6223dfec92daf8b (diff)
downloadcpython-0e3f591aeeef9ed715f8770320f4c4c7332a8794.zip
cpython-0e3f591aeeef9ed715f8770320f4c4c7332a8794.tar.gz
cpython-0e3f591aeeef9ed715f8770320f4c4c7332a8794.tar.bz2
Merged revisions 46753-51188 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r46755 | brett.cannon | 2006-06-08 18:23:04 +0200 (Thu, 08 Jun 2006) | 4 lines Make binascii.hexlify() use s# for its arguments instead of t# to actually match its documentation stating it accepts any read-only buffer. ........ r46757 | brett.cannon | 2006-06-08 19:00:45 +0200 (Thu, 08 Jun 2006) | 8 lines Buffer objects would return the read or write buffer for a wrapped object when the char buffer was requested. Now it actually returns the char buffer if available or raises a TypeError if it isn't (as is raised for the other buffer types if they are not present but requested). Not a backport candidate since it does change semantics of the buffer object (although it could be argued this is enough of a bug to bother backporting). ........ r46760 | andrew.kuchling | 2006-06-09 03:10:17 +0200 (Fri, 09 Jun 2006) | 1 line Update functools section ........ r46762 | tim.peters | 2006-06-09 04:11:02 +0200 (Fri, 09 Jun 2006) | 6 lines Whitespace normalization. Since test_file is implicated in mysterious test failures when followed by test_optparse, if I had any brains I'd look at the checkin that last changed test_file ;-) ........ r46763 | tim.peters | 2006-06-09 05:09:42 +0200 (Fri, 09 Jun 2006) | 5 lines To boost morale :-), force test_optparse to run immediately after test_file until we can figure out how to fix it. (See python-dev; at the moment we don't even know which checkin caused the problem.) ........ r46764 | tim.peters | 2006-06-09 05:51:41 +0200 (Fri, 09 Jun 2006) | 6 lines AutoFileTests.tearDown(): Removed mysterious undocumented try/except. Remove TESTFN. Throughout: used open() instead of file(), and wrapped long lines. ........ r46765 | tim.peters | 2006-06-09 06:02:06 +0200 (Fri, 09 Jun 2006) | 8 lines testUnicodeOpen(): I have no idea why, but making this test clean up after itself appears to fix the test failures when test_optparse follows test_file. test_main(): Get rid of TESTFN no matter what. That's also enough to fix the mystery failures. Doesn't hurt to fix them twice :-) ........ r46766 | tim.peters | 2006-06-09 07:12:40 +0200 (Fri, 09 Jun 2006) | 6 lines Remove the temporary hack to force test_optparse to run immediately after test_file. At least 8 buildbot boxes passed since the underlying problem got fixed, and they all failed before the fix, so there's no point to this anymore. ........ r46767 | neal.norwitz | 2006-06-09 07:54:18 +0200 (Fri, 09 Jun 2006) | 1 line Fix grammar and reflow ........ r46769 | andrew.kuchling | 2006-06-09 12:22:35 +0200 (Fri, 09 Jun 2006) | 1 line Markup fix ........ r46773 | andrew.kuchling | 2006-06-09 15:15:57 +0200 (Fri, 09 Jun 2006) | 1 line [Bug #1472827] Make saxutils.XMLGenerator handle \r\n\t in attribute values by escaping them properly. 2.4 bugfix candidate. ........ r46778 | kristjan.jonsson | 2006-06-09 18:28:01 +0200 (Fri, 09 Jun 2006) | 2 lines Turn off warning about deprecated CRT functions on for VisualStudio .NET 2005. Make the definition #ARRAYSIZE conditional. VisualStudio .NET 2005 already has it defined using a better gimmick. ........ r46779 | phillip.eby | 2006-06-09 18:40:18 +0200 (Fri, 09 Jun 2006) | 2 lines Import wsgiref into the stdlib, as of the external version 0.1-r2181. ........ r46783 | andrew.kuchling | 2006-06-09 18:44:40 +0200 (Fri, 09 Jun 2006) | 1 line Add note about XMLGenerator bugfix ........ r46784 | andrew.kuchling | 2006-06-09 18:46:51 +0200 (Fri, 09 Jun 2006) | 1 line Add note about wsgiref ........ r46785 | brett.cannon | 2006-06-09 19:05:48 +0200 (Fri, 09 Jun 2006) | 2 lines Fix inconsistency in naming within an enum. ........ r46787 | tim.peters | 2006-06-09 19:47:00 +0200 (Fri, 09 Jun 2006) | 2 lines Whitespace normalization. ........ r46792 | georg.brandl | 2006-06-09 20:29:52 +0200 (Fri, 09 Jun 2006) | 3 lines Test file.__exit__. ........ r46794 | brett.cannon | 2006-06-09 20:40:46 +0200 (Fri, 09 Jun 2006) | 2 lines svn:ignore .pyc and .pyo files. ........ r46795 | georg.brandl | 2006-06-09 20:45:48 +0200 (Fri, 09 Jun 2006) | 3 lines RFE #1491485: str/unicode.endswith()/startswith() now accept a tuple as first argument. ........ r46798 | andrew.kuchling | 2006-06-09 21:03:16 +0200 (Fri, 09 Jun 2006) | 1 line Describe startswith()/endswiith() change; add reminder about wsgiref ........ r46799 | tim.peters | 2006-06-09 21:24:44 +0200 (Fri, 09 Jun 2006) | 11 lines Implementing a happy idea from Georg Brandl: make runtest() try to clean up files and directories the tests often leave behind by mistake. This is the first time in history I don't have a bogus "db_home" directory after running the tests ;-) Also worked on runtest's docstring, to say something about all the arguments, and to document the non-obvious return values. New functions runtest_inner() and cleanup_test_droppings() in support of the above. ........ r46800 | andrew.kuchling | 2006-06-09 21:43:25 +0200 (Fri, 09 Jun 2006) | 1 line Remove unused variable ........ r46801 | andrew.kuchling | 2006-06-09 21:56:05 +0200 (Fri, 09 Jun 2006) | 1 line Add some wsgiref text ........ r46803 | thomas.heller | 2006-06-09 21:59:11 +0200 (Fri, 09 Jun 2006) | 1 line set eol-style svn property ........ r46804 | thomas.heller | 2006-06-09 22:01:01 +0200 (Fri, 09 Jun 2006) | 1 line set eol-style svn property ........ r46805 | georg.brandl | 2006-06-09 22:43:48 +0200 (Fri, 09 Jun 2006) | 3 lines Make use of new str.startswith/endswith semantics. Occurences in email and compiler were ignored due to backwards compat requirements. ........ r46806 | brett.cannon | 2006-06-10 00:31:23 +0200 (Sat, 10 Jun 2006) | 4 lines An object with __call__ as an attribute, when called, will have that attribute checked for __call__ itself, and will continue to look until it finds an object without the attribute. This can lead to an infinite recursion. Closes bug #532646, again. Will be backported. ........ r46808 | brett.cannon | 2006-06-10 00:45:54 +0200 (Sat, 10 Jun 2006) | 2 lines Fix bug introduced in rev. 46806 by not having variable declaration at the top of a block. ........ r46812 | georg.brandl | 2006-06-10 08:40:50 +0200 (Sat, 10 Jun 2006) | 4 lines Apply perky's fix for #1503157: "/".join([u"", u""]) raising OverflowError. Also improve error message on overflow. ........ r46817 | martin.v.loewis | 2006-06-10 10:14:03 +0200 (Sat, 10 Jun 2006) | 2 lines Port cygwin kill_python changes from 2.4 branch. ........ r46818 | armin.rigo | 2006-06-10 12:57:40 +0200 (Sat, 10 Jun 2006) | 4 lines SF bug #1503294. PyThreadState_GET() complains if the tstate is NULL, but only in debug mode. ........ r46819 | martin.v.loewis | 2006-06-10 14:23:46 +0200 (Sat, 10 Jun 2006) | 4 lines Patch #1495999: Part two of Windows CE changes. - update header checks, using autoconf - provide dummies for getenv, environ, and GetVersion - adjust MSC_VER check in socketmodule.c ........ r46820 | skip.montanaro | 2006-06-10 16:09:11 +0200 (Sat, 10 Jun 2006) | 1 line document the class, not its initializer ........ r46821 | greg.ward | 2006-06-10 18:40:01 +0200 (Sat, 10 Jun 2006) | 4 lines Sync with Optik docs (rev 518): * restore "Extending optparse" section * document ALWAYS_TYPED_ACTIONS (SF #1449311) ........ r46824 | thomas.heller | 2006-06-10 21:51:46 +0200 (Sat, 10 Jun 2006) | 8 lines Upgrade to ctypes version 0.9.9.7. Summary of changes: - support for 'variable sized' data - support for anonymous structure/union fields - fix severe bug with certain arrays or structures containing more than 256 fields ........ r46825 | thomas.heller | 2006-06-10 21:55:36 +0200 (Sat, 10 Jun 2006) | 8 lines Upgrade to ctypes version 0.9.9.7. Summary of changes: - support for 'variable sized' data - support for anonymous structure/union fields - fix severe bug with certain arrays or structures containing more than 256 fields ........ r46826 | fred.drake | 2006-06-10 22:01:34 +0200 (Sat, 10 Jun 2006) | 4 lines SF patch #1303595: improve description of __builtins__, explaining how it varies between __main__ and other modules, and strongly suggest not touching it but using __builtin__ if absolutely necessary ........ r46827 | fred.drake | 2006-06-10 22:02:58 +0200 (Sat, 10 Jun 2006) | 1 line credit for SF patch #1303595 ........ r46831 | thomas.heller | 2006-06-10 22:29:34 +0200 (Sat, 10 Jun 2006) | 2 lines New docs for ctypes. ........ r46834 | thomas.heller | 2006-06-10 23:07:19 +0200 (Sat, 10 Jun 2006) | 1 line Fix a wrong printf format. ........ r46835 | thomas.heller | 2006-06-10 23:17:58 +0200 (Sat, 10 Jun 2006) | 1 line Fix the second occurrence of the problematic printf format. ........ r46837 | thomas.heller | 2006-06-10 23:56:03 +0200 (Sat, 10 Jun 2006) | 1 line Don't use C++ comment. ........ r46838 | thomas.heller | 2006-06-11 00:01:50 +0200 (Sun, 11 Jun 2006) | 1 line Handle failure of PyMem_Realloc. ........ r46839 | skip.montanaro | 2006-06-11 00:38:13 +0200 (Sun, 11 Jun 2006) | 2 lines Suppress warning on MacOSX about possible use before set of proc. ........ r46840 | tim.peters | 2006-06-11 00:51:45 +0200 (Sun, 11 Jun 2006) | 8 lines shuffle() doscstring: Removed warning about sequence length versus generator period. While this was a real weakness of the older WH generator for lists with just a few dozen elements, and so could potentially bite the naive ;-), the Twister should show excellent behavior up to at least 600 elements. Module docstring: reflowed some jarringly short lines. ........ r46844 | greg.ward | 2006-06-11 02:40:49 +0200 (Sun, 11 Jun 2006) | 4 lines Bug #1361643: fix textwrap.dedent() so it handles tabs appropriately, i.e. do *not* expand tabs, but treat them as whitespace that is not equivalent to spaces. Add a couple of test cases. Clarify docs. ........ r46850 | neal.norwitz | 2006-06-11 07:44:18 +0200 (Sun, 11 Jun 2006) | 5 lines Fix Coverity # 146. newDBSequenceObject would deref dbobj, so it can't be NULL. We know it's not NULL from the ParseTuple and DbObject_Check will verify it's not NULL. ........ r46851 | neal.norwitz | 2006-06-11 07:45:25 +0200 (Sun, 11 Jun 2006) | 4 lines Wrap some long lines Top/Bottom factor out some common expressions Add a XXX comment about widing offset. ........ r46852 | neal.norwitz | 2006-06-11 07:45:47 +0200 (Sun, 11 Jun 2006) | 1 line Add versionadded to doc ........ r46853 | neal.norwitz | 2006-06-11 07:47:14 +0200 (Sun, 11 Jun 2006) | 3 lines Update doc to make it agree with code. Bottom factor out some common code. ........ r46854 | neal.norwitz | 2006-06-11 07:48:14 +0200 (Sun, 11 Jun 2006) | 3 lines f_code can't be NULL based on Frame_New and other code that derefs it. So there doesn't seem to be much point to checking here. ........ r46855 | neal.norwitz | 2006-06-11 09:26:27 +0200 (Sun, 11 Jun 2006) | 1 line Fix errors found by pychecker ........ r46856 | neal.norwitz | 2006-06-11 09:26:50 +0200 (Sun, 11 Jun 2006) | 1 line warnings was imported at module scope, no need to import again ........ r46857 | neal.norwitz | 2006-06-11 09:27:56 +0200 (Sun, 11 Jun 2006) | 5 lines Fix errors found by pychecker. I think these changes are correct, but I'm not sure. Could someone who knows how this module works test it? It can at least start on the cmd line. ........ r46858 | neal.norwitz | 2006-06-11 10:35:14 +0200 (Sun, 11 Jun 2006) | 1 line Fix errors found by pychecker ........ r46859 | ronald.oussoren | 2006-06-11 16:33:36 +0200 (Sun, 11 Jun 2006) | 4 lines This patch improves the L&F of IDLE on OSX. The changes are conditionalized on being in an IDLE.app bundle on darwin. This does a slight reorganisation of the menus and adds support for file-open events. ........ r46860 | greg.ward | 2006-06-11 16:42:41 +0200 (Sun, 11 Jun 2006) | 1 line SF #1366250: optparse docs: fix inconsistency in variable name; minor tweaks. ........ r46861 | greg.ward | 2006-06-11 18:24:11 +0200 (Sun, 11 Jun 2006) | 3 lines Bug #1498146: fix optparse to handle Unicode strings in option help, description, and epilog. ........ r46862 | thomas.heller | 2006-06-11 19:04:22 +0200 (Sun, 11 Jun 2006) | 2 lines Release the GIL during COM method calls, to avoid deadlocks in Python coded COM objects. ........ r46863 | tim.peters | 2006-06-11 21:42:51 +0200 (Sun, 11 Jun 2006) | 2 lines Whitespace normalization. ........ r46864 | tim.peters | 2006-06-11 21:43:49 +0200 (Sun, 11 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46865 | ronald.oussoren | 2006-06-11 21:45:57 +0200 (Sun, 11 Jun 2006) | 2 lines Remove message about using make frameworkinstall, that's no longer necesssary ........ r46866 | ronald.oussoren | 2006-06-11 22:23:29 +0200 (Sun, 11 Jun 2006) | 2 lines Use configure to substitute the correct prefix instead of hardcoding ........ r46867 | ronald.oussoren | 2006-06-11 22:24:45 +0200 (Sun, 11 Jun 2006) | 4 lines - Change fixapplepython23.py to ensure that it will run with /usr/bin/python on intel macs. - Fix some minor problems in the installer for OSX ........ r46868 | neal.norwitz | 2006-06-11 22:25:56 +0200 (Sun, 11 Jun 2006) | 5 lines Try to fix several networking tests. The problem is that if hosts have a search path setup, some of these hosts resolve to the wrong address. By appending a period to the hostname, the hostname should only resolve to what we want it to resolve to. Hopefully this doesn't break different bots. ........ r46869 | neal.norwitz | 2006-06-11 22:42:02 +0200 (Sun, 11 Jun 2006) | 7 lines Try to fix another networking test. The problem is that if hosts have a search path setup, some of these hosts resolve to the wrong address. By appending a period to the hostname, the hostname should only resolve to what we want it to resolve to. Hopefully this doesn't break different bots. Also add more info to failure message to aid debugging test failure. ........ r46870 | neal.norwitz | 2006-06-11 22:46:46 +0200 (Sun, 11 Jun 2006) | 4 lines Fix test on PPC64 buildbot. It raised an IOError (really an URLError which derives from an IOError). That seems valid. Env Error includes both OSError and IOError, so this seems like a reasonable fix. ........ r46871 | tim.peters | 2006-06-11 22:52:59 +0200 (Sun, 11 Jun 2006) | 10 lines compare_generic_iter(): Fixed the failure of test_wsgiref's testFileWrapper when running with -O. test_simple_validation_error still fails under -O. That appears to be because wsgiref's validate.py uses `assert` statements all over the place to check arguments for sanity. That should all be changed (it's not a logical error in the software if a user passes bogus arguments, so this isn't a reasonable use for `assert` -- checking external preconditions should generally raise ValueError or TypeError instead, as appropriate). ........ r46872 | neal.norwitz | 2006-06-11 23:38:38 +0200 (Sun, 11 Jun 2006) | 1 line Get test to pass on S/390. Shout if you think this change is incorrect. ........ r46873 | neal.norwitz | 2006-06-12 04:05:55 +0200 (Mon, 12 Jun 2006) | 1 line Cleanup Py_ssize_t a little (get rid of second #ifdef) ........ r46874 | neal.norwitz | 2006-06-12 04:06:17 +0200 (Mon, 12 Jun 2006) | 1 line Fix some Py_ssize_t issues ........ r46875 | neal.norwitz | 2006-06-12 04:06:42 +0200 (Mon, 12 Jun 2006) | 1 line Fix some Py_ssize_t issues ........ r46876 | neal.norwitz | 2006-06-12 04:07:24 +0200 (Mon, 12 Jun 2006) | 2 lines Cleanup: Remove import of types to get StringTypes, we can just use basestring. ........ r46877 | neal.norwitz | 2006-06-12 04:07:57 +0200 (Mon, 12 Jun 2006) | 1 line Don't truncate if size_t is bigger than uint ........ r46878 | neal.norwitz | 2006-06-12 04:08:41 +0200 (Mon, 12 Jun 2006) | 1 line Don't leak the list object if there's an error allocating the item storage. Backport candidate ........ r46879 | neal.norwitz | 2006-06-12 04:09:03 +0200 (Mon, 12 Jun 2006) | 1 line Fix typo. Backport if anyone cares. :-) ........ r46880 | neal.norwitz | 2006-06-12 04:09:34 +0200 (Mon, 12 Jun 2006) | 1 line Fix indentation of case and a Py_ssize_t issue. ........ r46881 | neal.norwitz | 2006-06-12 04:11:18 +0200 (Mon, 12 Jun 2006) | 3 lines Get rid of f_restricted too. Doc the other 4 ints that were already removed at the NeedForSpeed sprint. ........ r46882 | neal.norwitz | 2006-06-12 04:13:21 +0200 (Mon, 12 Jun 2006) | 1 line Fix the socket tests so they can be run concurrently. Backport candidate ........ r46883 | neal.norwitz | 2006-06-12 04:16:10 +0200 (Mon, 12 Jun 2006) | 1 line i and j are initialized below when used. No need to do it twice ........ r46884 | neal.norwitz | 2006-06-12 05:05:03 +0200 (Mon, 12 Jun 2006) | 1 line Remove unused import ........ r46885 | neal.norwitz | 2006-06-12 05:05:40 +0200 (Mon, 12 Jun 2006) | 1 line Impl ssize_t ........ r46886 | neal.norwitz | 2006-06-12 05:33:09 +0200 (Mon, 12 Jun 2006) | 6 lines Patch #1503046, Conditional compilation of zlib.(de)compressobj.copy copy is only in newer versions of zlib. This should allow zlibmodule to work with older versions like the Tru64 buildbot. ........ r46887 | phillip.eby | 2006-06-12 06:04:32 +0200 (Mon, 12 Jun 2006) | 2 lines Sync w/external release 0.1.2. Please see PEP 360 before making changes to external packages. ........ r46888 | martin.v.loewis | 2006-06-12 06:26:31 +0200 (Mon, 12 Jun 2006) | 2 lines Get rid of function pointer cast. ........ r46889 | thomas.heller | 2006-06-12 08:05:57 +0200 (Mon, 12 Jun 2006) | 3 lines I don't know how that happend, but the entire file contents was duplicated. Thanks to Simon Percivall for the heads up. ........ r46890 | nick.coghlan | 2006-06-12 10:19:37 +0200 (Mon, 12 Jun 2006) | 1 line Fix site module docstring to match the code ........ r46891 | nick.coghlan | 2006-06-12 10:23:02 +0200 (Mon, 12 Jun 2006) | 1 line Fix site module docstring to match the code for Mac OSX, too ........ r46892 | nick.coghlan | 2006-06-12 10:27:13 +0200 (Mon, 12 Jun 2006) | 1 line The site module documentation also described the Windows behaviour incorrectly. ........ r46893 | nick.coghlan | 2006-06-12 12:17:11 +0200 (Mon, 12 Jun 2006) | 1 line Make the -m switch conform to the documentation of sys.path by behaving like the -c switch ........ r46894 | kristjan.jonsson | 2006-06-12 17:45:12 +0200 (Mon, 12 Jun 2006) | 2 lines Fix the CRT argument error handling for VisualStudio .NET 2005. Install a CRT error handler and disable the assertion for debug builds. This causes CRT to set errno to EINVAL. This update fixes crash cases in the test suite where the default CRT error handler would cause process exit. ........ r46899 | thomas.heller | 2006-06-12 22:56:48 +0200 (Mon, 12 Jun 2006) | 1 line Add pep-291 compatibility markers. ........ r46901 | ka-ping.yee | 2006-06-13 01:47:52 +0200 (Tue, 13 Jun 2006) | 5 lines Add the uuid module. This module has been tested so far on Windows XP (Python 2.4 and 2.5a2), Mac OS X (Python 2.3, 2.4, and 2.5a2), and Linux (Python 2.4 and 2.5a2). ........ r46902 | tim.peters | 2006-06-13 02:30:01 +0200 (Tue, 13 Jun 2006) | 2 lines Whitespace normalization. ........ r46903 | tim.peters | 2006-06-13 02:30:50 +0200 (Tue, 13 Jun 2006) | 2 lines Added missing svn:eol-style property to text files. ........ r46905 | tim.peters | 2006-06-13 05:30:07 +0200 (Tue, 13 Jun 2006) | 5 lines get_matching_blocks(): rewrote code & comments so they match; added more comments about why it's this way at all; and removed what looked like needless expense (sorting (i, j, k) triples directly should give exactly the same order as sorting (i, (i, j, k)) pairs). ........ r46906 | neal.norwitz | 2006-06-13 06:08:53 +0200 (Tue, 13 Jun 2006) | 1 line Don't fail if another process is listening on our port. ........ r46908 | neal.norwitz | 2006-06-13 10:28:19 +0200 (Tue, 13 Jun 2006) | 2 lines Initialize the type object so pychecker can't crash the interpreter. ........ r46909 | neal.norwitz | 2006-06-13 10:41:06 +0200 (Tue, 13 Jun 2006) | 1 line Verify the crash due to EncodingMap not initialized does not return ........ r46910 | thomas.heller | 2006-06-13 10:56:14 +0200 (Tue, 13 Jun 2006) | 3 lines Add some windows datatypes that were missing from this file, and add the aliases defined in windows header files for the structures. ........ r46911 | thomas.heller | 2006-06-13 11:40:14 +0200 (Tue, 13 Jun 2006) | 3 lines Add back WCHAR, UINT, DOUBLE, _LARGE_INTEGER, _ULARGE_INTEGER. VARIANT_BOOL is a special _ctypes data type, not c_short. ........ r46912 | ronald.oussoren | 2006-06-13 13:19:56 +0200 (Tue, 13 Jun 2006) | 4 lines Linecache contains support for PEP302 loaders, but fails to deal with loaders that return None to indicate that the module is valid but no source is available. This patch fixes that. ........ r46913 | andrew.kuchling | 2006-06-13 13:57:04 +0200 (Tue, 13 Jun 2006) | 1 line Mention uuid module ........ r46915 | walter.doerwald | 2006-06-13 14:02:12 +0200 (Tue, 13 Jun 2006) | 2 lines Fix passing errors to the encoder and decoder functions. ........ r46917 | walter.doerwald | 2006-06-13 14:04:43 +0200 (Tue, 13 Jun 2006) | 3 lines errors is an attribute in the incremental decoder not an argument. ........ r46919 | andrew.macintyre | 2006-06-13 17:04:24 +0200 (Tue, 13 Jun 2006) | 11 lines Patch #1454481: Make thread stack size runtime tunable. Heavily revised, comprising revisions: 46640 - original trunk revision (backed out in r46655) 46647 - markup fix (backed out in r46655) 46692:46918 merged from branch aimacintyre-sf1454481 branch tested on buildbots (Windows buildbots had problems not related to these changes). ........ r46920 | brett.cannon | 2006-06-13 18:06:55 +0200 (Tue, 13 Jun 2006) | 2 lines Remove unused variable. ........ r46921 | andrew.kuchling | 2006-06-13 18:41:41 +0200 (Tue, 13 Jun 2006) | 1 line Add ability to set stack size ........ r46923 | marc-andre.lemburg | 2006-06-13 19:04:26 +0200 (Tue, 13 Jun 2006) | 2 lines Update pybench to version 2.0. ........ r46924 | marc-andre.lemburg | 2006-06-13 19:07:14 +0200 (Tue, 13 Jun 2006) | 2 lines Revert wrong svn copy. ........ r46925 | andrew.macintyre | 2006-06-13 19:14:36 +0200 (Tue, 13 Jun 2006) | 2 lines fix exception usage ........ r46927 | tim.peters | 2006-06-13 20:37:07 +0200 (Tue, 13 Jun 2006) | 2 lines Whitespace normalization. ........ r46928 | marc-andre.lemburg | 2006-06-13 20:56:56 +0200 (Tue, 13 Jun 2006) | 9 lines Updated to pybench 2.0. See svn.python.org/external/pybench-2.0 for the original import of that version. Note that platform.py was not copied over from pybench-2.0 since it is already part of Python 2.5. ........ r46929 | andrew.macintyre | 2006-06-13 21:02:35 +0200 (Tue, 13 Jun 2006) | 5 lines Increase the small thread stack size to get the test to pass reliably on the one buildbot that insists on more than 32kB of thread stack. ........ r46930 | marc-andre.lemburg | 2006-06-13 21:20:07 +0200 (Tue, 13 Jun 2006) | 2 lines Whitespace normalization. ........ r46931 | thomas.heller | 2006-06-13 22:18:43 +0200 (Tue, 13 Jun 2006) | 2 lines More docs for ctypes. ........ r46932 | brett.cannon | 2006-06-13 23:34:24 +0200 (Tue, 13 Jun 2006) | 2 lines Ignore .pyc and .pyo files in Pybench. ........ r46933 | brett.cannon | 2006-06-13 23:46:41 +0200 (Tue, 13 Jun 2006) | 7 lines If a classic class defined a __coerce__() method that just returned its two arguments in reverse, the interpreter would infinitely recourse trying to get a coercion that worked. So put in a recursion check after a coercion is made and the next call to attempt to use the coerced values. Fixes bug #992017 and closes crashers/coerce.py . ........ r46936 | gerhard.haering | 2006-06-14 00:24:47 +0200 (Wed, 14 Jun 2006) | 3 lines Merged changes from external pysqlite 2.3.0 release. Documentation updates will follow in a few hours at the latest. Then we should be ready for beta1. ........ r46937 | brett.cannon | 2006-06-14 00:26:13 +0200 (Wed, 14 Jun 2006) | 2 lines Missed test for rev. 46933; infinite recursion from __coerce__() returning its arguments reversed. ........ r46938 | gerhard.haering | 2006-06-14 00:53:48 +0200 (Wed, 14 Jun 2006) | 2 lines Updated documentation for pysqlite 2.3.0 API. ........ r46939 | tim.peters | 2006-06-14 06:09:25 +0200 (Wed, 14 Jun 2006) | 10 lines SequenceMatcher.get_matching_blocks(): This now guarantees that adjacent triples in the result list describe non-adjacent matching blocks. That's _nice_ to have, and Guido said he wanted it. Not a bugfix candidate: Guido or not ;-), this changes visible endcase semantics (note that some tests had to change), and nothing about this was documented before. Since it was working as designed, and behavior was consistent with the docs, it wasn't "a bug". ........ r46940 | tim.peters | 2006-06-14 06:13:00 +0200 (Wed, 14 Jun 2006) | 2 lines Repaired typo in new comment. ........ r46941 | tim.peters | 2006-06-14 06:15:27 +0200 (Wed, 14 Jun 2006) | 2 lines Whitespace normalization. ........ r46942 | fred.drake | 2006-06-14 06:25:02 +0200 (Wed, 14 Jun 2006) | 3 lines - make some disabled tests run what they intend when enabled - remove some over-zealous triple-quoting ........ r46943 | fred.drake | 2006-06-14 07:04:47 +0200 (Wed, 14 Jun 2006) | 3 lines add tests for two cases that are handled correctly in the current code, but that SF patch 1504676 as written mis-handles ........ r46944 | fred.drake | 2006-06-14 07:15:51 +0200 (Wed, 14 Jun 2006) | 1 line explain an XXX in more detail ........ r46945 | martin.v.loewis | 2006-06-14 07:21:04 +0200 (Wed, 14 Jun 2006) | 1 line Patch #1455898: Incremental mode for "mbcs" codec. ........ r46946 | georg.brandl | 2006-06-14 08:08:31 +0200 (Wed, 14 Jun 2006) | 3 lines Bug #1339007: Shelf objects now don't raise an exception in their __del__ method when initialization failed. ........ r46948 | thomas.heller | 2006-06-14 08:18:15 +0200 (Wed, 14 Jun 2006) | 1 line Fix docstring. ........ r46949 | georg.brandl | 2006-06-14 08:29:07 +0200 (Wed, 14 Jun 2006) | 2 lines Bug #1501122: mention __gt__ &co in description of comparison order. ........ r46951 | thomas.heller | 2006-06-14 09:08:38 +0200 (Wed, 14 Jun 2006) | 1 line Write more docs. ........ r46952 | georg.brandl | 2006-06-14 10:31:39 +0200 (Wed, 14 Jun 2006) | 3 lines Bug #1153163: describe __add__ vs __radd__ behavior when adding objects of same type/of subclasses of the other. ........ r46954 | georg.brandl | 2006-06-14 10:42:11 +0200 (Wed, 14 Jun 2006) | 3 lines Bug #1202018: add some common mime.types locations. ........ r46955 | georg.brandl | 2006-06-14 10:50:03 +0200 (Wed, 14 Jun 2006) | 3 lines Bug #1117556: SimpleHTTPServer now tries to find and use the system's mime.types file for determining MIME types. ........ r46957 | thomas.heller | 2006-06-14 11:09:08 +0200 (Wed, 14 Jun 2006) | 1 line Document paramflags. ........ r46958 | thomas.heller | 2006-06-14 11:20:11 +0200 (Wed, 14 Jun 2006) | 1 line Add an __all__ list, since this module does 'from ctypes import *'. ........ r46959 | andrew.kuchling | 2006-06-14 15:59:15 +0200 (Wed, 14 Jun 2006) | 1 line Add item ........ r46961 | georg.brandl | 2006-06-14 18:46:43 +0200 (Wed, 14 Jun 2006) | 3 lines Bug #805015: doc error in PyUnicode_FromEncodedObject. ........ r46962 | gerhard.haering | 2006-06-15 00:28:37 +0200 (Thu, 15 Jun 2006) | 10 lines - Added version checks in C code to make sure we don't trigger bugs in older SQLite versions. - Added version checks in test suite so that we don't execute tests that we know will fail with older (buggy) SQLite versions. Now, all tests should run against all SQLite versions from 3.0.8 until 3.3.6 (latest one now). The sqlite3 module can be built against all these SQLite versions and the sqlite3 module does its best to not trigger bugs in SQLite, but using SQLite 3.3.3 or later is recommended. ........ r46963 | tim.peters | 2006-06-15 00:38:13 +0200 (Thu, 15 Jun 2006) | 2 lines Whitespace normalization. ........ r46964 | neal.norwitz | 2006-06-15 06:54:29 +0200 (Thu, 15 Jun 2006) | 9 lines Speculative checkin (requires approval of Gerhard Haering) This backs out the test changes in 46962 which prevented crashes by not running the tests via a version check. All the version checks added in that rev were removed from the tests. Code was added to the error handler in connection.c that seems to work with older versions of sqlite including 3.1.3. ........ r46965 | neal.norwitz | 2006-06-15 07:55:49 +0200 (Thu, 15 Jun 2006) | 1 line Try to narrow window of failure on slow/busy boxes (ppc64 buildbot) ........ r46966 | martin.v.loewis | 2006-06-15 08:45:05 +0200 (Thu, 15 Jun 2006) | 2 lines Make import/lookup of mbcs fail on non-Windows systems. ........ r46967 | ronald.oussoren | 2006-06-15 10:14:18 +0200 (Thu, 15 Jun 2006) | 2 lines Patch #1446489 (zipfile: support for ZIP64) ........ r46968 | neal.norwitz | 2006-06-15 10:16:44 +0200 (Thu, 15 Jun 2006) | 6 lines Re-revert this change. Install the version check and don't run the test until Gerhard has time to fully debug the issue. This affects versions before 3.2.1 (possibly only versions earlier than 3.1.3). Based on discussion on python-checkins. ........ r46969 | gregory.p.smith | 2006-06-15 10:52:32 +0200 (Thu, 15 Jun 2006) | 6 lines - bsddb: multithreaded DB access using the simple bsddb module interface now works reliably. It has been updated to use automatic BerkeleyDB deadlock detection and the bsddb.dbutils.DeadlockWrap wrapper to retry database calls that would previously deadlock. [SF python bug #775414] ........ r46970 | gregory.p.smith | 2006-06-15 11:23:52 +0200 (Thu, 15 Jun 2006) | 2 lines minor documentation cleanup. mention the bsddb.db interface explicitly by name. ........ r46971 | neal.norwitz | 2006-06-15 11:57:03 +0200 (Thu, 15 Jun 2006) | 5 lines Steal the trick from test_compiler to print out a slow msg. This will hopefully get the buildbots to pass. Not sure this test will be feasible or even work. But everything is red now, so it can't get much worse. ........ r46972 | neal.norwitz | 2006-06-15 12:24:49 +0200 (Thu, 15 Jun 2006) | 1 line Print some more info to get an idea of how much longer the test will last ........ r46981 | tim.peters | 2006-06-15 20:04:40 +0200 (Thu, 15 Jun 2006) | 6 lines Try to reduce the extreme peak memory and disk-space use of this test. It probably still requires more disk space than most buildbots have, and in any case is still so intrusive that if we don't find another way to test this I'm taking my buildbot offline permanently ;-) ........ r46982 | tim.peters | 2006-06-15 20:06:29 +0200 (Thu, 15 Jun 2006) | 2 lines Whitespace normalization. ........ r46983 | tim.peters | 2006-06-15 20:07:28 +0200 (Thu, 15 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46984 | tim.peters | 2006-06-15 20:38:19 +0200 (Thu, 15 Jun 2006) | 2 lines Oops -- I introduced an off-by-6436159488 error. ........ r46990 | neal.norwitz | 2006-06-16 06:30:34 +0200 (Fri, 16 Jun 2006) | 1 line Disable this test until we can determine what to do about it ........ r46991 | neal.norwitz | 2006-06-16 06:31:06 +0200 (Fri, 16 Jun 2006) | 1 line Param name is dir, not directory. Update docstring. Backport candidate ........ r46992 | neal.norwitz | 2006-06-16 06:31:28 +0200 (Fri, 16 Jun 2006) | 1 line Add missing period in comment. ........ r46993 | neal.norwitz | 2006-06-16 06:32:43 +0200 (Fri, 16 Jun 2006) | 1 line Fix whitespace, there are memory leaks in this module. ........ r46995 | fred.drake | 2006-06-17 01:45:06 +0200 (Sat, 17 Jun 2006) | 3 lines SF patch 1504676: Make sgmllib char and entity references pluggable (implementation/tests contributed by Sam Ruby) ........ r46996 | fred.drake | 2006-06-17 03:07:54 +0200 (Sat, 17 Jun 2006) | 1 line fix change that broke the htmllib tests ........ r46998 | martin.v.loewis | 2006-06-17 11:15:14 +0200 (Sat, 17 Jun 2006) | 3 lines Patch #763580: Add name and value arguments to Tkinter variable classes. ........ r46999 | martin.v.loewis | 2006-06-17 11:20:41 +0200 (Sat, 17 Jun 2006) | 2 lines Patch #1096231: Add default argument to wm_iconbitmap. ........ r47000 | martin.v.loewis | 2006-06-17 11:25:15 +0200 (Sat, 17 Jun 2006) | 2 lines Patch #1494750: Destroy master after deleting children. ........ r47003 | george.yoshida | 2006-06-17 18:31:52 +0200 (Sat, 17 Jun 2006) | 2 lines markup fix ........ r47005 | george.yoshida | 2006-06-17 18:39:13 +0200 (Sat, 17 Jun 2006) | 4 lines Update url. Old url returned status code:301 Moved permanently. ........ r47007 | martin.v.loewis | 2006-06-17 20:44:27 +0200 (Sat, 17 Jun 2006) | 2 lines Patch #812986: Update the canvas even if not tracing. ........ r47008 | martin.v.loewis | 2006-06-17 21:03:26 +0200 (Sat, 17 Jun 2006) | 2 lines Patch #815924: Restore ability to pass type= and icon= ........ r47009 | neal.norwitz | 2006-06-18 00:37:45 +0200 (Sun, 18 Jun 2006) | 1 line Fix typo in docstring ........ r47010 | neal.norwitz | 2006-06-18 00:38:15 +0200 (Sun, 18 Jun 2006) | 1 line Fix memory leak reported by valgrind while running test_subprocess ........ r47011 | fred.drake | 2006-06-18 04:57:35 +0200 (Sun, 18 Jun 2006) | 1 line remove unnecessary markup ........ r47013 | neal.norwitz | 2006-06-18 21:35:01 +0200 (Sun, 18 Jun 2006) | 7 lines Prevent spurious leaks when running regrtest.py -R. There may be more issues that crop up from time to time, but this change seems to have been pretty stable (no spurious warnings) for about a week. Other modules which use threads may require similar use of threading_setup/threading_cleanup from test_support. ........ r47014 | neal.norwitz | 2006-06-18 21:37:40 +0200 (Sun, 18 Jun 2006) | 9 lines The hppa ubuntu box sometimes hangs forever in these tests. My guess is that the wait is failing for some reason. Use WNOHANG, so we won't wait until the buildbot kills the test suite. I haven't been able to reproduce the failure, so I'm not sure if this will help or not. Hopefully, this change will cause the test to fail, rather than hang. That will be better since we will get the rest of the test results. It may also help us debug the real problem. ........ r47015 | neal.norwitz | 2006-06-18 22:10:24 +0200 (Sun, 18 Jun 2006) | 1 line Revert 47014 until it is more robust ........ r47016 | thomas.heller | 2006-06-18 23:27:04 +0200 (Sun, 18 Jun 2006) | 6 lines Fix typos. Fix doctest example. Mention in the tutorial that 'errcheck' is explained in the ref manual. Use better wording in some places. Remoce code examples that shouldn't be in the tutorial. Remove some XXX notices. ........ r47017 | georg.brandl | 2006-06-19 00:17:29 +0200 (Mon, 19 Jun 2006) | 3 lines Patch #1507676: improve exception messages in abstract.c, object.c and typeobject.c. ........ r47018 | neal.norwitz | 2006-06-19 07:40:44 +0200 (Mon, 19 Jun 2006) | 1 line Use Py_ssize_t ........ r47019 | georg.brandl | 2006-06-19 08:35:54 +0200 (Mon, 19 Jun 2006) | 3 lines Add news entry about error msg improvement. ........ r47020 | thomas.heller | 2006-06-19 09:07:49 +0200 (Mon, 19 Jun 2006) | 2 lines Try to repair the failing test on the OpenBSD buildbot. Trial and error... ........ r47021 | tim.peters | 2006-06-19 09:45:16 +0200 (Mon, 19 Jun 2006) | 2 lines Whitespace normalization. ........ r47022 | walter.doerwald | 2006-06-19 10:07:50 +0200 (Mon, 19 Jun 2006) | 4 lines Patch #1506645: add Python wrappers for the curses functions is_term_resized, resize_term and resizeterm. This uses three separate configure checks (one for each function). ........ r47023 | walter.doerwald | 2006-06-19 10:14:09 +0200 (Mon, 19 Jun 2006) | 2 lines Make check order match in configure and configure.in. ........ r47024 | tim.peters | 2006-06-19 10:14:28 +0200 (Mon, 19 Jun 2006) | 3 lines Repair KeyError when running test_threaded_import under -R, as reported by Neal on python-dev. ........ r47025 | thomas.heller | 2006-06-19 10:32:46 +0200 (Mon, 19 Jun 2006) | 3 lines Next try to fix the OpenBSD buildbot tests: Use ctypes.util.find_library to locate the C runtime library on platforms where is returns useful results. ........ r47026 | tim.peters | 2006-06-19 11:09:44 +0200 (Mon, 19 Jun 2006) | 13 lines TestHelp.make_parser(): This was making a permanent change to os.environ (setting envar COLUMNS), which at least caused test_float_default() to fail if the tests were run more than once. This repairs the test_optparse -R failures Neal reported on python-dev. It also explains some seemingly bizarre test_optparse failures we saw a couple weeks ago on the buildbots, when test_optparse failed due to test_file failing to clean up after itself, and then test_optparse failed in an entirely different way when regrtest's -w option ran test_optparse a second time. It's now obvious that make_parser() permanently changing os.environ was responsible for the second half of that. ........ r47027 | anthony.baxter | 2006-06-19 14:04:15 +0200 (Mon, 19 Jun 2006) | 2 lines Preparing for 2.5b1. ........ r47029 | fred.drake | 2006-06-19 19:31:16 +0200 (Mon, 19 Jun 2006) | 1 line remove non-working document formats from edist ........ r47030 | gerhard.haering | 2006-06-19 23:17:35 +0200 (Mon, 19 Jun 2006) | 5 lines Fixed a memory leak that was introduced with incorrect usage of the Python weak reference API in pysqlite 2.2.1. Bumbed pysqlite version number to upcoming pysqlite 2.3.1 release. ........ r47032 | ka-ping.yee | 2006-06-20 00:49:36 +0200 (Tue, 20 Jun 2006) | 2 lines Remove Python 2.3 compatibility comment. ........ r47033 | trent.mick | 2006-06-20 01:21:25 +0200 (Tue, 20 Jun 2006) | 2 lines Upgrade pyexpat to expat 2.0.0 (http://python.org/sf/1462338). ........ r47034 | trent.mick | 2006-06-20 01:57:41 +0200 (Tue, 20 Jun 2006) | 3 lines [ 1295808 ] expat symbols should be namespaced in pyexpat (http://python.org/sf/1295808) ........ r47039 | andrew.kuchling | 2006-06-20 13:52:16 +0200 (Tue, 20 Jun 2006) | 1 line Uncomment wsgiref section ........ r47040 | andrew.kuchling | 2006-06-20 14:15:09 +0200 (Tue, 20 Jun 2006) | 1 line Add four library items ........ r47041 | andrew.kuchling | 2006-06-20 14:19:54 +0200 (Tue, 20 Jun 2006) | 1 line Terminology and typography fixes ........ r47042 | andrew.kuchling | 2006-06-20 15:05:12 +0200 (Tue, 20 Jun 2006) | 1 line Add introductory paragraphs summarizing the release; minor edits ........ r47043 | andrew.kuchling | 2006-06-20 15:11:29 +0200 (Tue, 20 Jun 2006) | 1 line Minor edits and rearrangements; markup fix ........ r47044 | andrew.kuchling | 2006-06-20 15:20:30 +0200 (Tue, 20 Jun 2006) | 1 line [Bug #1504456] Mention xml -> xmlcore change ........ r47047 | brett.cannon | 2006-06-20 19:30:26 +0200 (Tue, 20 Jun 2006) | 2 lines Raise TestSkipped when the test socket connection is refused. ........ r47049 | brett.cannon | 2006-06-20 21:20:17 +0200 (Tue, 20 Jun 2006) | 2 lines Fix typo of exception name. ........ r47053 | brett.cannon | 2006-06-21 18:57:57 +0200 (Wed, 21 Jun 2006) | 5 lines At the C level, tuple arguments are passed in directly to the exception constructor, meaning it is treated as *args, not as a single argument. This means using the 'message' attribute won't work (until Py3K comes around), and so one must grab from 'arg' to get the error number. ........ r47054 | andrew.kuchling | 2006-06-21 19:10:18 +0200 (Wed, 21 Jun 2006) | 1 line Link to LibRef module documentation ........ r47055 | andrew.kuchling | 2006-06-21 19:17:10 +0200 (Wed, 21 Jun 2006) | 1 line Note some of Barry's work ........ r47056 | andrew.kuchling | 2006-06-21 19:17:28 +0200 (Wed, 21 Jun 2006) | 1 line Bump version ........ r47057 | georg.brandl | 2006-06-21 19:45:17 +0200 (Wed, 21 Jun 2006) | 3 lines fix [ 1509132 ] compiler module builds incorrect AST for TryExceptFinally ........ r47058 | georg.brandl | 2006-06-21 19:52:36 +0200 (Wed, 21 Jun 2006) | 3 lines Make test_fcntl aware of netbsd3. ........ r47059 | georg.brandl | 2006-06-21 19:53:17 +0200 (Wed, 21 Jun 2006) | 3 lines Patch #1509001: expected skips for netbsd3. ........ r47060 | gerhard.haering | 2006-06-21 22:55:04 +0200 (Wed, 21 Jun 2006) | 2 lines Removed call to enable_callback_tracebacks that slipped in by accident. ........ r47061 | armin.rigo | 2006-06-21 23:58:50 +0200 (Wed, 21 Jun 2006) | 13 lines Fix for an obscure bug introduced by revs 46806 and 46808, with a test. The problem of checking too eagerly for recursive calls is the following: if a RuntimeError is caused by recursion, and if code needs to normalize it immediately (as in the 2nd test), then PyErr_NormalizeException() needs a call to the RuntimeError class to instantiate it, and this hits the recursion limit again... causing PyErr_NormalizeException() to never finish. Moved this particular recursion check to slot_tp_call(), which is not involved in instantiating built-in exceptions. Backport candidate. ........ r47064 | neal.norwitz | 2006-06-22 08:30:50 +0200 (Thu, 22 Jun 2006) | 3 lines Copy the wsgiref package during make install. ........ r47065 | neal.norwitz | 2006-06-22 08:35:30 +0200 (Thu, 22 Jun 2006) | 1 line Reset the doc date to today for the automatic doc builds ........ r47067 | andrew.kuchling | 2006-06-22 15:10:23 +0200 (Thu, 22 Jun 2006) | 1 line Mention how to suppress warnings ........ r47069 | georg.brandl | 2006-06-22 16:46:17 +0200 (Thu, 22 Jun 2006) | 3 lines Set lineno correctly on list, tuple and dict literals. ........ r47070 | georg.brandl | 2006-06-22 16:46:46 +0200 (Thu, 22 Jun 2006) | 4 lines Test for correct compilation of try-except-finally stmt. Test for correct lineno on list, tuple, dict literals. ........ r47071 | fred.drake | 2006-06-22 17:50:08 +0200 (Thu, 22 Jun 2006) | 1 line fix markup nit ........ r47072 | brett.cannon | 2006-06-22 18:49:14 +0200 (Thu, 22 Jun 2006) | 6 lines 'warning's was improperly requiring that a command-line Warning category be both a subclass of Warning and a subclass of types.ClassType. The latter is no longer true thanks to new-style exceptions. Closes bug #1510580. Thanks to AMK for the test. ........ r47073 | ronald.oussoren | 2006-06-22 20:33:54 +0200 (Thu, 22 Jun 2006) | 3 lines MacOSX: Add a message to the first screen of the installer that tells users how to avoid updates to their shell profile. ........ r47074 | georg.brandl | 2006-06-22 21:02:18 +0200 (Thu, 22 Jun 2006) | 3 lines Fix my name ;) ........ r47075 | thomas.heller | 2006-06-22 21:07:36 +0200 (Thu, 22 Jun 2006) | 2 lines Small fixes, mostly in the markup. ........ r47076 | peter.astrand | 2006-06-22 22:06:46 +0200 (Thu, 22 Jun 2006) | 1 line Make it possible to run test_subprocess.py on Python 2.2, which lacks test_support.is_resource_enabled. ........ r47077 | peter.astrand | 2006-06-22 22:21:26 +0200 (Thu, 22 Jun 2006) | 1 line Applied patch #1506758: Prevent MemoryErrors with large MAXFD. ........ r47079 | neal.norwitz | 2006-06-23 05:32:44 +0200 (Fri, 23 Jun 2006) | 1 line Fix refleak ........ r47080 | fred.drake | 2006-06-23 08:03:45 +0200 (Fri, 23 Jun 2006) | 9 lines - SF bug #853506: IP6 address parsing in sgmllib ('[' and ']' were not accepted in unquoted attribute values) - cleaned up tests of character and entity reference decoding so the tests cover the documented relationships among handle_charref, handle_entityref, convert_charref, convert_codepoint, and convert_entityref, without bringing up Unicode issues that sgmllib cannot be involved in ........ r47085 | andrew.kuchling | 2006-06-23 21:23:40 +0200 (Fri, 23 Jun 2006) | 11 lines Fit Makefile for the Python doc environment better; this is a step toward including the howtos in the build process. * Put LaTeX output in ../paper-<whatever>/. * Put HTML output in ../html/ * Explain some of the Makefile variables * Remove some cruft dating to my environment (e.g. the 'web' target) This makefile isn't currently invoked by the documentation build process, so these changes won't destabilize anything. ........ r47086 | hyeshik.chang | 2006-06-23 23:16:18 +0200 (Fri, 23 Jun 2006) | 5 lines Bug #1511381: codec_getstreamcodec() in codec.c is corrected to omit a default "error" argument for NULL pointer. This allows the parser to take a codec from cjkcodecs again. (Reported by Taewook Kang and reviewed by Walter Doerwald) ........ r47091 | ronald.oussoren | 2006-06-25 22:44:16 +0200 (Sun, 25 Jun 2006) | 6 lines Workaround for bug #1512124 Without this patch IDLE will get unresponsive when you open the debugger window on OSX. This is both using the system Tcl/Tk on Tiger as the latest universal download from tk-components.sf.net. ........ r47092 | ronald.oussoren | 2006-06-25 23:14:19 +0200 (Sun, 25 Jun 2006) | 3 lines Drop the calldll demo's for macos, calldll isn't present anymore, no need to keep the demo's around. ........ r47093 | ronald.oussoren | 2006-06-25 23:15:58 +0200 (Sun, 25 Jun 2006) | 3 lines Use a path without a double slash to compile the .py files after installation (macosx, binary installer). This fixes bug #1508369 for python 2.5. ........ r47094 | ronald.oussoren | 2006-06-25 23:19:06 +0200 (Sun, 25 Jun 2006) | 3 lines Also install the .egg-info files in Lib. This will cause wsgiref.egg-info to be installed. ........ r47097 | andrew.kuchling | 2006-06-26 14:40:02 +0200 (Mon, 26 Jun 2006) | 1 line [Bug #1511998] Various comments from Nick Coghlan; thanks! ........ r47098 | andrew.kuchling | 2006-06-26 14:43:43 +0200 (Mon, 26 Jun 2006) | 1 line Describe workaround for PyRange_New()'s removal ........ r47099 | andrew.kuchling | 2006-06-26 15:08:24 +0200 (Mon, 26 Jun 2006) | 5 lines [Bug #1512163] Fix typo. This change will probably break tests on FreeBSD buildbots, but I'll check in a fix for that next. ........ r47100 | andrew.kuchling | 2006-06-26 15:12:16 +0200 (Mon, 26 Jun 2006) | 9 lines [Bug #1512163] Use one set of locking methods, lockf(); remove the flock() calls. On FreeBSD, the two methods lockf() and flock() end up using the same mechanism and the second one fails. A Linux man page claims that the two methods are orthogonal (so locks acquired one way don't interact with locks acquired the other way) but that clearly must be false. ........ r47101 | andrew.kuchling | 2006-06-26 15:23:10 +0200 (Mon, 26 Jun 2006) | 5 lines Add a test for a conflicting lock. On slow machines, maybe the time intervals (2 sec, 0.5 sec) will be too tight. I'll see how the buildbots like it. ........ r47103 | andrew.kuchling | 2006-06-26 16:33:24 +0200 (Mon, 26 Jun 2006) | 1 line Windows doesn't have os.fork(). I'll just disable this test for now ........ r47106 | andrew.kuchling | 2006-06-26 19:00:35 +0200 (Mon, 26 Jun 2006) | 9 lines Attempt to fix build failure on OS X and Debian alpha; the symptom is consistent with os.wait() returning immediately because some other subprocess had previously exited; the test suite then immediately tries to lock the mailbox and gets an error saying it's already locked. To fix this, do a waitpid() so the test suite only continues once the intended child process has exited. ........ r47113 | neal.norwitz | 2006-06-27 06:06:46 +0200 (Tue, 27 Jun 2006) | 1 line Ignore some more warnings in the dynamic linker on an older gentoo ........ r47114 | neal.norwitz | 2006-06-27 06:09:13 +0200 (Tue, 27 Jun 2006) | 6 lines Instead of doing a make test, run the regression tests out of the installed copy. This will hopefully catch problems where directories are added under Lib/ but not to Makefile.pre.in. This breaks out the 2 runs of the test suite with and without -O which is also nicer. ........ r47115 | neal.norwitz | 2006-06-27 06:12:58 +0200 (Tue, 27 Jun 2006) | 5 lines Fix SF bug #1513032, 'make install' failure on FreeBSD 5.3. No need to install lib-old, it's empty in 2.5. ........ r47116 | neal.norwitz | 2006-06-27 06:23:06 +0200 (Tue, 27 Jun 2006) | 1 line Test unimportant change to verify buildbot does not try to build ........ r47117 | neal.norwitz | 2006-06-27 06:26:30 +0200 (Tue, 27 Jun 2006) | 1 line Try again: test unimportant change to verify buildbot does not try to build ........ r47118 | neal.norwitz | 2006-06-27 06:28:56 +0200 (Tue, 27 Jun 2006) | 1 line Verify buildbot picks up these changes (really needs testing after last change to Makefile.pre.in) ........ r47121 | vinay.sajip | 2006-06-27 09:34:37 +0200 (Tue, 27 Jun 2006) | 1 line Removed buggy exception handling in doRollover of rotating file handlers. Exceptions now propagate to caller. ........ r47123 | ronald.oussoren | 2006-06-27 12:08:25 +0200 (Tue, 27 Jun 2006) | 3 lines MacOSX: fix rather dumb buglet that made it impossible to create extensions on OSX 10.3 when using a binary distribution build on 10.4. ........ r47125 | tim.peters | 2006-06-27 13:52:49 +0200 (Tue, 27 Jun 2006) | 2 lines Whitespace normalization. ........ r47128 | ronald.oussoren | 2006-06-27 14:53:52 +0200 (Tue, 27 Jun 2006) | 8 lines Use staticly build copies of zlib and bzip2 to build the OSX installer, that way the resulting binaries have a better change of running on 10.3. This patch also updates the search logic for sleepycat db3/4, without this patch you cannot use a sleepycat build with a non-standard prefix; with this you can (at least on OSX) if you add the prefix to CPPFLAGS/LDFLAGS at configure-time. This change is needed to build the binary installer for OSX. ........ r47131 | ronald.oussoren | 2006-06-27 17:45:32 +0200 (Tue, 27 Jun 2006) | 5 lines macosx: Install a libpython2.5.a inside the framework as a symlink to the actual dylib at the root of the framework, that way tools that expect a unix-like install (python-config, but more importantly external products like mod_python) work correctly. ........ r47137 | neal.norwitz | 2006-06-28 07:03:22 +0200 (Wed, 28 Jun 2006) | 4 lines According to the man pages on Gentoo Linux and Tru64, EACCES or EAGAIN can be returned if fcntl (lockf) fails. This fixes the test failure on Tru64 by checking for either error rather than just EAGAIN. ........ r47139 | neal.norwitz | 2006-06-28 08:28:31 +0200 (Wed, 28 Jun 2006) | 5 lines Fix bug #1512695: cPickle.loads could crash if it was interrupted with a KeyboardInterrupt since PyTuple_Pack was passed a NULL. Will backport. ........ r47142 | nick.coghlan | 2006-06-28 12:41:47 +0200 (Wed, 28 Jun 2006) | 1 line Make full module name available as __module_name__ even when __name__ is set to something else (like '__main__') ........ r47143 | armin.rigo | 2006-06-28 12:49:51 +0200 (Wed, 28 Jun 2006) | 2 lines A couple of crashers of the "won't fix" kind. ........ r47147 | andrew.kuchling | 2006-06-28 16:25:20 +0200 (Wed, 28 Jun 2006) | 1 line [Bug #1508766] Add docs for uuid module; docs written by George Yoshida, with minor rearrangements by me. ........ r47148 | andrew.kuchling | 2006-06-28 16:27:21 +0200 (Wed, 28 Jun 2006) | 1 line [Bug #1508766] Add docs for uuid module; this puts the module in the 'Internet Protocols' section. Arguably this module could also have gone in the chapters on strings or encodings, maybe even the crypto chapter. Fred, please move if you see fit. ........ r47151 | georg.brandl | 2006-06-28 22:23:25 +0200 (Wed, 28 Jun 2006) | 3 lines Fix end_fill(). ........ r47153 | trent.mick | 2006-06-28 22:30:41 +0200 (Wed, 28 Jun 2006) | 2 lines Mention the expat upgrade and pyexpat fix I put in 2.5b1. ........ r47154 | fred.drake | 2006-06-29 02:51:53 +0200 (Thu, 29 Jun 2006) | 6 lines SF bug #1504333: sgmlib should allow angle brackets in quoted values (modified patch by Sam Ruby; changed to use separate REs for start and end tags to reduce matching cost for end tags; extended tests; updated to avoid breaking previous changes to support IPv6 addresses in unquoted attribute values) ........ r47156 | fred.drake | 2006-06-29 04:57:48 +0200 (Thu, 29 Jun 2006) | 1 line document recent bugfixes in sgmllib ........ r47158 | neal.norwitz | 2006-06-29 06:10:08 +0200 (Thu, 29 Jun 2006) | 10 lines Add new utility function, reap_children(), to test_support. This should be called at the end of each test that spawns children (perhaps it should be called from regrtest instead?). This will hopefully prevent some of the unexplained failures in the buildbots (hppa and alpha) during tests that spawn children. The problems were not reproducible. There were many zombies that remained at the end of several tests. In the worst case, this shouldn't cause any more problems, though it may not help either. Time will tell. ........ r47159 | neal.norwitz | 2006-06-29 07:48:14 +0200 (Thu, 29 Jun 2006) | 5 lines This should fix the buildbot failure on s/390 which can't connect to gmail.org. It makes the error message consistent and always sends to stderr. It would be much better for all the networking tests to hit only python.org. ........ r47161 | thomas.heller | 2006-06-29 20:34:15 +0200 (Thu, 29 Jun 2006) | 3 lines Protect the thread api calls in the _ctypes extension module within #ifdef WITH_THREADS/#endif blocks. Found by Sam Rushing. ........ r47162 | martin.v.loewis | 2006-06-29 20:58:44 +0200 (Thu, 29 Jun 2006) | 2 lines Patch #1509163: MS Toolkit Compiler no longer available ........ r47163 | skip.montanaro | 2006-06-29 21:20:09 +0200 (Thu, 29 Jun 2006) | 1 line add string methods to index ........ r47164 | vinay.sajip | 2006-06-30 02:13:08 +0200 (Fri, 30 Jun 2006) | 1 line Fixed bug in fileConfig() which failed to clear logging._handlerList ........ r47166 | tim.peters | 2006-06-30 08:18:39 +0200 (Fri, 30 Jun 2006) | 2 lines Whitespace normalization. ........ r47170 | neal.norwitz | 2006-06-30 09:32:16 +0200 (Fri, 30 Jun 2006) | 1 line Silence compiler warning ........ r47171 | neal.norwitz | 2006-06-30 09:32:46 +0200 (Fri, 30 Jun 2006) | 1 line Another problem reported by Coverity. Backport candidate. ........ r47175 | thomas.heller | 2006-06-30 19:44:54 +0200 (Fri, 30 Jun 2006) | 2 lines Revert the use of PY_FORMAT_SIZE_T in PyErr_Format. ........ r47176 | tim.peters | 2006-06-30 20:34:51 +0200 (Fri, 30 Jun 2006) | 2 lines Remove now-unused fidding with PY_FORMAT_SIZE_T. ........ r47177 | georg.brandl | 2006-06-30 20:47:56 +0200 (Fri, 30 Jun 2006) | 3 lines Document decorator usage of property. ........ r47181 | fred.drake | 2006-06-30 21:29:25 +0200 (Fri, 30 Jun 2006) | 4 lines - consistency nit: always include "()" in \function and \method (*should* be done by the presentation, but that requires changes all over) - avoid spreading the __name meme ........ r47188 | vinay.sajip | 2006-07-01 12:45:20 +0200 (Sat, 01 Jul 2006) | 1 line Added entry for fileConfig() bugfix. ........ r47189 | vinay.sajip | 2006-07-01 12:47:20 +0200 (Sat, 01 Jul 2006) | 1 line Added duplicate call to fileConfig() to ensure that it cleans up after itself correctly. ........ r47190 | martin.v.loewis | 2006-07-01 17:33:37 +0200 (Sat, 01 Jul 2006) | 2 lines Release all forwarded functions in .close. Fixes #1513223. ........ r47191 | fred.drake | 2006-07-01 18:28:20 +0200 (Sat, 01 Jul 2006) | 7 lines SF bug #1296433 (Expat bug #1515266): Unchecked calls to character data handler would cause a segfault. This merges in Expat's lib/xmlparse.c revisions 1.154 and 1.155, which fix this and a closely related problem (the later does not affect Python). Moved the crasher test to the tests for xml.parsers.expat. ........ r47197 | gerhard.haering | 2006-07-02 19:48:30 +0200 (Sun, 02 Jul 2006) | 4 lines The sqlite3 module did cut off data from the SQLite database at the first null character before sending it to a custom converter. This has been fixed now. ........ r47198 | martin.v.loewis | 2006-07-02 20:44:00 +0200 (Sun, 02 Jul 2006) | 1 line Correct arithmetic in access on Win32. Fixes #1513646. ........ r47203 | thomas.heller | 2006-07-03 09:58:09 +0200 (Mon, 03 Jul 2006) | 1 line Cleanup: Remove commented out code. ........ r47204 | thomas.heller | 2006-07-03 09:59:50 +0200 (Mon, 03 Jul 2006) | 1 line Don't run the doctests with Python 2.3 because it doesn't have the ELLIPSIS flag. ........ r47205 | thomas.heller | 2006-07-03 10:04:05 +0200 (Mon, 03 Jul 2006) | 7 lines Fixes so that _ctypes can be compiled with the MingW compiler. It seems that the definition of '__attribute__(x)' was responsible for the compiler ignoring the '__fastcall' attribute on the ffi_closure_SYSV function in libffi_msvc/ffi.c, took me quite some time to figure this out. ........ r47206 | thomas.heller | 2006-07-03 10:08:14 +0200 (Mon, 03 Jul 2006) | 11 lines Add a new function uses_seh() to the _ctypes extension module. This will return True if Windows Structured Exception handling (SEH) is used when calling functions, False otherwise. Currently, only MSVC supports SEH. Fix the test so that it doesn't crash when run with MingW compiled _ctypes. Note that two tests are still failing when mingw is used, I suspect structure layout differences and function calling conventions between MSVC and MingW. ........ r47207 | tim.peters | 2006-07-03 10:23:19 +0200 (Mon, 03 Jul 2006) | 2 lines Whitespace normalization. ........ r47208 | martin.v.loewis | 2006-07-03 11:44:00 +0200 (Mon, 03 Jul 2006) | 3 lines Only setup canvas when it is first created. Fixes #1514703 ........ r47209 | martin.v.loewis | 2006-07-03 12:05:30 +0200 (Mon, 03 Jul 2006) | 3 lines Reimplement turtle.circle using a polyline, to allow correct filling of arcs. Also fixes #1514693. ........ r47210 | martin.v.loewis | 2006-07-03 12:19:49 +0200 (Mon, 03 Jul 2006) | 3 lines Bug #1514693: Update turtle's heading when switching between degrees and radians. ........ r47211 | martin.v.loewis | 2006-07-03 13:12:06 +0200 (Mon, 03 Jul 2006) | 2 lines Document functions added in 2.3 and 2.5. ........ r47212 | martin.v.loewis | 2006-07-03 14:19:50 +0200 (Mon, 03 Jul 2006) | 3 lines Bug #1417699: Reject locale-specific decimal point in float() and atof(). ........ r47213 | martin.v.loewis | 2006-07-03 14:28:58 +0200 (Mon, 03 Jul 2006) | 3 lines Bug #1267547: Put proper recursive setup.py call into the spec file generated by bdist_rpm. ........ r47215 | martin.v.loewis | 2006-07-03 15:01:35 +0200 (Mon, 03 Jul 2006) | 3 lines Patch #825417: Fix timeout processing in expect, read_until. Will backport to 2.4. ........ r47218 | martin.v.loewis | 2006-07-03 15:47:40 +0200 (Mon, 03 Jul 2006) | 2 lines Put method-wrappers into trashcan. Fixes #927248. ........ r47219 | andrew.kuchling | 2006-07-03 16:07:30 +0200 (Mon, 03 Jul 2006) | 1 line [Bug #1515932] Clarify description of slice assignment ........ r47220 | andrew.kuchling | 2006-07-03 16:16:09 +0200 (Mon, 03 Jul 2006) | 4 lines [Bug #1511911] Clarify description of optional arguments to sorted() by improving the xref to the section on lists, and by copying the explanations of the arguments (with a slight modification). ........ r47223 | kristjan.jonsson | 2006-07-03 16:59:05 +0200 (Mon, 03 Jul 2006) | 1 line Fix build problems with the platform SDK on windows. It is not sufficient to test for the C compiler version when determining if we have the secure CRT from microsoft. Must test with an undocumented macro, __STDC_SECURE_LIB__ too. ........ r47224 | ronald.oussoren | 2006-07-04 14:30:22 +0200 (Tue, 04 Jul 2006) | 7 lines Sync the darwin/x86 port libffi with the copy in PyObjC. This fixes a number of bugs in that port. The most annoying ones were due to some subtle differences between the document ABI and the actual implementation :-( (there are no python unittests that fail without this patch, but without it some of libffi's unittests fail). ........ r47234 | georg.brandl | 2006-07-05 10:21:00 +0200 (Wed, 05 Jul 2006) | 3 lines Remove remaining references to OverflowWarning. ........ r47236 | thomas.heller | 2006-07-05 11:13:56 +0200 (Wed, 05 Jul 2006) | 3 lines Fix the bitfield test when _ctypes is compiled with MingW. Structures containing bitfields may have different layout on MSVC and MingW . ........ r47237 | thomas.wouters | 2006-07-05 13:03:49 +0200 (Wed, 05 Jul 2006) | 15 lines Fix bug in passing tuples to string.Template. All other values (with working str() or repr()) would work, just not multi-value tuples. Probably not a backport candidate, since it changes the behaviour of passing a single-element tuple: >>> string.Template("$foo").substitute(dict(foo=(1,))) '(1,)' versus '1' ........ r47241 | georg.brandl | 2006-07-05 16:18:45 +0200 (Wed, 05 Jul 2006) | 2 lines Patch #1517490: fix glitches in filter() docs. ........ r47244 | georg.brandl | 2006-07-05 17:50:05 +0200 (Wed, 05 Jul 2006) | 2 lines no need to elaborate "string". ........ r47251 | neal.norwitz | 2006-07-06 06:28:59 +0200 (Thu, 06 Jul 2006) | 3 lines Fix refleaks reported by Shane Hathaway in SF patch #1515361. This change contains only the changes related to leaking the copy variable. ........ r47253 | fred.drake | 2006-07-06 07:13:22 +0200 (Thu, 06 Jul 2006) | 4 lines - back out Expat change; the final fix to Expat will be different - change the pyexpat wrapper to not be so sensitive to this detail of the Expat implementation (the ex-crasher test still passes) ........ r47257 | neal.norwitz | 2006-07-06 08:45:08 +0200 (Thu, 06 Jul 2006) | 1 line Add a NEWS entry for a recent pyexpat fix ........ r47258 | martin.v.loewis | 2006-07-06 08:55:58 +0200 (Thu, 06 Jul 2006) | 2 lines Add sqlite3.dll to the DLLs component, not to the TkDLLs component. Fixes #1517388. ........ r47259 | martin.v.loewis | 2006-07-06 09:05:21 +0200 (Thu, 06 Jul 2006) | 1 line Properly quote compileall and Lib paths in case TARGETDIR has a space. ........ r47260 | thomas.heller | 2006-07-06 09:50:18 +0200 (Thu, 06 Jul 2006) | 5 lines Revert the change done in svn revision 47206: Add a new function uses_seh() to the _ctypes extension module. This will return True if Windows Structured Exception handling (SEH) is used when calling functions, False otherwise. ........ r47261 | armin.rigo | 2006-07-06 09:58:18 +0200 (Thu, 06 Jul 2006) | 3 lines A couple of examples about how to attack the fact that _PyType_Lookup() returns a borrowed ref. Many of the calls are open to attack. ........ r47262 | thomas.heller | 2006-07-06 10:28:14 +0200 (Thu, 06 Jul 2006) | 2 lines The test that calls a function with invalid arguments and catches the resulting Windows access violation will not be run by default. ........ r47263 | thomas.heller | 2006-07-06 10:48:35 +0200 (Thu, 06 Jul 2006) | 5 lines Patch #1517790: It is now possible to use custom objects in the ctypes foreign function argtypes sequence as long as they provide a from_param method, no longer is it required that the object is a ctypes type. ........ r47264 | thomas.heller | 2006-07-06 10:58:40 +0200 (Thu, 06 Jul 2006) | 2 lines Document the Struture and Union constructors. ........ r47265 | thomas.heller | 2006-07-06 11:11:22 +0200 (Thu, 06 Jul 2006) | 2 lines Document the changes in svn revision 47263, from patch #1517790. ........ r47267 | ronald.oussoren | 2006-07-06 12:13:35 +0200 (Thu, 06 Jul 2006) | 7 lines This patch solves the problem Skip was seeing with zlib, this patch ensures that configure uses similar compiler flags as setup.py when doing the zlib test. Without this patch configure would use the first shared library on the linker path, with this patch it uses the first shared or static library on that path just like setup.py. ........ r47268 | thomas.wouters | 2006-07-06 12:48:28 +0200 (Thu, 06 Jul 2006) | 4 lines NEWS entry for r47267: fixing configure's zlib probing. ........ r47269 | fredrik.lundh | 2006-07-06 14:29:24 +0200 (Thu, 06 Jul 2006) | 3 lines added XMLParser alias for cElementTree compatibility ........ r47271 | nick.coghlan | 2006-07-06 14:53:04 +0200 (Thu, 06 Jul 2006) | 1 line Revert the __module_name__ changes made in rev 47142. We'll revisit this in Python 2.6 ........ r47272 | nick.coghlan | 2006-07-06 15:04:56 +0200 (Thu, 06 Jul 2006) | 1 line Update the tutorial section on relative imports ........ r47273 | nick.coghlan | 2006-07-06 15:35:27 +0200 (Thu, 06 Jul 2006) | 1 line Ignore ImportWarning by default ........ r47274 | nick.coghlan | 2006-07-06 15:41:34 +0200 (Thu, 06 Jul 2006) | 1 line Cover ImportWarning, PendingDeprecationWarning and simplefilter() in the warnings module docs ........ r47275 | nick.coghlan | 2006-07-06 15:47:18 +0200 (Thu, 06 Jul 2006) | 1 line Add NEWS entries for the ImportWarning change and documentation update ........ r47276 | andrew.kuchling | 2006-07-06 15:57:28 +0200 (Thu, 06 Jul 2006) | 1 line ImportWarning is now silent by default ........ r47277 | thomas.heller | 2006-07-06 17:06:05 +0200 (Thu, 06 Jul 2006) | 2 lines Document the correct return type of PyLong_AsUnsignedLongLongMask. ........ r47278 | hyeshik.chang | 2006-07-06 17:21:52 +0200 (Thu, 06 Jul 2006) | 2 lines Add a testcase for r47086 which fixed a bug in codec_getstreamcodec(). ........ r47279 | hyeshik.chang | 2006-07-06 17:39:24 +0200 (Thu, 06 Jul 2006) | 3 lines Test using all CJK encodings for the testcases which don't require specific encodings. ........ r47280 | martin.v.loewis | 2006-07-06 21:28:03 +0200 (Thu, 06 Jul 2006) | 2 lines Properly generate logical file ids. Fixes #1515998. Also correct typo in Control.mapping. ........ r47287 | neal.norwitz | 2006-07-07 08:03:15 +0200 (Fri, 07 Jul 2006) | 17 lines Restore rev 47014: The hppa ubuntu box sometimes hangs forever in these tests. My guess is that the wait is failing for some reason. Use WNOHANG, so we won't wait until the buildbot kills the test suite. I haven't been able to reproduce the failure, so I'm not sure if this will help or not. Hopefully, this change will cause the test to fail, rather than hang. That will be better since we will get the rest of the test results. It may also help us debug the real problem. *** The reason this originally failed was because there were many zombie children outstanding before rev 47158 cleaned them up. There are still hangs in test_subprocess that need to be addressed, but that will take more work. This should close some holes. ........ r47289 | georg.brandl | 2006-07-07 10:15:12 +0200 (Fri, 07 Jul 2006) | 3 lines Fix RFC number. ........ r50489 | neal.norwitz | 2006-07-08 07:31:37 +0200 (Sat, 08 Jul 2006) | 1 line Fix SF bug #1519018: 'as' is now validated properly in import statements ........ r50490 | georg.brandl | 2006-07-08 14:15:27 +0200 (Sat, 08 Jul 2006) | 3 lines Add an additional test for bug #1519018. ........ r50491 | tim.peters | 2006-07-08 21:55:05 +0200 (Sat, 08 Jul 2006) | 2 lines Whitespace normalization. ........ r50493 | neil.schemenauer | 2006-07-09 18:16:34 +0200 (Sun, 09 Jul 2006) | 2 lines Fix AST compiler bug #1501934: incorrect LOAD/STORE_GLOBAL generation. ........ r50495 | neil.schemenauer | 2006-07-09 23:19:29 +0200 (Sun, 09 Jul 2006) | 2 lines Fix SF bug 1441486: bad unary minus folding in compiler. ........ r50497 | neal.norwitz | 2006-07-10 00:14:42 +0200 (Mon, 10 Jul 2006) | 4 lines On 64 bit systems, int literals that use less than 64 bits are now ints rather than longs. This also fixes the test for eval(-sys.maxint - 1). ........ r50500 | neal.norwitz | 2006-07-10 02:04:44 +0200 (Mon, 10 Jul 2006) | 4 lines Bug #1512814, Fix incorrect lineno's when code at module scope started after line 256. ........ r50501 | neal.norwitz | 2006-07-10 02:05:34 +0200 (Mon, 10 Jul 2006) | 1 line Fix doco. Backport candidate. ........ r50503 | neal.norwitz | 2006-07-10 02:23:17 +0200 (Mon, 10 Jul 2006) | 5 lines Part of SF patch #1484695. This removes dead code. The chksum was already verified in .frombuf() on the lines above. If there was a problem an exception is raised, so there was no way this condition could have been true. ........ r50504 | neal.norwitz | 2006-07-10 03:18:57 +0200 (Mon, 10 Jul 2006) | 3 lines Patch #1516912: improve Modules support for OpenVMS. ........ r50506 | neal.norwitz | 2006-07-10 04:36:41 +0200 (Mon, 10 Jul 2006) | 7 lines Patch #1504046: Add documentation for xml.etree. /F wrote the text docs, Englebert Gruber massaged it to latex and I did some more massaging to try and improve the consistency and fix some name mismatches between the declaration and text. ........ r50509 | martin.v.loewis | 2006-07-10 09:23:48 +0200 (Mon, 10 Jul 2006) | 2 lines Introduce DISTUTILS_USE_SDK as a flag to determine whether the SDK environment should be used. Fixes #1508010. ........ r50510 | martin.v.loewis | 2006-07-10 09:26:41 +0200 (Mon, 10 Jul 2006) | 1 line Change error message to indicate that VS2003 is necessary to build extension modules, not the .NET SDK. ........ r50511 | martin.v.loewis | 2006-07-10 09:29:41 +0200 (Mon, 10 Jul 2006) | 1 line Add svn:ignore. ........ r50512 | anthony.baxter | 2006-07-10 09:41:04 +0200 (Mon, 10 Jul 2006) | 1 line preparing for 2.5b2 ........ r50513 | thomas.heller | 2006-07-10 11:10:28 +0200 (Mon, 10 Jul 2006) | 2 lines Fix bug #1518190: accept any integer or long value in the ctypes.c_void_p constructor. ........ r50514 | thomas.heller | 2006-07-10 11:31:06 +0200 (Mon, 10 Jul 2006) | 3 lines Fixed a segfault when ctypes.wintypes were imported on non-Windows machines. ........ r50516 | thomas.heller | 2006-07-10 13:11:10 +0200 (Mon, 10 Jul 2006) | 3 lines Assigning None to pointer type structure fields possible overwrote wrong fields. ........ r50517 | thomas.heller | 2006-07-10 13:17:37 +0200 (Mon, 10 Jul 2006) | 5 lines Moved the ctypes news entries from the 'Library' section into the 'Extension Modules' section where they belong, probably. This destroyes the original order of the news entries, don't know if that is important or not. ........ r50526 | phillip.eby | 2006-07-10 21:03:29 +0200 (Mon, 10 Jul 2006) | 2 lines Fix SF#1516184 and add a test to prevent regression. ........ r50528 | phillip.eby | 2006-07-10 21:18:35 +0200 (Mon, 10 Jul 2006) | 2 lines Fix SF#1457312: bad socket error handling in distutils "upload" command. ........ r50537 | peter.astrand | 2006-07-10 22:39:49 +0200 (Mon, 10 Jul 2006) | 1 line Make it possible to run test_subprocess.py with Python 2.2, which lacks test_support.reap_children(). ........ r50541 | tim.peters | 2006-07-10 23:08:24 +0200 (Mon, 10 Jul 2006) | 5 lines After approval from Anthony, merge the tim-current_frames branch into the trunk. This adds a new sys._current_frames() function, which returns a dict mapping thread id to topmost thread stack frame. ........ r50542 | tim.peters | 2006-07-10 23:11:49 +0200 (Mon, 10 Jul 2006) | 2 lines Whitespace normalization. ........ r50553 | martin.v.loewis | 2006-07-11 00:11:28 +0200 (Tue, 11 Jul 2006) | 4 lines Patch #1519566: Remove unused _tofill member. Make begin_fill idempotent. Update demo2 to demonstrate filling of concave shapes. ........ r50567 | anthony.baxter | 2006-07-11 04:04:09 +0200 (Tue, 11 Jul 2006) | 4 lines #1494314: Fix a regression with high-numbered sockets in 2.4.3. This means that select() on sockets > FD_SETSIZE (typically 1024) work again. The patch makes sockets use poll() internally where available. ........ r50568 | tim.peters | 2006-07-11 04:17:48 +0200 (Tue, 11 Jul 2006) | 2 lines Whitespace normalization. ........ r50575 | thomas.heller | 2006-07-11 18:42:05 +0200 (Tue, 11 Jul 2006) | 1 line Add missing Py_DECREF. ........ r50576 | thomas.heller | 2006-07-11 18:44:25 +0200 (Tue, 11 Jul 2006) | 1 line Add missing Py_DECREFs. ........ r50579 | andrew.kuchling | 2006-07-11 19:20:16 +0200 (Tue, 11 Jul 2006) | 1 line Bump version number; add sys._current_frames ........ r50582 | thomas.heller | 2006-07-11 20:28:35 +0200 (Tue, 11 Jul 2006) | 3 lines When a foreign function is retrived by calling __getitem__ on a ctypes library instance, do not set it as attribute. ........ r50583 | thomas.heller | 2006-07-11 20:40:50 +0200 (Tue, 11 Jul 2006) | 2 lines Change the ctypes version number to 1.0.0. ........ r50597 | neal.norwitz | 2006-07-12 07:26:17 +0200 (Wed, 12 Jul 2006) | 3 lines Bug #1520864: unpacking singleton tuples in for loop (for x, in) work again. ........ r50598 | neal.norwitz | 2006-07-12 07:26:35 +0200 (Wed, 12 Jul 2006) | 1 line Fix function name in error msg ........ r50599 | neal.norwitz | 2006-07-12 07:27:46 +0200 (Wed, 12 Jul 2006) | 4 lines Fix uninitialized memory read reported by Valgrind when running doctest. This could happen if size == 0. ........ r50600 | neal.norwitz | 2006-07-12 09:28:29 +0200 (Wed, 12 Jul 2006) | 1 line Actually change the MAGIC #. Create a new section for 2.5c1 and mention the impact of changing the MAGIC #. ........ r50601 | thomas.heller | 2006-07-12 10:43:47 +0200 (Wed, 12 Jul 2006) | 3 lines Fix #1467450: ctypes now uses RTLD_GLOBAL by default on OSX 10.3 to load shared libraries. ........ r50604 | thomas.heller | 2006-07-12 16:25:18 +0200 (Wed, 12 Jul 2006) | 3 lines Fix the wrong description of LibraryLoader.LoadLibrary, and document the DEFAULT_MODE constant. ........ r50607 | georg.brandl | 2006-07-12 17:31:17 +0200 (Wed, 12 Jul 2006) | 3 lines Accept long options "--help" and "--version". ........ r50617 | thomas.heller | 2006-07-13 11:53:47 +0200 (Thu, 13 Jul 2006) | 3 lines A misspelled preprocessor symbol caused ctypes to be always compiled without thread support. Replaced WITH_THREADS with WITH_THREAD. ........ r50619 | thomas.heller | 2006-07-13 19:01:14 +0200 (Thu, 13 Jul 2006) | 3 lines Fix #1521375. When running with root priviledges, 'gcc -o /dev/null' did overwrite /dev/null. Use a temporary file instead of /dev/null. ........ r50620 | thomas.heller | 2006-07-13 19:05:13 +0200 (Thu, 13 Jul 2006) | 2 lines Fix misleading words. ........ r50622 | andrew.kuchling | 2006-07-13 19:37:26 +0200 (Thu, 13 Jul 2006) | 1 line Typo fix ........ r50629 | georg.brandl | 2006-07-14 09:12:54 +0200 (Fri, 14 Jul 2006) | 3 lines Patch #1521874: grammar errors in doanddont.tex. ........ r50630 | neal.norwitz | 2006-07-14 09:20:04 +0200 (Fri, 14 Jul 2006) | 1 line Try to improve grammar further. ........ r50631 | martin.v.loewis | 2006-07-14 11:58:55 +0200 (Fri, 14 Jul 2006) | 1 line Extend build_ssl to Win64, using VSExtComp. ........ r50632 | martin.v.loewis | 2006-07-14 14:10:09 +0200 (Fri, 14 Jul 2006) | 1 line Add debug output to analyse buildbot failure. ........ r50633 | martin.v.loewis | 2006-07-14 14:31:05 +0200 (Fri, 14 Jul 2006) | 1 line Fix Debug build of _ssl. ........ r50636 | andrew.kuchling | 2006-07-14 15:32:38 +0200 (Fri, 14 Jul 2006) | 1 line Mention new options ........ r50638 | peter.astrand | 2006-07-14 16:04:45 +0200 (Fri, 14 Jul 2006) | 1 line Bug #1223937: CalledProcessError.errno -> CalledProcessError.returncode. ........ r50640 | thomas.heller | 2006-07-14 17:01:05 +0200 (Fri, 14 Jul 2006) | 4 lines Make the prototypes of our private PyUnicode_FromWideChar and PyUnicode_AsWideChar replacement functions compatible to the official functions by using Py_ssize_t instead of int. ........ r50643 | thomas.heller | 2006-07-14 19:51:14 +0200 (Fri, 14 Jul 2006) | 3 lines Patch #1521817: The index range checking on ctypes arrays containing exactly one element is enabled again. ........ r50647 | thomas.heller | 2006-07-14 20:22:50 +0200 (Fri, 14 Jul 2006) | 2 lines Updates for the ctypes documentation. ........ r50655 | fredrik.lundh | 2006-07-14 23:45:48 +0200 (Fri, 14 Jul 2006) | 3 lines typo ........ r50664 | george.yoshida | 2006-07-15 18:03:49 +0200 (Sat, 15 Jul 2006) | 2 lines Bug #15187702 : ext/win-cookbook.html has a broken link to distutils ........ r50667 | bob.ippolito | 2006-07-15 18:53:15 +0200 (Sat, 15 Jul 2006) | 1 line Patch #1220874: Update the binhex module for Mach-O. ........ r50671 | fred.drake | 2006-07-16 03:21:20 +0200 (Sun, 16 Jul 2006) | 1 line clean up some link markup ........ r50673 | neal.norwitz | 2006-07-16 03:50:38 +0200 (Sun, 16 Jul 2006) | 4 lines Bug #1512814, Fix incorrect lineno's when code within a function had more than 255 blank lines. Byte codes need to go first, line #s second. ........ r50674 | neal.norwitz | 2006-07-16 04:00:32 +0200 (Sun, 16 Jul 2006) | 5 lines a & b were dereffed above, so they are known to be valid pointers. z is known to be NULL, nothing to DECREF. Reported by Klockwork, #107. ........ r50675 | neal.norwitz | 2006-07-16 04:02:57 +0200 (Sun, 16 Jul 2006) | 5 lines self is dereffed (and passed as first arg), so it's known to be good. func is returned from PyArg_ParseTuple and also dereffed. Reported by Klocwork, #30 (self one at least). ........ r50676 | neal.norwitz | 2006-07-16 04:05:35 +0200 (Sun, 16 Jul 2006) | 4 lines proto was dereffed above and is known to be good. No need for X. Reported by Klocwork, #39. ........ r50677 | neal.norwitz | 2006-07-16 04:15:27 +0200 (Sun, 16 Jul 2006) | 5 lines Fix memory leaks in some conditions. Reported by Klocwork #152. ........ r50678 | neal.norwitz | 2006-07-16 04:17:36 +0200 (Sun, 16 Jul 2006) | 4 lines Fix memory leak under some conditions. Reported by Klocwork, #98. ........ r50679 | neal.norwitz | 2006-07-16 04:22:30 +0200 (Sun, 16 Jul 2006) | 8 lines Use sizeof(buffer) instead of duplicating the constants to ensure they won't be wrong. The real change is to pass (bufsz - 1) to PyOS_ascii_formatd and 1 to strncat. strncat copies n+1 bytes from src (not dest). Reported by Klocwork #58. ........ r50680 | neal.norwitz | 2006-07-16 04:32:03 +0200 (Sun, 16 Jul 2006) | 5 lines Handle a NULL name properly. Reported by Klocwork #67 ........ r50681 | neal.norwitz | 2006-07-16 04:35:47 +0200 (Sun, 16 Jul 2006) | 6 lines PyFunction_SetDefaults() is documented as taking None or a tuple. A NULL would crash the PyTuple_Check(). Now make NULL return a SystemError. Reported by Klocwork #73. ........ r50683 | neal.norwitz | 2006-07-17 02:55:45 +0200 (Mon, 17 Jul 2006) | 5 lines Stop INCREFing name, then checking if it's NULL. name (f_name) should never be NULL so assert it. Fix one place where we could have passed NULL. Reported by Klocwork #66. ........ r50684 | neal.norwitz | 2006-07-17 02:57:15 +0200 (Mon, 17 Jul 2006) | 5 lines otherset is known to be non-NULL based on checks before and DECREF after. DECREF otherset rather than XDECREF in error conditions too. Reported by Klockwork #154. ........ r50685 | neal.norwitz | 2006-07-17 02:59:04 +0200 (Mon, 17 Jul 2006) | 7 lines Reported by Klocwork #151. v2 can be NULL if exception2 is NULL. I don't think that condition can happen, but I'm not sure it can't either. Now the code will protect against either being NULL. ........ r50686 | neal.norwitz | 2006-07-17 03:00:16 +0200 (Mon, 17 Jul 2006) | 1 line Add NEWS entry for a bunch of fixes due to warnings produced by Klocworks static analysis tool. ........ r50687 | fred.drake | 2006-07-17 07:47:52 +0200 (Mon, 17 Jul 2006) | 3 lines document xmlcore (still minimal; needs mention in each of the xml.* modules) SF bug #1504456 (partial) ........ r50688 | georg.brandl | 2006-07-17 15:23:46 +0200 (Mon, 17 Jul 2006) | 3 lines Remove usage of sets module (patch #1500609). ........ r50689 | georg.brandl | 2006-07-17 15:26:33 +0200 (Mon, 17 Jul 2006) | 3 lines Add missing NEWS item (#1522771) ........ r50690 | andrew.kuchling | 2006-07-17 18:47:54 +0200 (Mon, 17 Jul 2006) | 1 line Attribute more features ........ r50692 | kurt.kaiser | 2006-07-17 23:59:27 +0200 (Mon, 17 Jul 2006) | 8 lines Patch 1479219 - Tal Einat 1. 'as' highlighted as builtin in comment string on import line 2. Comments such as "#False identity" which start with a keyword immediately after the '#' character aren't colored as comments. 3. u or U beginning unicode string not correctly highlighted Closes bug 1325071 ........ r50693 | barry.warsaw | 2006-07-18 01:07:51 +0200 (Tue, 18 Jul 2006) | 16 lines decode_rfc2231(): Be more robust against buggy RFC 2231 encodings. Specifically, instead of raising a ValueError when there is a single tick in the parameter, simply return that the entire string unquoted, with None for both the charset and the language. Also, if there are more than 2 ticks in the parameter, interpret the first three parts as the standard RFC 2231 parts, then the rest of the parts as the encoded string. Test cases added. Original fewer-than-3-parts fix by Tokio Kikuchi. Resolves SF bug # 1218081. I will back port the fix and tests to Python 2.4 (email 3.0) and Python 2.3 (email 2.5). Also, bump the version number to email 4.0.1, removing the 'alpha' moniker. ........ r50695 | kurt.kaiser | 2006-07-18 06:03:16 +0200 (Tue, 18 Jul 2006) | 2 lines Rebinding Tab key was inserting 'tab' instead of 'Tab'. Bug 1179168. ........ r50696 | brett.cannon | 2006-07-18 06:41:36 +0200 (Tue, 18 Jul 2006) | 6 lines Fix bug #1520914. Starting in 2.4, time.strftime() began to check the bounds of values in the time tuple passed in. Unfortunately people came to rely on undocumented behaviour of setting unneeded values to 0, regardless of if it was within the valid range. Now those values force the value internally to the minimum value when 0 is passed in. ........ r50697 | facundo.batista | 2006-07-18 14:16:13 +0200 (Tue, 18 Jul 2006) | 1 line Comments and docs cleanups, and some little fixes, provided by Santiágo Peresón ........ r50704 | martin.v.loewis | 2006-07-18 19:46:31 +0200 (Tue, 18 Jul 2006) | 2 lines Patch #1524429: Use repr instead of backticks again. ........ r50706 | tim.peters | 2006-07-18 23:55:15 +0200 (Tue, 18 Jul 2006) | 2 lines Whitespace normalization. ........ r50708 | tim.peters | 2006-07-19 02:03:19 +0200 (Wed, 19 Jul 2006) | 18 lines SF bug 1524317: configure --without-threads fails to build Moved the code for _PyThread_CurrentFrames() up, so it's no longer in a huge "#ifdef WITH_THREAD" block (I didn't realize it /was/ in one). Changed test_sys's test_current_frames() so it passes with or without thread supported compiled in. Note that test_sys fails when Python is compiled without threads, but for an unrelated reason (the old test_exit() fails with an indirect ImportError on the `thread` module). There are also other unrelated compilation failures without threads, in extension modules (like ctypes); at least the core compiles again. Do we really support --without-threads? If so, there are several problems remaining. ........ r50713 | thomas.heller | 2006-07-19 11:09:32 +0200 (Wed, 19 Jul 2006) | 4 lines Make sure the _ctypes extension can be compiled when WITH_THREAD is not defined on Windows, even if that configuration is probably not supported at all. ........ r50715 | martin.v.loewis | 2006-07-19 19:18:32 +0200 (Wed, 19 Jul 2006) | 4 lines Revert r50706 (Whitespace normalization) and r50697: Comments and docs cleanups, and some little fixes per recommendation from Raymond Hettinger. ........ r50719 | phillip.eby | 2006-07-20 17:54:16 +0200 (Thu, 20 Jul 2006) | 4 lines Fix SF#1516184 (again) and add a test to prevent regression. (There was a problem with empty filenames still causing recursion) ........ r50720 | georg.brandl | 2006-07-20 18:28:39 +0200 (Thu, 20 Jul 2006) | 3 lines Guard for _active being None in __del__ method. ........ r50721 | vinay.sajip | 2006-07-20 18:28:39 +0200 (Thu, 20 Jul 2006) | 1 line Updated documentation for TimedRotatingFileHandler relating to how rollover files are named. The previous documentation was wrongly the same as for RotatingFileHandler. ........ r50731 | fred.drake | 2006-07-20 22:11:57 +0200 (Thu, 20 Jul 2006) | 1 line markup fix ........ r50739 | kurt.kaiser | 2006-07-21 00:22:52 +0200 (Fri, 21 Jul 2006) | 7 lines Avoid occasional failure to detect closing paren properly. Patch 1407280 Tal Einat M ParenMatch.py M NEWS.txt M CREDITS.txt ........ r50740 | vinay.sajip | 2006-07-21 01:20:12 +0200 (Fri, 21 Jul 2006) | 1 line Addressed SF#1524081 by using a dictionary to map level names to syslog priority names, rather than a string.lower(). ........ r50741 | neal.norwitz | 2006-07-21 07:29:58 +0200 (Fri, 21 Jul 2006) | 1 line Add some asserts that we got good params passed ........ r50742 | neal.norwitz | 2006-07-21 07:31:02 +0200 (Fri, 21 Jul 2006) | 5 lines Move the initialization of some pointers earlier. The problem is that if we call Py_DECREF(frame) like we do if allocating locals fails, frame_dealloc() will try to use these bogus values and crash. ........ r50743 | neal.norwitz | 2006-07-21 07:32:28 +0200 (Fri, 21 Jul 2006) | 4 lines Handle allocation failures gracefully. Found with failmalloc. Many (all?) of these could be backported. ........ r50745 | neal.norwitz | 2006-07-21 09:59:02 +0200 (Fri, 21 Jul 2006) | 1 line Speel initialise write. Tanks Anthony. ........ r50746 | neal.norwitz | 2006-07-21 09:59:47 +0200 (Fri, 21 Jul 2006) | 2 lines Handle more memory allocation failures without crashing. ........ r50754 | barry.warsaw | 2006-07-21 16:51:07 +0200 (Fri, 21 Jul 2006) | 23 lines More RFC 2231 improvements for the email 4.0 package. As Mark Sapiro rightly points out there are really two types of continued headers defined in this RFC (i.e. "encoded" parameters with the form "name*0*=" and unencoded parameters with the form "name*0="), but we were were handling them both the same way and that isn't correct. This patch should be much more RFC compliant in that only encoded params are %-decoded and the charset/language information is only extract if there are any encoded params in the segments. If there are no encoded params then the RFC says that there will be no charset/language parts. Note however that this will change the return value for Message.get_param() in some cases. For example, whereas before if you had all unencoded param continuations you would have still gotten a 3-tuple back from this method (with charset and language == None), you will now get just a string. I don't believe this is a backward incompatible change though because the documentation for this method already indicates that either return value is possible and that you must do an isinstance(val, tuple) check to discriminate between the two. (Yeah that API kind of sucks but we can't change /that/ without breaking code.) Test cases, some documentation updates, and a NEWS item accompany this patch. ........ r50759 | georg.brandl | 2006-07-21 19:36:31 +0200 (Fri, 21 Jul 2006) | 3 lines Fix check for empty list (vs. None). ........ r50771 | brett.cannon | 2006-07-22 00:44:07 +0200 (Sat, 22 Jul 2006) | 2 lines Remove an XXX marker in a comment. ........ r50773 | neal.norwitz | 2006-07-22 18:20:49 +0200 (Sat, 22 Jul 2006) | 1 line Fix more memory allocation issues found with failmalloc. ........ r50774 | neal.norwitz | 2006-07-22 19:00:57 +0200 (Sat, 22 Jul 2006) | 1 line Don't fail if the directory already exists ........ r50775 | greg.ward | 2006-07-23 04:25:53 +0200 (Sun, 23 Jul 2006) | 6 lines Be a lot smarter about whether this test passes: instead of assuming that a 2.93 sec audio file will always take 3.1 sec (as it did on the hardware I had when I first wrote the test), expect that it will take 2.93 sec +/- 10%, and only fail if it's outside of that range. Compute the expected ........ r50776 | kurt.kaiser | 2006-07-23 06:19:49 +0200 (Sun, 23 Jul 2006) | 2 lines Tooltips failed on new-syle class __init__ args. Bug 1027566 Loren Guthrie ........ r50777 | neal.norwitz | 2006-07-23 09:50:36 +0200 (Sun, 23 Jul 2006) | 1 line Handle more mem alloc issues found with failmalloc ........ r50778 | neal.norwitz | 2006-07-23 09:51:58 +0200 (Sun, 23 Jul 2006) | 5 lines If the for loop isn't entered, entryblock will be NULL. If passed to stackdepth_walk it will be dereffed. Not sure if I found with failmalloc or Klockwork #55. ........ r50779 | neal.norwitz | 2006-07-23 09:53:14 +0200 (Sun, 23 Jul 2006) | 4 lines Move the initialization of size_a down below the check for a being NULL. Reported by Klocwork #106 ........ r50780 | neal.norwitz | 2006-07-23 09:55:55 +0200 (Sun, 23 Jul 2006) | 9 lines Check the allocation of b_objects and return if there was a failure. Also fix a few memory leaks in other failure scenarios. It seems that if b_objects == Py_None, we will have an extra ref to b_objects. Add XXX comment so hopefully someone documents why the else isn't necessary or adds it in. Reported by Klocwork #20 ........ r50781 | neal.norwitz | 2006-07-23 09:57:11 +0200 (Sun, 23 Jul 2006) | 2 lines Fix memory leaks spotted by Klocwork #37. ........ r50782 | neal.norwitz | 2006-07-23 09:59:00 +0200 (Sun, 23 Jul 2006) | 5 lines nextlink can be NULL if teedataobject_new fails, so use XINCREF. Ensure that dataobj is never NULL. Reported by Klocwork #102 ........ r50783 | neal.norwitz | 2006-07-23 10:01:43 +0200 (Sun, 23 Jul 2006) | 8 lines Ensure we don't write beyond errText. I think I got this right, but it definitely could use some review to ensure I'm not off by one and there's no possible overflow/wrap-around of bytes_left. Reported by Klocwork #1. Fix a problem if there is a failure allocating self->db. Found with failmalloc. ........ r50784 | ronald.oussoren | 2006-07-23 11:41:09 +0200 (Sun, 23 Jul 2006) | 3 lines Without this patch CMD-W won't close EditorWindows on MacOS X. This solves part of bug #1517990. ........ r50785 | ronald.oussoren | 2006-07-23 11:46:11 +0200 (Sun, 23 Jul 2006) | 5 lines Fix for bug #1517996: Class and Path browsers show Tk menu This patch replaces the menubar that is used by AquaTk for windows without a menubar of their own by one that is more appropriate for IDLE. ........ r50786 | andrew.macintyre | 2006-07-23 14:57:02 +0200 (Sun, 23 Jul 2006) | 2 lines Build updates for OS/2 EMX port ........ r50787 | andrew.macintyre | 2006-07-23 15:00:04 +0200 (Sun, 23 Jul 2006) | 3 lines bugfix: PyThread_start_new_thread() returns the thread ID, not a flag; will backport. ........ r50789 | andrew.macintyre | 2006-07-23 15:04:00 +0200 (Sun, 23 Jul 2006) | 2 lines Get mailbox module working on OS/2 EMX port. ........ r50791 | greg.ward | 2006-07-23 18:05:51 +0200 (Sun, 23 Jul 2006) | 1 line Resync optparse with Optik 1.5.3: minor tweaks for/to tests. ........ r50794 | martin.v.loewis | 2006-07-24 07:05:22 +0200 (Mon, 24 Jul 2006) | 2 lines Update list of unsupported systems. Fixes #1510853. ........ r50795 | martin.v.loewis | 2006-07-24 12:26:33 +0200 (Mon, 24 Jul 2006) | 1 line Patch #1448199: Release GIL around ConnectRegistry. ........ r50796 | martin.v.loewis | 2006-07-24 13:54:53 +0200 (Mon, 24 Jul 2006) | 3 lines Patch #1232023: Don't include empty path component from registry, so that the current directory does not get added to sys.path. Also fixes #1526785. ........ r50797 | martin.v.loewis | 2006-07-24 14:54:17 +0200 (Mon, 24 Jul 2006) | 3 lines Bug #1524310: Properly report errors from FindNextFile in os.listdir. Will backport to 2.4. ........ r50800 | georg.brandl | 2006-07-24 15:28:57 +0200 (Mon, 24 Jul 2006) | 7 lines Patch #1523356: fix determining include dirs in python-config. Also don't install "python-config" when doing altinstall, but always install "python-config2.x" and make a link to it like with the main executable. ........ r50802 | georg.brandl | 2006-07-24 15:46:47 +0200 (Mon, 24 Jul 2006) | 3 lines Patch #1527744: right order of includes in order to have HAVE_CONIO_H defined properly. ........ r50803 | georg.brandl | 2006-07-24 16:09:56 +0200 (Mon, 24 Jul 2006) | 3 lines Patch #1515343: Fix printing of deprecated string exceptions with a value in the traceback module. ........ r50804 | kurt.kaiser | 2006-07-24 19:13:23 +0200 (Mon, 24 Jul 2006) | 7 lines EditorWindow failed when used stand-alone if sys.ps1 not set. Bug 1010370 Dave Florek M EditorWindow.py M PyShell.py M NEWS.txt ........ r50805 | kurt.kaiser | 2006-07-24 20:05:51 +0200 (Mon, 24 Jul 2006) | 6 lines - EditorWindow.test() was failing. Bug 1417598 M EditorWindow.py M ScriptBinding.py M NEWS.txt ........ r50808 | georg.brandl | 2006-07-24 22:11:35 +0200 (Mon, 24 Jul 2006) | 3 lines Repair accidental NameError. ........ r50809 | tim.peters | 2006-07-24 23:02:15 +0200 (Mon, 24 Jul 2006) | 2 lines Whitespace normalization. ........ r50810 | greg.ward | 2006-07-25 04:11:12 +0200 (Tue, 25 Jul 2006) | 3 lines Don't use standard assert: want tests to fail even when run with -O. Delete cruft. ........ r50811 | tim.peters | 2006-07-25 06:07:22 +0200 (Tue, 25 Jul 2006) | 10 lines current_frames_with_threads(): There's actually no way to guess /which/ line the spawned thread is in at the time sys._current_frames() is called: we know it finished enter_g.set(), but can't know whether the instruction counter has advanced to the following leave_g.wait(). The latter is overwhelming most likely, but not guaranteed, and I see that the "x86 Ubuntu dapper (icc) trunk" buildbot found it on the other line once. Changed the test so it passes in either case. ........ r50815 | martin.v.loewis | 2006-07-25 11:53:12 +0200 (Tue, 25 Jul 2006) | 2 lines Bug #1525817: Don't truncate short lines in IDLE's tool tips. ........ r50816 | martin.v.loewis | 2006-07-25 12:05:47 +0200 (Tue, 25 Jul 2006) | 3 lines Bug #978833: Really close underlying socket in _socketobject.close. Will backport to 2.4. ........ r50817 | martin.v.loewis | 2006-07-25 12:11:14 +0200 (Tue, 25 Jul 2006) | 1 line Revert incomplete checkin. ........ r50819 | georg.brandl | 2006-07-25 12:22:34 +0200 (Tue, 25 Jul 2006) | 4 lines Patch #1525766: correctly pass onerror arg to recursive calls of pkg.walk_packages. Also improve the docstrings. ........ r50825 | brett.cannon | 2006-07-25 19:32:20 +0200 (Tue, 25 Jul 2006) | 2 lines Add comment for changes to test_ossaudiodev. ........ r50826 | brett.cannon | 2006-07-25 19:34:36 +0200 (Tue, 25 Jul 2006) | 3 lines Fix a bug in the messages for an assert failure where not enough arguments to a string were being converted in the format. ........ r50828 | armin.rigo | 2006-07-25 20:09:57 +0200 (Tue, 25 Jul 2006) | 2 lines Document why is and is not a good way to fix the gc_inspection crasher. ........ r50829 | armin.rigo | 2006-07-25 20:11:07 +0200 (Tue, 25 Jul 2006) | 5 lines Added another crasher, which hit me today (I was not intentionally writing such code, of course, but it took some gdb time to figure out what my bug was). ........ r50830 | armin.rigo | 2006-07-25 20:38:39 +0200 (Tue, 25 Jul 2006) | 3 lines Document the crashers that will not go away soon as "won't fix", and explain why. ........ r50831 | ronald.oussoren | 2006-07-25 21:13:35 +0200 (Tue, 25 Jul 2006) | 3 lines Install the compatibility symlink to libpython.a on OSX using 'ln -sf' instead of 'ln -s', this avoid problems when reinstalling python. ........ r50832 | ronald.oussoren | 2006-07-25 21:20:54 +0200 (Tue, 25 Jul 2006) | 7 lines Fix for bug #1525447 (renaming to MacOSmodule.c would also work, but not without causing problems for anyone that is on a case-insensitive filesystem). Setup.py tries to compile the MacOS extension from MacOSmodule.c, while the actual file is named macosmodule.c. This is no problem on the (default) case-insensitive filesystem, but doesn't work on case-sensitive filesystems. ........ r50833 | ronald.oussoren | 2006-07-25 22:28:55 +0200 (Tue, 25 Jul 2006) | 7 lines Fix bug #1517990: IDLE keybindings on OSX This adds a new key definition for OSX, which is slightly different from the classic mac definition. Also add NEWS item for a couple of bugfixes I added recently. ........ r50834 | tim.peters | 2006-07-26 00:30:24 +0200 (Wed, 26 Jul 2006) | 2 lines Whitespace normalization. ........ r50839 | neal.norwitz | 2006-07-26 06:00:18 +0200 (Wed, 26 Jul 2006) | 1 line Hmm, only python2.x is installed, not plain python. Did that change recently? ........ r50840 | barry.warsaw | 2006-07-26 07:54:46 +0200 (Wed, 26 Jul 2006) | 6 lines Forward port some fixes that were in email 2.5 but for some reason didn't make it into email 4.0. Specifically, in Message.get_content_charset(), handle RFC 2231 headers that contain an encoding not known to Python, or a character in the data that isn't in the charset encoding. Also forward port the appropriate unit tests. ........ r50841 | georg.brandl | 2006-07-26 09:23:32 +0200 (Wed, 26 Jul 2006) | 3 lines NEWS entry for #1525766. ........ r50842 | georg.brandl | 2006-07-26 09:40:17 +0200 (Wed, 26 Jul 2006) | 3 lines Bug #1459963: properly capitalize HTTP header names. ........ r50843 | georg.brandl | 2006-07-26 10:03:10 +0200 (Wed, 26 Jul 2006) | 6 lines Part of bug #1523610: fix miscalculation of buffer length. Also add a guard against NULL in converttuple and add a test case (that previously would have crashed). ........ r50844 | martin.v.loewis | 2006-07-26 14:12:56 +0200 (Wed, 26 Jul 2006) | 3 lines Bug #978833: Really close underlying socket in _socketobject.close. Fix httplib.HTTPConnection.getresponse to not close the socket if it is still needed for the response. ........ r50845 | andrew.kuchling | 2006-07-26 19:16:52 +0200 (Wed, 26 Jul 2006) | 1 line [Bug #1471938] Fix build problem on Solaris 8 by conditionalizing the use of mvwgetnstr(); it was conditionalized a few lines below. Fix from Paul Eggert. I also tried out the STRICT_SYSV_CURSES case and am therefore removing the 'untested' comment. ........ r50846 | andrew.kuchling | 2006-07-26 19:18:01 +0200 (Wed, 26 Jul 2006) | 1 line Correct error message ........ r50847 | andrew.kuchling | 2006-07-26 19:19:39 +0200 (Wed, 26 Jul 2006) | 1 line Minor grammar fix ........ r50848 | andrew.kuchling | 2006-07-26 19:22:21 +0200 (Wed, 26 Jul 2006) | 1 line Put news item in right section ........ r50850 | andrew.kuchling | 2006-07-26 20:03:12 +0200 (Wed, 26 Jul 2006) | 1 line Use sys.exc_info() ........ r50851 | andrew.kuchling | 2006-07-26 20:15:45 +0200 (Wed, 26 Jul 2006) | 1 line Use sys.exc_info() ........ r50852 | phillip.eby | 2006-07-26 21:48:27 +0200 (Wed, 26 Jul 2006) | 4 lines Allow the 'onerror' argument to walk_packages() to catch any Exception, not just ImportError. This allows documentation tools to better skip unimportable packages. ........ r50854 | tim.peters | 2006-07-27 01:23:15 +0200 (Thu, 27 Jul 2006) | 2 lines Whitespace normalization. ........ r50855 | tim.peters | 2006-07-27 03:14:53 +0200 (Thu, 27 Jul 2006) | 21 lines Bug #1521947: possible bug in mystrtol.c with recent gcc. In general, C doesn't define anything about what happens when an operation on a signed integral type overflows, and PyOS_strtol() did several formally undefined things of that nature on signed longs. Some version of gcc apparently tries to exploit that now, and PyOS_strtol() could fail to detect overflow then. Tried to repair all that, although it seems at least as likely to me that we'll get screwed by bad platform definitions for LONG_MIN and/or LONG_MAX now. For that reason, I don't recommend backporting this. Note that I have no box on which this makes a lick of difference -- can't really test it, except to note that it didn't break anything on my boxes. Silent change: PyOS_strtol() used to return the hard-coded 0x7fffffff in case of overflow. Now it returns LONG_MAX. They're the same only on 32-bit boxes (although C doesn't guarantee that either ...). ........ r50856 | neal.norwitz | 2006-07-27 05:51:58 +0200 (Thu, 27 Jul 2006) | 6 lines Don't kill a normal instance of python running on windows when checking to kill a cygwin instance. build\\python.exe was matching a normal windows instance. Prefix that with a \\ to ensure build is a directory and not PCbuild. As discussed on python-dev. ........ r50857 | neal.norwitz | 2006-07-27 05:55:39 +0200 (Thu, 27 Jul 2006) | 5 lines Closure can't be NULL at this point since we know it's a tuple. Reported by Klocwork # 74. ........ r50858 | neal.norwitz | 2006-07-27 06:04:50 +0200 (Thu, 27 Jul 2006) | 1 line No functional change. Add comment and assert to describe why there cannot be overflow which was reported by Klocwork. Discussed on python-dev ........ r50859 | martin.v.loewis | 2006-07-27 08:38:16 +0200 (Thu, 27 Jul 2006) | 3 lines Bump distutils version to 2.5, as several new features have been introduced since 2.4. ........ r50860 | andrew.kuchling | 2006-07-27 14:18:20 +0200 (Thu, 27 Jul 2006) | 1 line Reformat docstring; fix typo ........ r50861 | georg.brandl | 2006-07-27 17:05:36 +0200 (Thu, 27 Jul 2006) | 6 lines Add test_main() methods. These three tests were never run by regrtest.py. We really need a simpler testing framework. ........ r50862 | tim.peters | 2006-07-27 17:09:20 +0200 (Thu, 27 Jul 2006) | 2 lines News for patch #1529686. ........ r50863 | tim.peters | 2006-07-27 17:11:00 +0200 (Thu, 27 Jul 2006) | 2 lines Whitespace normalization. ........ r50864 | georg.brandl | 2006-07-27 17:38:33 +0200 (Thu, 27 Jul 2006) | 3 lines Amend news entry. ........ r50865 | georg.brandl | 2006-07-27 18:08:15 +0200 (Thu, 27 Jul 2006) | 3 lines Make uuid test suite pass on this box by requesting output with LC_ALL=C. ........ r50866 | andrew.kuchling | 2006-07-27 20:37:33 +0200 (Thu, 27 Jul 2006) | 1 line Add example ........ r50867 | thomas.heller | 2006-07-27 20:39:55 +0200 (Thu, 27 Jul 2006) | 9 lines Remove code that is no longer used (ctypes.com). Fix the DllGetClassObject and DllCanUnloadNow so that they forward the call to the comtypes.server.inprocserver module. The latter was never documented, never used by published code, and didn't work anyway, so I think it does not deserve a NEWS entry (but I might be wrong). ........ r50868 | andrew.kuchling | 2006-07-27 20:41:21 +0200 (Thu, 27 Jul 2006) | 1 line Typo fix ('publically' is rare, poss. non-standard) ........ r50869 | andrew.kuchling | 2006-07-27 20:42:41 +0200 (Thu, 27 Jul 2006) | 1 line Add missing word ........ r50870 | andrew.kuchling | 2006-07-27 20:44:10 +0200 (Thu, 27 Jul 2006) | 1 line Repair typos ........ r50872 | andrew.kuchling | 2006-07-27 20:53:33 +0200 (Thu, 27 Jul 2006) | 1 line Update URL; add example ........ r50873 | andrew.kuchling | 2006-07-27 21:07:29 +0200 (Thu, 27 Jul 2006) | 1 line Add punctuation mark; add some examples ........ r50874 | andrew.kuchling | 2006-07-27 21:11:07 +0200 (Thu, 27 Jul 2006) | 1 line Mention base64 module; rewrite last sentence to be more positive ........ r50875 | andrew.kuchling | 2006-07-27 21:12:49 +0200 (Thu, 27 Jul 2006) | 1 line If binhex is higher-level than binascii, it should come first in the chapter ........ r50876 | tim.peters | 2006-07-27 22:47:24 +0200 (Thu, 27 Jul 2006) | 28 lines check_node(): stop spraying mystery output to stderr. When a node number disagrees, keep track of all sources & the node numbers they reported, and stick all that in the error message. Changed all callers to supply a non-empty "source" argument; made the "source" argument non-optional. On my box, test_uuid still fails, but with the less confusing output: AssertionError: different sources disagree on node: from source 'getnode1', node was 00038a000015 from source 'getnode2', node was 00038a000015 from source 'ipconfig', node was 001111b2b7bf Only the last one appears to be correct; e.g., C:\Code\python\PCbuild>getmac Physical Address Transport Name =================== ========================================================== 00-11-11-B2-B7-BF \Device\Tcpip_{190FB163-5AFD-4483-86A1-2FE16AC61FF1} 62-A1-AC-6C-FD-BE \Device\Tcpip_{8F77DF5A-EA3D-4F1D-975E-D472CEE6438A} E2-1F-01-C6-5D-88 \Device\Tcpip_{CD18F76B-2EF3-409F-9B8A-6481EE70A1E4} I can't find anything on my box with MAC 00-03-8a-00-00-15, and am not clear on where that comes from. ........ r50878 | andrew.kuchling | 2006-07-28 00:40:05 +0200 (Fri, 28 Jul 2006) | 1 line Reword paragraph ........ r50879 | andrew.kuchling | 2006-07-28 00:49:38 +0200 (Fri, 28 Jul 2006) | 1 line Add example ........ r50880 | andrew.kuchling | 2006-07-28 00:49:54 +0200 (Fri, 28 Jul 2006) | 1 line Add example ........ r50881 | barry.warsaw | 2006-07-28 01:43:15 +0200 (Fri, 28 Jul 2006) | 27 lines Patch #1520294: Support for getset and member descriptors in types.py, inspect.py, and pydoc.py. Specifically, this allows for querying the type of an object against these built-in C types and more importantly, for getting their docstrings printed in the interactive interpreter's help() function. This patch includes a new built-in module called _types which provides definitions of getset and member descriptors for use by the types.py module. These types are exposed as types.GetSetDescriptorType and types.MemberDescriptorType. Query functions are provided as inspect.isgetsetdescriptor() and inspect.ismemberdescriptor(). The implementations of these are robust enough to work with Python implementations other than CPython, which may not have these fundamental types. The patch also includes documentation and test suite updates. I commit these changes now under these guiding principles: 1. Silence is assent. The release manager has not said "no", and of the few people that cared enough to respond to the thread, the worst vote was "0". 2. It's easier to ask for forgiveness than permission. 3. It's so dang easy to revert stuff in svn, that you could view this as a forcing function. :) Windows build patches will follow. ........ r50882 | tim.peters | 2006-07-28 01:44:37 +0200 (Fri, 28 Jul 2006) | 4 lines Bug #1529297: The rewrite of doctest for Python 2.4 unintentionally lost that tests are sorted by name before being run. ``DocTestFinder`` has been changed to sort the list of tests it returns. ........ r50883 | tim.peters | 2006-07-28 01:45:48 +0200 (Fri, 28 Jul 2006) | 2 lines Whitespace normalization. ........ r50884 | tim.peters | 2006-07-28 01:46:36 +0200 (Fri, 28 Jul 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r50885 | barry.warsaw | 2006-07-28 01:50:40 +0200 (Fri, 28 Jul 2006) | 4 lines Enable the building of the _types module on Windows. Note that this has only been tested for VS 2003 since that's all I have. ........ r50887 | tim.peters | 2006-07-28 02:23:15 +0200 (Fri, 28 Jul 2006) | 7 lines defdict_reduce(): Plug leaks. We didn't notice these before because test_defaultdict didn't actually do anything before Georg fixed that earlier today. Neal's next refleak run then showed test_defaultdict leaking 9 references on each run. That's repaired by this checkin. ........ r50888 | tim.peters | 2006-07-28 02:30:00 +0200 (Fri, 28 Jul 2006) | 2 lines News about the repaired memory leak in defaultdict. ........ r50889 | gregory.p.smith | 2006-07-28 03:35:25 +0200 (Fri, 28 Jul 2006) | 7 lines - pybsddb Bug #1527939: bsddb module DBEnv dbremove and dbrename methods now allow their database parameter to be None as the sleepycat API allows. Also adds an appropriate test case for DBEnv.dbrename and dbremove. ........ r50895 | neal.norwitz | 2006-07-28 06:22:34 +0200 (Fri, 28 Jul 2006) | 1 line Ensure the actual number matches the expected count ........ r50896 | tim.peters | 2006-07-28 06:51:59 +0200 (Fri, 28 Jul 2006) | 6 lines Live with that "the hardware address" is an ill-defined concept, and that different ways of trying to find "the hardware address" may return different results. Certainly true on both of my Windows boxes, and in different ways (see whining on python-dev). ........ r50897 | neal.norwitz | 2006-07-28 09:21:27 +0200 (Fri, 28 Jul 2006) | 3 lines Try to find the MAC addr on various flavours of Unix. This seems hopeless. The reduces the test_uuid failures, but there's still another method failing. ........ r50898 | martin.v.loewis | 2006-07-28 09:45:49 +0200 (Fri, 28 Jul 2006) | 2 lines Add UUID for upcoming 2.5b3. ........ r50899 | matt.fleming | 2006-07-28 13:27:27 +0200 (Fri, 28 Jul 2006) | 3 lines Allow socketmodule to compile on NetBSD -current, whose bluetooth API differs from both Linux and FreeBSD. Accepted by Neal Norwitz. ........ r50900 | andrew.kuchling | 2006-07-28 14:07:12 +0200 (Fri, 28 Jul 2006) | 1 line [Patch #1529811] Correction to description of r|* mode ........ r50901 | andrew.kuchling | 2006-07-28 14:18:22 +0200 (Fri, 28 Jul 2006) | 1 line Typo fix ........ r50902 | andrew.kuchling | 2006-07-28 14:32:43 +0200 (Fri, 28 Jul 2006) | 1 line Add example ........ r50903 | andrew.kuchling | 2006-07-28 14:33:19 +0200 (Fri, 28 Jul 2006) | 1 line Add example ........ r50904 | andrew.kuchling | 2006-07-28 14:45:55 +0200 (Fri, 28 Jul 2006) | 1 line Don't overwrite built-in name; add some blank lines for readability ........ r50905 | andrew.kuchling | 2006-07-28 14:48:07 +0200 (Fri, 28 Jul 2006) | 1 line Add example. Should I propagate this example to all the other DBM-ish modules, too? ........ r50912 | georg.brandl | 2006-07-28 20:31:39 +0200 (Fri, 28 Jul 2006) | 3 lines Patch #1529686: also run test_email_codecs with regrtest.py. ........ r50913 | georg.brandl | 2006-07-28 20:36:01 +0200 (Fri, 28 Jul 2006) | 3 lines Fix spelling. ........ r50915 | thomas.heller | 2006-07-28 21:42:40 +0200 (Fri, 28 Jul 2006) | 3 lines Remove a useless XXX comment. Cosmetic changes to the code so that the #ifdef _UNICODE block doesn't mess emacs code formatting. ........ r50916 | phillip.eby | 2006-07-28 23:12:07 +0200 (Fri, 28 Jul 2006) | 5 lines Bug #1529871: The speed enhancement patch #921466 broke Python's compliance with PEP 302. This was fixed by adding an ``imp.NullImporter`` type that is used in ``sys.path_importer_cache`` to cache non-directory paths and avoid excessive filesystem operations during imports. ........ r50917 | phillip.eby | 2006-07-28 23:31:54 +0200 (Fri, 28 Jul 2006) | 2 lines Fix svn merge spew. ........ r50918 | thomas.heller | 2006-07-28 23:43:20 +0200 (Fri, 28 Jul 2006) | 4 lines Patch #1529514: More openbsd platforms for ctypes. Regenerated Modules/_ctypes/libffi/configure with autoconf 2.59. Approved by Neal. ........ r50922 | georg.brandl | 2006-07-29 10:51:21 +0200 (Sat, 29 Jul 2006) | 2 lines Bug #835255: The "closure" argument to new.function() is now documented. ........ r50924 | georg.brandl | 2006-07-29 11:33:26 +0200 (Sat, 29 Jul 2006) | 3 lines Bug #1441397: The compiler module now recognizes module and function docstrings correctly as it did in Python 2.4. ........ r50925 | georg.brandl | 2006-07-29 12:25:46 +0200 (Sat, 29 Jul 2006) | 4 lines Revert rev 42617, it was introduced to work around bug #1441397. test_compiler now passes again. ........ r50926 | fred.drake | 2006-07-29 15:22:49 +0200 (Sat, 29 Jul 2006) | 1 line update target version number ........ r50927 | andrew.kuchling | 2006-07-29 15:56:48 +0200 (Sat, 29 Jul 2006) | 1 line Add example ........ r50928 | andrew.kuchling | 2006-07-29 16:04:47 +0200 (Sat, 29 Jul 2006) | 1 line Update URL ........ r50930 | andrew.kuchling | 2006-07-29 16:08:15 +0200 (Sat, 29 Jul 2006) | 1 line Reword paragraph to match the order of the subsequent sections ........ r50931 | andrew.kuchling | 2006-07-29 16:21:15 +0200 (Sat, 29 Jul 2006) | 1 line [Bug #1529157] Mention raw_input() and input(); while I'm at it, reword the description a bit ........ r50932 | andrew.kuchling | 2006-07-29 16:42:48 +0200 (Sat, 29 Jul 2006) | 1 line [Bug #1519571] Document some missing functions: setup(), title(), done() ........ r50933 | andrew.kuchling | 2006-07-29 16:43:55 +0200 (Sat, 29 Jul 2006) | 1 line Fix docstring punctuation ........ r50934 | andrew.kuchling | 2006-07-29 17:10:32 +0200 (Sat, 29 Jul 2006) | 1 line [Bug #1414697] Change docstring of set/frozenset types to specify that the contents are unique. Raymond, please feel free to edit or revert. ........ r50935 | andrew.kuchling | 2006-07-29 17:35:21 +0200 (Sat, 29 Jul 2006) | 1 line [Bug #1530382] Document SSL.server(), .issuer() methods ........ r50936 | andrew.kuchling | 2006-07-29 17:42:46 +0200 (Sat, 29 Jul 2006) | 1 line Typo fix ........ r50937 | andrew.kuchling | 2006-07-29 17:43:13 +0200 (Sat, 29 Jul 2006) | 1 line Tweak wording ........ r50938 | matt.fleming | 2006-07-29 17:55:30 +0200 (Sat, 29 Jul 2006) | 2 lines Fix typo ........ r50939 | andrew.kuchling | 2006-07-29 17:57:08 +0200 (Sat, 29 Jul 2006) | 6 lines [Bug #1528258] Mention that the 'data' argument can be None. The constructor docs referred the reader to the add_data() method's docs, but they weren't very helpful. I've simply copied an earlier explanation of 'data' that's more useful. ........ r50940 | andrew.kuchling | 2006-07-29 18:08:40 +0200 (Sat, 29 Jul 2006) | 1 line Set bug/patch count. Take a bow, everyone! ........ r50941 | fred.drake | 2006-07-29 18:56:15 +0200 (Sat, 29 Jul 2006) | 18 lines expunge the xmlcore changes: 41667, 41668 - initial switch to xmlcore 47044 - mention of xmlcore in What's New 50687 - mention of xmlcore in the library reference re-apply xmlcore changes to xml: 41674 - line ending changes (re-applied manually), directory props 41677 - add cElementTree wrapper 41678 - PSF licensing for etree 41812 - whitespace normalization 42724 - fix svn:eol-style settings 43681, 43682 - remove Python version-compatibility cruft from minidom 46773 - fix encoding of \r\n\t in attr values in saxutils 47269 - added XMLParser alias for cElementTree compatibility additional tests were added in Lib/test/test_sax.py that failed with the xmlcore changes; these relate to SF bugs #1511497, #1513611 ........ r50942 | andrew.kuchling | 2006-07-29 20:14:07 +0200 (Sat, 29 Jul 2006) | 17 lines Reorganize the docs for 'file' and 'open()' after some discussion with Fred. We want to encourage users to write open() when opening a file, but open() was described with a single paragraph and 'file' had lots of explanation of the mode and bufsize arguments. I've shrunk the description of 'file' to cross-reference to the 'File objects' section, and to open() for an explanation of the arguments. open() now has all the paragraphs about the mode string. The bufsize argument was moved up so that it isn't buried at the end; now there's 1 paragraph on mode, 1 on bufsize, and then 3 more on mode. Various other edits and rearrangements were made in the process. It's probably best to read the final text and not to try to make sense of the diffs. ........ r50943 | fred.drake | 2006-07-29 20:19:19 +0200 (Sat, 29 Jul 2006) | 1 line restore test un-intentionally removed in the xmlcore purge (revision 50941) ........ r50944 | fred.drake | 2006-07-29 20:33:29 +0200 (Sat, 29 Jul 2006) | 3 lines make the reference to older versions of the documentation a link to the right page on python.org ........ r50945 | fred.drake | 2006-07-29 21:09:01 +0200 (Sat, 29 Jul 2006) | 1 line document the footnote usage pattern ........ r50947 | fred.drake | 2006-07-29 21:14:10 +0200 (Sat, 29 Jul 2006) | 1 line emphasize and oddball nuance of LaTeX comment syntax ........ r50948 | andrew.kuchling | 2006-07-29 21:24:04 +0200 (Sat, 29 Jul 2006) | 1 line [Patch #1490989 from Skip Montanaro] Mention debugging builds in the API documentation. I've changed Skip's patch to point to Misc/SpecialBuilds and fiddled with the markup a bit. ........ r50949 | neal.norwitz | 2006-07-29 21:29:35 +0200 (Sat, 29 Jul 2006) | 6 lines Disable these tests until they are reliable across platforms. These problems may mask more important, real problems. One or both methods are known to fail on: Solaris, OpenBSD, Debian, Ubuntu. They pass on Windows and some Linux boxes. ........ r50950 | andrew.kuchling | 2006-07-29 21:50:37 +0200 (Sat, 29 Jul 2006) | 1 line [Patch #1068277] Clarify that os.path.exists() can return False depending on permissions. Fred approved committing this patch in December 2004! ........ r50952 | fred.drake | 2006-07-29 22:04:42 +0200 (Sat, 29 Jul 2006) | 6 lines SF bug #1193966: Weakref types documentation misplaced The information about supporting weakrefs with types defined in C extensions is moved to the Extending & Embedding manual. Py_TPFLAGS_HAVE_WEAKREFS is no longer mentioned since it is part of Py_TPFLAGS_DEFAULT. ........ r50953 | skip.montanaro | 2006-07-29 22:06:05 +0200 (Sat, 29 Jul 2006) | 4 lines Add a comment to the csv reader documentation that explains why the treatment of newlines changed in 2.5. Pulled almost verbatim from a comment by Andrew McNamara in <http://python.org/sf/1465014>. ........ r50954 | neal.norwitz | 2006-07-29 22:20:52 +0200 (Sat, 29 Jul 2006) | 3 lines If the executable doesn't exist, there's no reason to try to start it. This prevents garbage about command not found being printed on Solaris. ........ r50955 | fred.drake | 2006-07-29 22:21:25 +0200 (Sat, 29 Jul 2006) | 1 line fix minor markup error that introduced extra punctuation ........ r50957 | neal.norwitz | 2006-07-29 22:37:08 +0200 (Sat, 29 Jul 2006) | 3 lines Disable test_getnode too, since this is also unreliable. ........ r50958 | andrew.kuchling | 2006-07-29 23:27:12 +0200 (Sat, 29 Jul 2006) | 1 line Follow TeX's conventions for hyphens ........ r50959 | andrew.kuchling | 2006-07-29 23:30:21 +0200 (Sat, 29 Jul 2006) | 1 line Fix case for 'Unix' ........ r50960 | fred.drake | 2006-07-30 01:34:57 +0200 (Sun, 30 Jul 2006) | 1 line markup cleanups ........ r50961 | andrew.kuchling | 2006-07-30 02:27:34 +0200 (Sun, 30 Jul 2006) | 1 line Minor typo fixes ........ r50962 | andrew.kuchling | 2006-07-30 02:37:56 +0200 (Sun, 30 Jul 2006) | 1 line [Bug #793553] Correct description of keyword arguments for SSL authentication ........ r50963 | tim.peters | 2006-07-30 02:58:15 +0200 (Sun, 30 Jul 2006) | 2 lines Whitespace normalization. ........ r50964 | fred.drake | 2006-07-30 05:03:43 +0200 (Sun, 30 Jul 2006) | 1 line lots of markup nits, most commonly Unix/unix --> \UNIX ........ r50965 | fred.drake | 2006-07-30 07:41:28 +0200 (Sun, 30 Jul 2006) | 1 line update information on wxPython, from Robin Dunn ........ r50966 | fred.drake | 2006-07-30 07:49:49 +0200 (Sun, 30 Jul 2006) | 4 lines remove possibly-outdated comment on what GUI toolkit is most commonly used; it is hard to know whether this is right, and it does not add valuable reference information at any rate ........ r50967 | fred.drake | 2006-07-30 07:55:39 +0200 (Sun, 30 Jul 2006) | 3 lines - remove yet another reference to how commonly Tkinter is (thought to be) used - fix an internal section reference ........ r50968 | neal.norwitz | 2006-07-30 08:53:31 +0200 (Sun, 30 Jul 2006) | 4 lines Patch #1531113: Fix augmented assignment with yield expressions. Also fix a SystemError when trying to assign to yield expressions. ........ r50969 | neal.norwitz | 2006-07-30 08:55:48 +0200 (Sun, 30 Jul 2006) | 5 lines Add PyErr_WarnEx() so C code can pass the stacklevel to warnings.warn(). This provides the proper warning for struct.pack(). PyErr_Warn() is now deprecated in favor of PyErr_WarnEx(). As mentioned by Tim Peters on python-dev. ........ r50970 | neal.norwitz | 2006-07-30 08:57:04 +0200 (Sun, 30 Jul 2006) | 3 lines Bug #1515471: string.replace() accepts character buffers again. Pass the char* and size around rather than PyObject's. ........ r50971 | neal.norwitz | 2006-07-30 08:59:13 +0200 (Sun, 30 Jul 2006) | 1 line Whitespace normalization ........ r50973 | georg.brandl | 2006-07-30 12:53:32 +0200 (Sun, 30 Jul 2006) | 3 lines Clarify that __op__ methods must return NotImplemented if they don't support the operation. ........ r50974 | georg.brandl | 2006-07-30 13:07:23 +0200 (Sun, 30 Jul 2006) | 3 lines Bug #1002398: The documentation for os.path.sameopenfile now correctly refers to file descriptors, not file objects. ........ r50977 | martin.v.loewis | 2006-07-30 15:00:31 +0200 (Sun, 30 Jul 2006) | 3 lines Don't copy directory stat times in shutil.copytree on Windows Fixes #1525866. ........ r50978 | martin.v.loewis | 2006-07-30 15:14:05 +0200 (Sun, 30 Jul 2006) | 3 lines Base __version__ on sys.version_info, as distutils is no longer maintained separatedly. ........ r50979 | martin.v.loewis | 2006-07-30 15:27:31 +0200 (Sun, 30 Jul 2006) | 3 lines Mention Cygwin in distutils error message about a missing VS 2003. Fixes #1257728. ........ r50982 | martin.v.loewis | 2006-07-30 16:09:47 +0200 (Sun, 30 Jul 2006) | 5 lines Drop usage of test -e in configure as it is not portable. Fixes #1439538 Will backport to 2.4 Also regenerate pyconfig.h.in. ........ r50984 | georg.brandl | 2006-07-30 18:20:10 +0200 (Sun, 30 Jul 2006) | 3 lines Fix makefile changes for python-config. ........ r50985 | george.yoshida | 2006-07-30 18:37:37 +0200 (Sun, 30 Jul 2006) | 2 lines Rename struct.pack_to to struct.pack_into as changed in revision 46642. ........ r50986 | george.yoshida | 2006-07-30 18:41:30 +0200 (Sun, 30 Jul 2006) | 2 lines Typo fix ........ r50987 | neal.norwitz | 2006-07-30 21:18:13 +0200 (Sun, 30 Jul 2006) | 1 line Add some asserts and update comments ........ r50988 | neal.norwitz | 2006-07-30 21:18:38 +0200 (Sun, 30 Jul 2006) | 1 line Verify that the signal handlers were really called ........ r50989 | neal.norwitz | 2006-07-30 21:20:42 +0200 (Sun, 30 Jul 2006) | 3 lines Try to prevent hangs on Tru64/Alpha buildbot. I'm not certain this will help and may need to be reverted if it causes problems. ........ r50990 | georg.brandl | 2006-07-30 22:18:51 +0200 (Sun, 30 Jul 2006) | 2 lines Bug #1531349: right <-> left glitch in __rop__ description. ........ r50992 | tim.peters | 2006-07-31 03:46:03 +0200 (Mon, 31 Jul 2006) | 2 lines Whitespace normalization. ........ r50993 | andrew.mcnamara | 2006-07-31 04:27:48 +0200 (Mon, 31 Jul 2006) | 2 lines Redo the comment about the 2.5 change in quoted-newline handling. ........ r50994 | tim.peters | 2006-07-31 04:40:23 +0200 (Mon, 31 Jul 2006) | 10 lines ZipFile.close(): Killed one of the struct.pack deprecation warnings on Win32. Also added an XXX about the line: pos3 = self.fp.tell() `pos3` is never referenced, and I have no idea what the code intended to do instead. ........ r50996 | tim.peters | 2006-07-31 04:53:03 +0200 (Mon, 31 Jul 2006) | 8 lines ZipFile.close(): Kill the other struct.pack deprecation warning on Windows. Afraid I can't detect a pattern to when the pack formats decide to use a signed or unsigned format code -- appears nearly arbitrary to my eyes. So I left all the pack formats alone and changed the special-case data values instead. ........ r50997 | skip.montanaro | 2006-07-31 05:09:45 +0200 (Mon, 31 Jul 2006) | 1 line minor tweaks ........ r50998 | skip.montanaro | 2006-07-31 05:11:11 +0200 (Mon, 31 Jul 2006) | 1 line minor tweaks ........ r50999 | andrew.kuchling | 2006-07-31 14:20:24 +0200 (Mon, 31 Jul 2006) | 1 line Add refcounts for PyErr_WarnEx ........ r51000 | andrew.kuchling | 2006-07-31 14:39:05 +0200 (Mon, 31 Jul 2006) | 9 lines Document PyErr_WarnEx. (Bad Neal! No biscuit!) Is the explanation of the 'stacklevel' parameter clear? Please feel free to edit it. I don't have LaTeX installed on this machine, so haven't verified that the markup is correct. Will check tonight, or maybe the automatic doc build will tell me. ........ r51001 | andrew.kuchling | 2006-07-31 14:52:26 +0200 (Mon, 31 Jul 2006) | 1 line Add PyErr_WarnEx() ........ r51002 | andrew.kuchling | 2006-07-31 15:18:27 +0200 (Mon, 31 Jul 2006) | 1 line Mention csv newline changes ........ r51003 | andrew.kuchling | 2006-07-31 17:22:58 +0200 (Mon, 31 Jul 2006) | 1 line Typo fix ........ r51004 | andrew.kuchling | 2006-07-31 17:23:43 +0200 (Mon, 31 Jul 2006) | 1 line Remove reference to notation ........ r51005 | georg.brandl | 2006-07-31 18:00:34 +0200 (Mon, 31 Jul 2006) | 3 lines Fix function name. ........ r51006 | andrew.kuchling | 2006-07-31 18:10:24 +0200 (Mon, 31 Jul 2006) | 1 line [Bug #1514540] Instead of putting the standard types in a section, put them in a chapter of their own. This means string methods will now show up in the ToC. (Should the types come before or after the functions+exceptions+constants chapter? I've put them after, for now.) ........ r51007 | andrew.kuchling | 2006-07-31 18:22:05 +0200 (Mon, 31 Jul 2006) | 1 line [Bug #848556] Remove \d* from second alternative to avoid exponential case when repeating match ........ r51008 | andrew.kuchling | 2006-07-31 18:27:57 +0200 (Mon, 31 Jul 2006) | 1 line Update list of files; fix a typo ........ r51013 | andrew.kuchling | 2006-08-01 18:24:30 +0200 (Tue, 01 Aug 2006) | 1 line typo fix ........ r51018 | thomas.heller | 2006-08-01 18:54:43 +0200 (Tue, 01 Aug 2006) | 2 lines Fix a potential segfault and various potentail refcount leaks in the cast() function. ........ r51020 | thomas.heller | 2006-08-01 19:46:10 +0200 (Tue, 01 Aug 2006) | 1 line Minimal useful docstring for CopyComPointer. ........ r51021 | andrew.kuchling | 2006-08-01 20:16:15 +0200 (Tue, 01 Aug 2006) | 8 lines [Patch #1520905] Attempt to suppress core file created by test_subprocess.py. Patch by Douglas Greiman. The test_run_abort() testcase produces a core file on Unix systems, even though the test is successful. This can be confusing or alarming to someone who runs 'make test' and then finds that the Python interpreter apparently crashed. ........ r51023 | georg.brandl | 2006-08-01 20:49:24 +0200 (Tue, 01 Aug 2006) | 3 lines os.urandom no longer masks unrelated exceptions like SystemExit or KeyboardInterrupt. ........ r51025 | thomas.heller | 2006-08-01 21:14:15 +0200 (Tue, 01 Aug 2006) | 2 lines Speed up PyType_stgdict and PyObject_stgdict. ........ r51027 | ronald.oussoren | 2006-08-01 22:30:31 +0200 (Tue, 01 Aug 2006) | 3 lines Make sure the postinstall action that optionally updates the user's profile on MacOS X actually works correctly in all cases. ........ r51028 | ronald.oussoren | 2006-08-01 23:00:57 +0200 (Tue, 01 Aug 2006) | 4 lines This fixes bug #1527397: PythonLauncher runs scripts with the wrong working directory. It also fixes a bug where PythonLauncher failed to launch scripts when the scriptname (or the path to the script) contains quotes. ........ r51031 | tim.peters | 2006-08-02 05:27:46 +0200 (Wed, 02 Aug 2006) | 2 lines Whitespace normalization. ........ r51032 | tim.peters | 2006-08-02 06:12:36 +0200 (Wed, 02 Aug 2006) | 19 lines Try to squash struct.pack warnings on the "amd64 gentoo trunk" buildbot (& possibly other 64-bit boxes) during test_gzip. The native zlib crc32 function returns an unsigned 32-bit integer, which the Python wrapper implicitly casts to C long. Therefore the same crc can "look negative" on a 32-bit box but "look positive" on a 64-bit box. This patch papers over that platform difference when writing the crc to file. It may be better to change the Python wrapper, either to make the result "look positive" on all platforms (which means it may have to return a Python long at times on a 32-bit box), or to keep the sign the same across boxes. But that would be a visible change in what users see, while the current hack changes no visible behavior (well, apart from stopping the struct deprecation warning). Note that the module-level write32() function is no longer used. ........ r51033 | neal.norwitz | 2006-08-02 06:27:11 +0200 (Wed, 02 Aug 2006) | 4 lines Prevent memory leak on error. Reported by Klocwork #36 ........ r51034 | tim.peters | 2006-08-02 07:20:08 +0200 (Wed, 02 Aug 2006) | 9 lines _Stream.close(): Try to kill struct.pack() warnings when writing the crc to file on the "PPC64 Debian trunk" buildbot when running test_tarfile. This is again a case where the native zlib crc is an unsigned 32-bit int, but the Python wrapper implicitly casts it to signed C long, so that "the sign bit looks different" on different platforms. ........ r51035 | ronald.oussoren | 2006-08-02 08:10:10 +0200 (Wed, 02 Aug 2006) | 2 lines Updated documentation for the script that builds the OSX installer. ........ r51036 | neal.norwitz | 2006-08-02 08:14:22 +0200 (Wed, 02 Aug 2006) | 2 lines _PyWeakref_GetWeakrefCount() now returns a Py_ssize_t instead of long. ........ r51037 | neal.norwitz | 2006-08-02 08:15:10 +0200 (Wed, 02 Aug 2006) | 1 line v is already checked for NULL, so just DECREF it ........ r51038 | neal.norwitz | 2006-08-02 08:19:19 +0200 (Wed, 02 Aug 2006) | 1 line Let us know when there was a problem and the child had to kill the parent ........ r51039 | neal.norwitz | 2006-08-02 08:46:21 +0200 (Wed, 02 Aug 2006) | 5 lines Patch #1519025 and bug #926423: If a KeyboardInterrupt occurs during a socket operation on a socket with a timeout, the exception will be caught correctly. Previously, the exception was not caught. ........ r51040 | neal.norwitz | 2006-08-02 09:09:32 +0200 (Wed, 02 Aug 2006) | 1 line Add some explanation about Klocwork and Coverity static analysis ........ r51041 | anthony.baxter | 2006-08-02 09:43:09 +0200 (Wed, 02 Aug 2006) | 1 line pre-release machinations ........ r51043 | thomas.heller | 2006-08-02 13:35:31 +0200 (Wed, 02 Aug 2006) | 4 lines A few nore words about what ctypes does. Document that using the wrong calling convention can also raise 'ValueError: Procedure called with the wrong number of arguments'. ........ r51045 | thomas.heller | 2006-08-02 14:00:13 +0200 (Wed, 02 Aug 2006) | 1 line Fix a mistake. ........ r51046 | martin.v.loewis | 2006-08-02 15:53:55 +0200 (Wed, 02 Aug 2006) | 3 lines Correction of patch #1455898: In the mbcs decoder, set final=False for stream decoder, but final=True for the decode function. ........ r51049 | tim.peters | 2006-08-02 20:19:35 +0200 (Wed, 02 Aug 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r51079 | neal.norwitz | 2006-08-04 06:50:21 +0200 (Fri, 04 Aug 2006) | 3 lines Bug #1531405, format_exception no longer raises an exception if str(exception) raised an exception. ........ r51080 | neal.norwitz | 2006-08-04 06:58:47 +0200 (Fri, 04 Aug 2006) | 11 lines Bug #1191458: tracing over for loops now produces a line event on each iteration. I'm not positive this is the best way to handle this. I'm also not sure that there aren't other cases where the lnotab is generated incorrectly. It would be great if people that use pdb or tracing could test heavily. Also: * Remove dead/duplicated code that wasn't used/necessary because we already handled the docstring prior to entering the loop. * add some debugging code into the compiler (#if 0'd out). ........ r51081 | neal.norwitz | 2006-08-04 07:09:28 +0200 (Fri, 04 Aug 2006) | 4 lines Bug #1333982: string/number constants were inappropriately stored in the byte code and co_consts even if they were not used, ie immediately popped off the stack. ........ r51082 | neal.norwitz | 2006-08-04 07:12:19 +0200 (Fri, 04 Aug 2006) | 1 line There were really two issues ........ r51084 | fred.drake | 2006-08-04 07:17:21 +0200 (Fri, 04 Aug 2006) | 1 line SF patch #1534048 (bug #1531003): fix typo in error message ........ r51085 | gregory.p.smith | 2006-08-04 07:17:47 +0200 (Fri, 04 Aug 2006) | 3 lines fix typos ........ r51087 | georg.brandl | 2006-08-04 08:03:53 +0200 (Fri, 04 Aug 2006) | 3 lines Fix bug caused by first decrefing, then increfing. ........ r51109 | neil.schemenauer | 2006-08-04 18:20:30 +0200 (Fri, 04 Aug 2006) | 5 lines Fix the 'compiler' package to generate correct code for MAKE_CLOSURE. In the 2.5 development cycle, MAKE_CLOSURE as changed to take free variables as a tuple rather than as individual items on the stack. Closes patch #1534084. ........ r51110 | georg.brandl | 2006-08-04 20:03:37 +0200 (Fri, 04 Aug 2006) | 3 lines Change fix for segfaulting property(), add a NEWS entry and a test. ........ r51111 | georg.brandl | 2006-08-04 20:07:34 +0200 (Fri, 04 Aug 2006) | 3 lines Better fix for bug #1531405, not executing str(value) twice. ........ r51112 | thomas.heller | 2006-08-04 20:17:40 +0200 (Fri, 04 Aug 2006) | 1 line On Windows, make PyErr_Warn an exported function again. ........ r51113 | thomas.heller | 2006-08-04 20:57:34 +0200 (Fri, 04 Aug 2006) | 4 lines Fix #1530448 - fix ctypes build failure on solaris 10. The '-mimpure-text' linker flag is required when linking _ctypes.so. ........ r51114 | thomas.heller | 2006-08-04 21:49:31 +0200 (Fri, 04 Aug 2006) | 3 lines Fix #1534738: win32 debug version of _msi must be _msi_d.pyd, not _msi.pyd. Fix the name of the pdb file as well. ........ r51115 | andrew.kuchling | 2006-08-04 22:37:43 +0200 (Fri, 04 Aug 2006) | 1 line Typo fixes ........ r51116 | andrew.kuchling | 2006-08-04 23:10:03 +0200 (Fri, 04 Aug 2006) | 1 line Fix mangled sentence ........ r51118 | tim.peters | 2006-08-05 00:00:35 +0200 (Sat, 05 Aug 2006) | 2 lines Whitespace normalization. ........ r51119 | bob.ippolito | 2006-08-05 01:59:21 +0200 (Sat, 05 Aug 2006) | 5 lines Fix #1530559, struct.pack raises TypeError where it used to convert. Passing float arguments to struct.pack when integers are expected now triggers a DeprecationWarning. ........ r51123 | georg.brandl | 2006-08-05 08:10:54 +0200 (Sat, 05 Aug 2006) | 3 lines Patch #1534922: correct and enhance unittest docs. ........ r51126 | georg.brandl | 2006-08-06 09:06:33 +0200 (Sun, 06 Aug 2006) | 2 lines Bug #1535182: really test the xreadlines() method of bz2 objects. ........ r51128 | georg.brandl | 2006-08-06 09:26:21 +0200 (Sun, 06 Aug 2006) | 4 lines Bug #1535081: A leading underscore has been added to the names of the md5 and sha modules, so add it in Modules/Setup.dist too. ........ r51129 | georg.brandl | 2006-08-06 10:23:54 +0200 (Sun, 06 Aug 2006) | 3 lines Bug #1535165: fixed a segfault in input() and raw_input() when sys.stdin is closed. ........ r51131 | georg.brandl | 2006-08-06 11:17:16 +0200 (Sun, 06 Aug 2006) | 2 lines Don't produce output in test_builtin. ........ r51133 | andrew.macintyre | 2006-08-06 14:37:03 +0200 (Sun, 06 Aug 2006) | 4 lines test_threading now skips testing alternate thread stack sizes on platforms that don't support changing thread stack size. ........ r51134 | andrew.kuchling | 2006-08-07 00:07:04 +0200 (Mon, 07 Aug 2006) | 2 lines [Patch #1464056] Ensure that we use the panelw library when linking with ncursesw. Once I see how the buildbots react, I'll backport this to 2.4. ........ r51137 | georg.brandl | 2006-08-08 13:52:34 +0200 (Tue, 08 Aug 2006) | 3 lines webbrowser: Silence stderr output if no gconftool or gnome browser found ........ r51138 | georg.brandl | 2006-08-08 13:56:21 +0200 (Tue, 08 Aug 2006) | 7 lines Remove "non-mapping" and "non-sequence" from TypeErrors raised by PyMapping_Size and PySequence_Size. Because len() tries first sequence, then mapping size, it will always raise a "non-mapping object has no len" error which is confusing. ........ r51139 | thomas.heller | 2006-08-08 19:37:00 +0200 (Tue, 08 Aug 2006) | 3 lines memcmp() can return values other than -1, 0, and +1 but tp_compare must not. ........ r51140 | thomas.heller | 2006-08-08 19:39:20 +0200 (Tue, 08 Aug 2006) | 1 line Remove accidently committed, duplicated test. ........ r51147 | andrew.kuchling | 2006-08-08 20:50:14 +0200 (Tue, 08 Aug 2006) | 1 line Reword paragraph to clarify ........ r51148 | andrew.kuchling | 2006-08-08 20:56:08 +0200 (Tue, 08 Aug 2006) | 1 line Move obmalloc item into C API section ........ r51149 | andrew.kuchling | 2006-08-08 21:00:14 +0200 (Tue, 08 Aug 2006) | 1 line 'Other changes' section now has only one item; move the item elsewhere and remove the section ........ r51150 | andrew.kuchling | 2006-08-08 21:00:34 +0200 (Tue, 08 Aug 2006) | 1 line Bump version number ........ r51151 | georg.brandl | 2006-08-08 22:11:22 +0200 (Tue, 08 Aug 2006) | 2 lines Bug #1536828: typo: TypeType should have been StringType. ........ r51153 | georg.brandl | 2006-08-08 22:13:13 +0200 (Tue, 08 Aug 2006) | 2 lines Bug #1536660: separate two words. ........ r51155 | georg.brandl | 2006-08-08 22:48:10 +0200 (Tue, 08 Aug 2006) | 3 lines ``str`` is now the same object as ``types.StringType``. ........ r51156 | tim.peters | 2006-08-09 02:52:26 +0200 (Wed, 09 Aug 2006) | 2 lines Whitespace normalization. ........ r51158 | georg.brandl | 2006-08-09 09:03:22 +0200 (Wed, 09 Aug 2006) | 4 lines Introduce an upper bound on tuple nesting depth in C argument format strings; fixes rest of #1523610. ........ r51160 | martin.v.loewis | 2006-08-09 09:57:39 +0200 (Wed, 09 Aug 2006) | 4 lines __hash__ may now return long int; the final hash value is obtained by invoking hash on the long int. Fixes #1536021. ........ r51168 | andrew.kuchling | 2006-08-09 15:03:41 +0200 (Wed, 09 Aug 2006) | 1 line [Bug #1536021] Mention __hash__ change ........ r51169 | andrew.kuchling | 2006-08-09 15:57:05 +0200 (Wed, 09 Aug 2006) | 1 line [Patch #1534027] Add notes on locale module changes ........ r51170 | andrew.kuchling | 2006-08-09 16:05:35 +0200 (Wed, 09 Aug 2006) | 1 line Add missing 'self' parameters ........ r51171 | andrew.kuchling | 2006-08-09 16:06:19 +0200 (Wed, 09 Aug 2006) | 1 line Reindent code ........ r51172 | armin.rigo | 2006-08-09 16:55:26 +0200 (Wed, 09 Aug 2006) | 2 lines Fix and test for an infinite C recursion. ........ r51173 | ronald.oussoren | 2006-08-09 16:56:33 +0200 (Wed, 09 Aug 2006) | 2 lines It's unlikely that future versions will require _POSIX_C_SOURCE ........ r51178 | armin.rigo | 2006-08-09 17:37:26 +0200 (Wed, 09 Aug 2006) | 2 lines Concatenation on a long string breaks (SF #1526585). ........ r51180 | kurt.kaiser | 2006-08-09 18:46:15 +0200 (Wed, 09 Aug 2006) | 8 lines 1. When used w/o subprocess, all exceptions were preceeded by an error message claiming they were IDLE internal errors (since 1.2a1). 2. Add Ronald Oussoren to CREDITS M NEWS.txt M PyShell.py M CREDITS.txt ........ r51181 | kurt.kaiser | 2006-08-09 19:47:15 +0200 (Wed, 09 Aug 2006) | 4 lines As a slight enhancement to the previous checkin, improve the internal error reporting by moving message to IDLE console. ........ r51182 | andrew.kuchling | 2006-08-09 20:23:14 +0200 (Wed, 09 Aug 2006) | 1 line Typo fix ........ r51183 | kurt.kaiser | 2006-08-09 22:34:46 +0200 (Wed, 09 Aug 2006) | 2 lines ToggleTab dialog was setting indent to 8 even if cancelled (since 1.2a1). ........ r51184 | martin.v.loewis | 2006-08-10 01:42:18 +0200 (Thu, 10 Aug 2006) | 2 lines Add some commentary on -mimpure-text. ........ r51185 | tim.peters | 2006-08-10 02:58:49 +0200 (Thu, 10 Aug 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r51186 | kurt.kaiser | 2006-08-10 03:41:17 +0200 (Thu, 10 Aug 2006) | 2 lines Changing tokenize (39046) to detect dedent broke tabnanny check (since 1.2a1) ........ r51187 | tim.peters | 2006-08-10 05:01:26 +0200 (Thu, 10 Aug 2006) | 13 lines test_copytree_simple(): This was leaving behind two new temp directories each time it ran, at least on Windows. Several changes: explicitly closed all files; wrapped long lines; stopped suppressing errors when removing a file or directory fails (removing /shouldn't/ fail!); and changed what appeared to be incorrect usage of os.removedirs() (that doesn't remove empty directories at and /under/ the given path, instead it must be given an empty leaf directory and then deletes empty directories moving /up/ the path -- could be that the conceptually simpler shutil.rmtree() was really actually intended here). ........
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/crashers/bogus_code_obj.py19
-rw-r--r--Lib/test/crashers/borrowed_ref_1.py29
-rw-r--r--Lib/test/crashers/borrowed_ref_2.py38
-rw-r--r--Lib/test/crashers/coerce.py9
-rw-r--r--Lib/test/crashers/gc_inspection.py32
-rw-r--r--Lib/test/crashers/infinite_rec_3.py9
-rw-r--r--Lib/test/crashers/recursion_limit_too_high.py16
-rw-r--r--Lib/test/crashers/recursive_call.py5
-rw-r--r--Lib/test/crashers/xml_parsers.py56
-rw-r--r--Lib/test/fork_wait.py9
-rw-r--r--Lib/test/output/test_ossaudiodev3
-rw-r--r--Lib/test/output/test_thread12
-rwxr-xr-xLib/test/regrtest.py86
-rw-r--r--Lib/test/string_tests.py43
-rw-r--r--Lib/test/test__locale.py3
-rw-r--r--Lib/test/test_ast.py2
-rw-r--r--Lib/test/test_asynchat.py3
-rw-r--r--Lib/test/test_bigaddrspace.py46
-rw-r--r--Lib/test/test_bigmem.py2
-rwxr-xr-xLib/test/test_bsddb.py3
-rw-r--r--Lib/test/test_builtin.py30
-rw-r--r--Lib/test/test_bz2.py3
-rw-r--r--Lib/test/test_cmd_line.py1
-rw-r--r--Lib/test/test_code.py17
-rw-r--r--Lib/test/test_codecs.py6
-rw-r--r--Lib/test/test_commands.py3
-rw-r--r--Lib/test/test_compile.py35
-rw-r--r--Lib/test/test_compiler.py38
-rw-r--r--Lib/test/test_curses.py7
-rw-r--r--Lib/test/test_defaultdict.py6
-rw-r--r--Lib/test/test_descr.py34
-rw-r--r--Lib/test/test_dis.py24
-rw-r--r--Lib/test/test_doctest.py7
-rw-r--r--Lib/test/test_email_codecs.py12
-rw-r--r--Lib/test/test_exceptions.py12
-rwxr-xr-xLib/test/test_fcntl.py7
-rw-r--r--Lib/test/test_file.py78
-rw-r--r--Lib/test/test_filecmp.py3
-rw-r--r--Lib/test/test_fork1.py13
-rw-r--r--Lib/test/test_generators.py39
-rw-r--r--Lib/test/test_genexps.py2
-rw-r--r--Lib/test/test_getargs2.py19
-rw-r--r--Lib/test/test_grammar.py5
-rw-r--r--Lib/test/test_inspect.py32
-rw-r--r--Lib/test/test_iterlen.py7
-rw-r--r--Lib/test/test_logging.py2
-rw-r--r--Lib/test/test_mailbox.py29
-rw-r--r--Lib/test/test_mimetools.py4
-rw-r--r--Lib/test/test_mimetypes.py5
-rw-r--r--Lib/test/test_minidom.py92
-rw-r--r--Lib/test/test_multibytecodec.py38
-rw-r--r--Lib/test/test_optparse.py49
-rw-r--r--Lib/test/test_os.py14
-rw-r--r--Lib/test/test_ossaudiodev.py37
-rw-r--r--Lib/test/test_pep292.py7
-rw-r--r--Lib/test/test_popen.py3
-rw-r--r--Lib/test/test_popen2.py3
-rw-r--r--Lib/test/test_pyexpat.py21
-rw-r--r--Lib/test/test_sax.py82
-rw-r--r--Lib/test/test_scope.py11
-rw-r--r--Lib/test/test_select.py3
-rw-r--r--Lib/test/test_sgmllib.py111
-rw-r--r--Lib/test/test_shutil.py47
-rw-r--r--Lib/test/test_signal.py51
-rw-r--r--Lib/test/test_socket.py67
-rw-r--r--Lib/test/test_socket_ssl.py26
-rw-r--r--Lib/test/test_socketserver.py30
-rw-r--r--Lib/test/test_struct.py95
-rw-r--r--Lib/test/test_subprocess.py49
-rw-r--r--Lib/test/test_support.py82
-rw-r--r--Lib/test/test_sys.py84
-rw-r--r--Lib/test/test_tcl.py6
-rw-r--r--Lib/test/test_textwrap.py61
-rw-r--r--Lib/test/test_thread.py43
-rw-r--r--Lib/test/test_threaded_import.py7
-rw-r--r--Lib/test/test_threadedtempfile.py4
-rw-r--r--Lib/test/test_threading.py26
-rw-r--r--Lib/test/test_time.py44
-rw-r--r--Lib/test/test_timeout.py2
-rw-r--r--Lib/test/test_trace.py4
-rw-r--r--Lib/test/test_traceback.py45
-rw-r--r--Lib/test/test_types.py8
-rw-r--r--Lib/test/test_urllib2.py14
-rw-r--r--Lib/test/test_urllib2net.py13
-rw-r--r--Lib/test/test_urllibnet.py2
-rw-r--r--Lib/test/test_uuid.py434
-rw-r--r--Lib/test/test_wait3.py12
-rw-r--r--Lib/test/test_wait4.py12
-rw-r--r--Lib/test/test_warnings.py13
-rw-r--r--Lib/test/test_winreg.py3
-rwxr-xr-xLib/test/test_wsgiref.py615
-rw-r--r--Lib/test/test_xml_etree.py44
-rw-r--r--Lib/test/test_xml_etree_c.py6
-rw-r--r--Lib/test/test_zipfile.py252
-rw-r--r--Lib/test/test_zipfile64.py101
-rw-r--r--Lib/test/test_zlib.py116
96 files changed, 3347 insertions, 447 deletions
diff --git a/Lib/test/crashers/bogus_code_obj.py b/Lib/test/crashers/bogus_code_obj.py
new file mode 100644
index 0000000..613ae51
--- /dev/null
+++ b/Lib/test/crashers/bogus_code_obj.py
@@ -0,0 +1,19 @@
+"""
+Broken bytecode objects can easily crash the interpreter.
+
+This is not going to be fixed. It is generally agreed that there is no
+point in writing a bytecode verifier and putting it in CPython just for
+this. Moreover, a verifier is bound to accept only a subset of all safe
+bytecodes, so it could lead to unnecessary breakage.
+
+For security purposes, "restricted" interpreters are not going to let
+the user build or load random bytecodes anyway. Otherwise, this is a
+"won't fix" case.
+
+"""
+
+import types
+
+co = types.CodeType(0, 0, 0, 0, '\x04\x71\x00\x00', (),
+ (), (), '', '', 1, '')
+exec co
diff --git a/Lib/test/crashers/borrowed_ref_1.py b/Lib/test/crashers/borrowed_ref_1.py
new file mode 100644
index 0000000..d16ede2
--- /dev/null
+++ b/Lib/test/crashers/borrowed_ref_1.py
@@ -0,0 +1,29 @@
+"""
+_PyType_Lookup() returns a borrowed reference.
+This attacks the call in dictobject.c.
+"""
+
+class A(object):
+ pass
+
+class B(object):
+ def __del__(self):
+ print 'hi'
+ del D.__missing__
+
+class D(dict):
+ class __missing__:
+ def __init__(self, *args):
+ pass
+
+
+d = D()
+a = A()
+a.cycle = a
+a.other = B()
+del a
+
+prev = None
+while 1:
+ d[5]
+ prev = (prev,)
diff --git a/Lib/test/crashers/borrowed_ref_2.py b/Lib/test/crashers/borrowed_ref_2.py
new file mode 100644
index 0000000..1a7b3ff
--- /dev/null
+++ b/Lib/test/crashers/borrowed_ref_2.py
@@ -0,0 +1,38 @@
+"""
+_PyType_Lookup() returns a borrowed reference.
+This attacks PyObject_GenericSetAttr().
+
+NB. on my machine this crashes in 2.5 debug but not release.
+"""
+
+class A(object):
+ pass
+
+class B(object):
+ def __del__(self):
+ print "hi"
+ del C.d
+
+class D(object):
+ def __set__(self, obj, value):
+ self.hello = 42
+
+class C(object):
+ d = D()
+
+ def g():
+ pass
+
+
+c = C()
+a = A()
+a.cycle = a
+a.other = B()
+
+lst = [None] * 1000000
+i = 0
+del a
+while 1:
+ c.d = 42 # segfaults in PyMethod_New(im_func=D.__set__, im_self=d)
+ lst[i] = c.g # consume the free list of instancemethod objects
+ i += 1
diff --git a/Lib/test/crashers/coerce.py b/Lib/test/crashers/coerce.py
deleted file mode 100644
index 574956b..0000000
--- a/Lib/test/crashers/coerce.py
+++ /dev/null
@@ -1,9 +0,0 @@
-
-# http://python.org/sf/992017
-
-class foo:
- def __coerce__(self, other):
- return other, self
-
-if __name__ == '__main__':
- foo()+1 # segfault: infinite recursion in C
diff --git a/Lib/test/crashers/gc_inspection.py b/Lib/test/crashers/gc_inspection.py
new file mode 100644
index 0000000..10caa79
--- /dev/null
+++ b/Lib/test/crashers/gc_inspection.py
@@ -0,0 +1,32 @@
+"""
+gc.get_referrers() can be used to see objects before they are fully built.
+
+Note that this is only an example. There are many ways to crash Python
+by using gc.get_referrers(), as well as many extension modules (even
+when they are using perfectly documented patterns to build objects).
+
+Identifying and removing all places that expose to the GC a
+partially-built object is a long-term project. A patch was proposed on
+SF specifically for this example but I consider fixing just this single
+example a bit pointless (#1517042).
+
+A fix would include a whole-scale code review, possibly with an API
+change to decouple object creation and GC registration, and according
+fixes to the documentation for extension module writers. It's unlikely
+to happen, though. So this is currently classified as
+"gc.get_referrers() is dangerous, use only for debugging".
+"""
+
+import gc
+
+
+def g():
+ marker = object()
+ yield marker
+ # now the marker is in the tuple being constructed
+ [tup] = [x for x in gc.get_referrers(marker) if type(x) is tuple]
+ print tup
+ print tup[1]
+
+
+tuple(g())
diff --git a/Lib/test/crashers/infinite_rec_3.py b/Lib/test/crashers/infinite_rec_3.py
deleted file mode 100644
index 0b04e4c..0000000
--- a/Lib/test/crashers/infinite_rec_3.py
+++ /dev/null
@@ -1,9 +0,0 @@
-
-# http://python.org/sf/1202533
-
-class A(object):
- pass
-A.__call__ = A()
-
-if __name__ == '__main__':
- A()() # segfault: infinite recursion in C
diff --git a/Lib/test/crashers/recursion_limit_too_high.py b/Lib/test/crashers/recursion_limit_too_high.py
new file mode 100644
index 0000000..1fa4d32
--- /dev/null
+++ b/Lib/test/crashers/recursion_limit_too_high.py
@@ -0,0 +1,16 @@
+# The following example may crash or not depending on the platform.
+# E.g. on 32-bit Intel Linux in a "standard" configuration it seems to
+# crash on Python 2.5 (but not 2.4 nor 2.3). On Windows the import
+# eventually fails to find the module, possibly because we run out of
+# file handles.
+
+# The point of this example is to show that sys.setrecursionlimit() is a
+# hack, and not a robust solution. This example simply exercices a path
+# where it takes many C-level recursions, consuming a lot of stack
+# space, for each Python-level recursion. So 1000 times this amount of
+# stack space may be too much for standard platforms already.
+
+import sys
+if 'recursion_limit_too_high' in sys.modules:
+ del sys.modules['recursion_limit_too_high']
+import recursion_limit_too_high
diff --git a/Lib/test/crashers/recursive_call.py b/Lib/test/crashers/recursive_call.py
index 0776479..31c8963 100644
--- a/Lib/test/crashers/recursive_call.py
+++ b/Lib/test/crashers/recursive_call.py
@@ -1,6 +1,11 @@
#!/usr/bin/env python
# No bug report AFAIK, mail on python-dev on 2006-01-10
+
+# This is a "won't fix" case. It is known that setting a high enough
+# recursion limit crashes by overflowing the stack. Unless this is
+# redesigned somehow, it won't go away.
+
import sys
sys.setrecursionlimit(1 << 30)
diff --git a/Lib/test/crashers/xml_parsers.py b/Lib/test/crashers/xml_parsers.py
deleted file mode 100644
index e6b5727..0000000
--- a/Lib/test/crashers/xml_parsers.py
+++ /dev/null
@@ -1,56 +0,0 @@
-from xml.parsers import expat
-
-# http://python.org/sf/1296433
-
-def test_parse_only_xml_data():
- #
- xml = "<?xml version='1.0' encoding='iso8859'?><s>%s</s>" % ('a' * 1025)
- # this one doesn't crash
- #xml = "<?xml version='1.0'?><s>%s</s>" % ('a' * 10000)
-
- def handler(text):
- raise Exception
-
- parser = expat.ParserCreate()
- parser.CharacterDataHandler = handler
-
- try:
- parser.Parse(xml)
- except:
- pass
-
-if __name__ == '__main__':
- test_parse_only_xml_data()
-
-# Invalid read of size 4
-# at 0x43F936: PyObject_Free (obmalloc.c:735)
-# by 0x45A7C7: unicode_dealloc (unicodeobject.c:246)
-# by 0x1299021D: PyUnknownEncodingHandler (pyexpat.c:1314)
-# by 0x12993A66: processXmlDecl (xmlparse.c:3330)
-# by 0x12999211: doProlog (xmlparse.c:3678)
-# by 0x1299C3F0: prologInitProcessor (xmlparse.c:3550)
-# by 0x12991EA3: XML_ParseBuffer (xmlparse.c:1562)
-# by 0x1298F8EC: xmlparse_Parse (pyexpat.c:895)
-# by 0x47B3A1: PyEval_EvalFrameEx (ceval.c:3565)
-# by 0x47CCAC: PyEval_EvalCodeEx (ceval.c:2739)
-# by 0x47CDE1: PyEval_EvalCode (ceval.c:490)
-# by 0x499820: PyRun_SimpleFileExFlags (pythonrun.c:1198)
-# by 0x4117F1: Py_Main (main.c:492)
-# by 0x12476D1F: __libc_start_main (in /lib/libc-2.3.5.so)
-# by 0x410DC9: (within /home/neal/build/python/svn/clean/python)
-# Address 0x12704020 is 264 bytes inside a block of size 592 free'd
-# at 0x11B1BA8A: free (vg_replace_malloc.c:235)
-# by 0x124B5F18: (within /lib/libc-2.3.5.so)
-# by 0x48DE43: find_module (import.c:1320)
-# by 0x48E997: import_submodule (import.c:2249)
-# by 0x48EC15: load_next (import.c:2083)
-# by 0x48F091: import_module_ex (import.c:1914)
-# by 0x48F385: PyImport_ImportModuleEx (import.c:1955)
-# by 0x46D070: builtin___import__ (bltinmodule.c:44)
-# by 0x4186CF: PyObject_Call (abstract.c:1777)
-# by 0x474E9B: PyEval_CallObjectWithKeywords (ceval.c:3432)
-# by 0x47928E: PyEval_EvalFrameEx (ceval.c:2038)
-# by 0x47CCAC: PyEval_EvalCodeEx (ceval.c:2739)
-# by 0x47CDE1: PyEval_EvalCode (ceval.c:490)
-# by 0x48D0F7: PyImport_ExecCodeModuleEx (import.c:635)
-# by 0x48D4F4: load_source_module (import.c:913)
diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py
index 5600bdb..7eb55f6 100644
--- a/Lib/test/fork_wait.py
+++ b/Lib/test/fork_wait.py
@@ -34,7 +34,14 @@ class ForkWait(unittest.TestCase):
pass
def wait_impl(self, cpid):
- spid, status = os.waitpid(cpid, 0)
+ for i in range(10):
+ # waitpid() shouldn't hang, but some of the buildbots seem to hang
+ # in the forking tests. This is an attempt to fix the problem.
+ spid, status = os.waitpid(cpid, os.WNOHANG)
+ if spid == cpid:
+ break
+ time.sleep(2 * SHORTSLEEP)
+
self.assertEquals(spid, cpid)
self.assertEquals(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
diff --git a/Lib/test/output/test_ossaudiodev b/Lib/test/output/test_ossaudiodev
index 9f55afa..f0df5d2 100644
--- a/Lib/test/output/test_ossaudiodev
+++ b/Lib/test/output/test_ossaudiodev
@@ -1,3 +1,2 @@
test_ossaudiodev
-playing test sound file...
-elapsed time: 3.1 sec
+playing test sound file (expected running time: 2.93 sec)
diff --git a/Lib/test/output/test_thread b/Lib/test/output/test_thread
index d49651d..68c6a92 100644
--- a/Lib/test/output/test_thread
+++ b/Lib/test/output/test_thread
@@ -4,3 +4,15 @@ all tasks done
*** Barrier Test ***
all tasks done
+
+*** Changing thread stack size ***
+caught expected ValueError setting stack_size(4096)
+successfully set stack_size(262144)
+successfully set stack_size(1048576)
+successfully set stack_size(0)
+trying stack_size = 262144
+waiting for all tasks to complete
+all tasks done
+trying stack_size = 1048576
+waiting for all tasks to complete
+all tasks done
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index ca4a3b5..4553838 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -66,7 +66,9 @@ reports are written to. These parameters all have defaults (5, 4 and
-M runs tests that require an exorbitant amount of memory. These tests
typically try to ascertain containers keep working when containing more than
-2 bilion objects, and only work on 64-bit systems. The passed-in memlimit,
+2 billion objects, which only works on 64-bit systems. There are also some
+tests that try to exhaust the address space of the process, which only makes
+sense on 32-bit systems with at least 2Gb of memory. The passed-in memlimit,
which is a string in the form of '2.5Gb', determines howmuch memory the
tests will limit themselves to (but they may go slightly over.) The number
shouldn't be more memory than the machine has (including swap memory). You
@@ -496,14 +498,30 @@ def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS):
def runtest(test, generate, verbose, quiet, testdir=None, huntrleaks=False):
"""Run a single test.
+
test -- the name of the test
generate -- if true, generate output, instead of running the test
- and comparing it to a previously created output file
+ and comparing it to a previously created output file
verbose -- if true, print more messages
quiet -- if true, don't print 'skipped' messages (probably redundant)
testdir -- test directory
+ huntrleaks -- run multiple times to test for leaks; requires a debug
+ build; a triple corresponding to -R's three arguments
+ Return:
+ -2 test skipped because resource denied
+ -1 test skipped for some other reason
+ 0 test failed
+ 1 test passed
"""
+ try:
+ return runtest_inner(test, generate, verbose, quiet, testdir,
+ huntrleaks)
+ finally:
+ cleanup_test_droppings(test, verbose)
+
+def runtest_inner(test, generate, verbose, quiet,
+ testdir=None, huntrleaks=False):
test_support.unload(test)
if not testdir:
testdir = findtestdir()
@@ -595,6 +613,37 @@ def runtest(test, generate, verbose, quiet, testdir=None, huntrleaks=False):
sys.stdout.flush()
return 0
+def cleanup_test_droppings(testname, verbose):
+ import shutil
+
+ # Try to clean up junk commonly left behind. While tests shouldn't leave
+ # any files or directories behind, when a test fails that can be tedious
+ # for it to arrange. The consequences can be especially nasty on Windows,
+ # since if a test leaves a file open, it cannot be deleted by name (while
+ # there's nothing we can do about that here either, we can display the
+ # name of the offending test, which is a real help).
+ for name in (test_support.TESTFN,
+ "db_home",
+ ):
+ if not os.path.exists(name):
+ continue
+
+ if os.path.isdir(name):
+ kind, nuker = "directory", shutil.rmtree
+ elif os.path.isfile(name):
+ kind, nuker = "file", os.unlink
+ else:
+ raise SystemError("os.path says %r exists but is neither "
+ "directory nor file" % name)
+
+ if verbose:
+ print "%r left behind %s %r" % (testname, kind, name)
+ try:
+ nuker(name)
+ except Exception, msg:
+ print >> sys.stderr, ("%r left behind %s %r and it couldn't be "
+ "removed: %s" % (testname, kind, name, msg))
+
def dash_R(the_module, test, indirect_test, huntrleaks):
# This code is hackish and inelegant, but it seems to do the job.
import copy_reg
@@ -637,7 +686,7 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
def dash_R_cleanup(fs, ps, pic):
import gc, copy_reg
- import _strptime, linecache, warnings, dircache
+ import _strptime, linecache, dircache
import urlparse, urllib, urllib2, mimetypes, doctest
import struct, filecmp
from distutils.dir_util import _path_created
@@ -1227,6 +1276,37 @@ _expectations = {
test_winreg
test_winsound
""",
+ 'netbsd3':
+ """
+ test_aepack
+ test_al
+ test_applesingle
+ test_bsddb
+ test_bsddb185
+ test_bsddb3
+ test_cd
+ test_cl
+ test_ctypes
+ test_curses
+ test_dl
+ test_gdbm
+ test_gl
+ test_imgfile
+ test_linuxaudiodev
+ test_locale
+ test_macfs
+ test_macostools
+ test_nis
+ test_ossaudiodev
+ test_pep277
+ test_sqlite
+ test_startfile
+ test_sunaudiodev
+ test_tcl
+ test_unicode_file
+ test_winreg
+ test_winsound
+ """,
}
_expectations['freebsd5'] = _expectations['freebsd4']
_expectations['freebsd6'] = _expectations['freebsd4']
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py
index aaa2dc2..73447ad 100644
--- a/Lib/test/string_tests.py
+++ b/Lib/test/string_tests.py
@@ -147,8 +147,8 @@ class CommonTest(unittest.TestCase):
else:
r2, rem = len(i)+1, 0
if rem or r1 != r2:
- self.assertEqual(rem, 0)
- self.assertEqual(r1, r2)
+ self.assertEqual(rem, 0, '%s != 0 for %s' % (rem, i))
+ self.assertEqual(r1, r2, '%s != %s for %s' % (r1, r2, i))
def test_find(self):
self.checkequal(0, 'abcdefghiabc', 'find', 'abc')
@@ -636,6 +636,11 @@ class CommonTest(unittest.TestCase):
EQ("bobobXbobob", "bobobobXbobobob", "replace", "bobob", "bob")
EQ("BOBOBOB", "BOBOBOB", "replace", "bob", "bobby")
+ ba = buffer('a')
+ bb = buffer('b')
+ EQ("bbc", "abc", "replace", ba, bb)
+ EQ("aac", "abc", "replace", bb, ba)
+
#
self.checkequal('one@two!three!', 'one!two!three!', 'replace', '!', '@', 1)
self.checkequal('onetwothree', 'one!two!three!', 'replace', '!', '')
@@ -819,6 +824,21 @@ class MixinStrUnicodeUserStringTest:
self.checkraises(TypeError, 'hello', 'startswith')
self.checkraises(TypeError, 'hello', 'startswith', 42)
+ # test tuple arguments
+ self.checkequal(True, 'hello', 'startswith', ('he', 'ha'))
+ self.checkequal(False, 'hello', 'startswith', ('lo', 'llo'))
+ self.checkequal(True, 'hello', 'startswith', ('hellox', 'hello'))
+ self.checkequal(False, 'hello', 'startswith', ())
+ self.checkequal(True, 'helloworld', 'startswith', ('hellowo',
+ 'rld', 'lowo'), 3)
+ self.checkequal(False, 'helloworld', 'startswith', ('hellowo', 'ello',
+ 'rld'), 3)
+ self.checkequal(True, 'hello', 'startswith', ('lo', 'he'), 0, -1)
+ self.checkequal(False, 'hello', 'startswith', ('he', 'hel'), 0, 1)
+ self.checkequal(True, 'hello', 'startswith', ('he', 'hel'), 0, 2)
+
+ self.checkraises(TypeError, 'hello', 'startswith', (42,))
+
def test_endswith(self):
self.checkequal(True, 'hello', 'endswith', 'lo')
self.checkequal(False, 'hello', 'endswith', 'he')
@@ -853,6 +873,21 @@ class MixinStrUnicodeUserStringTest:
self.checkraises(TypeError, 'hello', 'endswith')
self.checkraises(TypeError, 'hello', 'endswith', 42)
+ # test tuple arguments
+ self.checkequal(False, 'hello', 'endswith', ('he', 'ha'))
+ self.checkequal(True, 'hello', 'endswith', ('lo', 'llo'))
+ self.checkequal(True, 'hello', 'endswith', ('hellox', 'hello'))
+ self.checkequal(False, 'hello', 'endswith', ())
+ self.checkequal(True, 'helloworld', 'endswith', ('hellowo',
+ 'rld', 'lowo'), 3)
+ self.checkequal(False, 'helloworld', 'endswith', ('hellowo', 'ello',
+ 'rld'), 3, -1)
+ self.checkequal(True, 'hello', 'endswith', ('hell', 'ell'), 0, -1)
+ self.checkequal(False, 'hello', 'endswith', ('he', 'hel'), 0, 1)
+ self.checkequal(True, 'hello', 'endswith', ('he', 'hell'), 0, 4)
+
+ self.checkraises(TypeError, 'hello', 'endswith', (42,))
+
def test___contains__(self):
self.checkequal(True, '', '__contains__', '') # vereq('' in '', True)
self.checkequal(True, 'abc', '__contains__', '') # vereq('' in 'abc', True)
@@ -872,7 +907,7 @@ class MixinStrUnicodeUserStringTest:
self.checkequal(u'abc', 'abc', '__getitem__', slice(0, 1000))
self.checkequal(u'a', 'abc', '__getitem__', slice(0, 1))
self.checkequal(u'', 'abc', '__getitem__', slice(0, 0))
- # FIXME What about negative indizes? This is handled differently by [] and __getitem__(slice)
+ # FIXME What about negative indices? This is handled differently by [] and __getitem__(slice)
self.checkraises(TypeError, 'abc', '__getitem__', 'def')
@@ -908,6 +943,8 @@ class MixinStrUnicodeUserStringTest:
# test.test_string.StringTest.test_join)
self.checkequal('a b c d', ' ', 'join', ['a', 'b', 'c', 'd'])
self.checkequal('abcd', '', 'join', ('a', 'b', 'c', 'd'))
+ self.checkequal('bd', '', 'join', ('', 'b', '', 'd'))
+ self.checkequal('ac', '', 'join', ('a', '', 'c', ''))
self.checkequal('w x y z', ' ', 'join', Sequence())
self.checkequal('abc', 'a', 'join', ('abc',))
self.checkequal('z', 'a', 'join', UserList(['z']))
diff --git a/Lib/test/test__locale.py b/Lib/test/test__locale.py
index 9799f89..ec59d71 100644
--- a/Lib/test/test__locale.py
+++ b/Lib/test/test__locale.py
@@ -113,6 +113,9 @@ class _LocaleTests(unittest.TestCase):
"using eval('3.14') failed for %s" % loc)
self.assertEquals(int(float('3.14') * 100), 314,
"using float('3.14') failed for %s" % loc)
+ if localeconv()['decimal_point'] != '.':
+ self.assertRaises(ValueError, float,
+ localeconv()['decimal_point'].join(['1', '23']))
def test_main():
run_unittest(_LocaleTests)
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index c64ad28..14fc010 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -160,7 +160,7 @@ exec_results = [
('Module', [('FunctionDef', (1, 0), 'f', ('arguments', [], None, None, []), [('Return', (1, 8), ('Num', (1, 15), 1))], [])]),
('Module', [('Delete', (1, 0), [('Name', (1, 4), 'v', ('Del',))])]),
('Module', [('Assign', (1, 0), [('Name', (1, 0), 'v', ('Store',))], ('Num', (1, 4), 1))]),
-('Module', [('AugAssign', (1, 0), ('Name', (1, 0), 'v', ('Load',)), ('Add',), ('Num', (1, 5), 1))]),
+('Module', [('AugAssign', (1, 0), ('Name', (1, 0), 'v', ('Store',)), ('Add',), ('Num', (1, 5), 1))]),
('Module', [('Print', (1, 0), ('Name', (1, 8), 'f', ('Load',)), [('Num', (1, 11), 1)], False)]),
('Module', [('For', (1, 0), ('Name', (1, 4), 'v', ('Store',)), ('Name', (1, 9), 'v', ('Load',)), [('Pass', (1, 11))], [])]),
('Module', [('While', (1, 0), ('Name', (1, 6), 'v', ('Load',)), [('Pass', (1, 8))], [])]),
diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py
index f93587a..9926167 100644
--- a/Lib/test/test_asynchat.py
+++ b/Lib/test/test_asynchat.py
@@ -13,7 +13,8 @@ class echo_server(threading.Thread):
def run(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- sock.bind((HOST, PORT))
+ global PORT
+ PORT = test_support.bind_port(sock, HOST, PORT)
sock.listen(1)
conn, client = sock.accept()
buffer = ""
diff --git a/Lib/test/test_bigaddrspace.py b/Lib/test/test_bigaddrspace.py
new file mode 100644
index 0000000..8c215fe
--- /dev/null
+++ b/Lib/test/test_bigaddrspace.py
@@ -0,0 +1,46 @@
+from test import test_support
+from test.test_support import bigaddrspacetest, MAX_Py_ssize_t
+
+import unittest
+import operator
+import sys
+
+
+class StrTest(unittest.TestCase):
+
+ @bigaddrspacetest
+ def test_concat(self):
+ s1 = 'x' * MAX_Py_ssize_t
+ self.assertRaises(OverflowError, operator.add, s1, '?')
+
+ @bigaddrspacetest
+ def test_optimized_concat(self):
+ x = 'x' * MAX_Py_ssize_t
+ try:
+ x = x + '?' # this statement uses a fast path in ceval.c
+ except OverflowError:
+ pass
+ else:
+ self.fail("should have raised OverflowError")
+ try:
+ x += '?' # this statement uses a fast path in ceval.c
+ except OverflowError:
+ pass
+ else:
+ self.fail("should have raised OverflowError")
+ self.assertEquals(len(x), MAX_Py_ssize_t)
+
+ ### the following test is pending a patch
+ # (http://mail.python.org/pipermail/python-dev/2006-July/067774.html)
+ #@bigaddrspacetest
+ #def test_repeat(self):
+ # self.assertRaises(OverflowError, operator.mul, 'x', MAX_Py_ssize_t + 1)
+
+
+def test_main():
+ test_support.run_unittest(StrTest)
+
+if __name__ == '__main__':
+ if len(sys.argv) > 1:
+ test_support.set_memlimit(sys.argv[1])
+ test_main()
diff --git a/Lib/test/test_bigmem.py b/Lib/test/test_bigmem.py
index 255428f..6d6c37c 100644
--- a/Lib/test/test_bigmem.py
+++ b/Lib/test/test_bigmem.py
@@ -28,7 +28,7 @@ import sys
# - While the bigmemtest decorator speaks of 'minsize', all tests will
# actually be called with a much smaller number too, in the normal
# test run (5Kb currently.) This is so the tests themselves get frequent
-# testing Consequently, always make all large allocations based on the
+# testing. Consequently, always make all large allocations based on the
# passed-in 'size', and don't rely on the size being very large. Also,
# memuse-per-size should remain sane (less than a few thousand); if your
# test uses more, adjust 'size' upward, instead.
diff --git a/Lib/test/test_bsddb.py b/Lib/test/test_bsddb.py
index 513e541..474f3da 100755
--- a/Lib/test/test_bsddb.py
+++ b/Lib/test/test_bsddb.py
@@ -8,7 +8,6 @@ import bsddb
import dbhash # Just so we know it's imported
import unittest
from test import test_support
-from sets import Set
class TestBSDDB(unittest.TestCase):
openflag = 'c'
@@ -53,7 +52,7 @@ class TestBSDDB(unittest.TestCase):
self.assertEqual(self.f[k], v)
def assertSetEquals(self, seqn1, seqn2):
- self.assertEqual(Set(seqn1), Set(seqn2))
+ self.assertEqual(set(seqn1), set(seqn2))
def test_mapping_iteration_methods(self):
f = self.f
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index e6e4440..c7e4394 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -532,13 +532,24 @@ class BuiltinTest(unittest.TestCase):
@run_with_locale('LC_NUMERIC', 'fr_FR', 'de_DE')
def test_float_with_comma(self):
# set locale to something that doesn't use '.' for the decimal point
+ # float must not accept the locale specific decimal point but
+ # it still has to accept the normal python syntac
import locale
if not locale.localeconv()['decimal_point'] == ',':
return
- self.assertEqual(float(" 3,14 "), 3.14)
- self.assertEqual(float(" +3,14 "), 3.14)
- self.assertEqual(float(" -3,14 "), -3.14)
+ self.assertEqual(float(" 3.14 "), 3.14)
+ self.assertEqual(float("+3.14 "), 3.14)
+ self.assertEqual(float("-3.14 "), -3.14)
+ self.assertEqual(float(".14 "), .14)
+ self.assertEqual(float("3. "), 3.0)
+ self.assertEqual(float("3.e3 "), 3000.0)
+ self.assertEqual(float("3.2e3 "), 3200.0)
+ self.assertEqual(float("2.5e-1 "), 0.25)
+ self.assertEqual(float("5e-1"), 0.5)
+ self.assertRaises(ValueError, float, " 3,14 ")
+ self.assertRaises(ValueError, float, " +3,14 ")
+ self.assertRaises(ValueError, float, " -3,14 ")
self.assertRaises(ValueError, float, " 0x3.1 ")
self.assertRaises(ValueError, float, " -0x3.p-1 ")
self.assertEqual(float(" 25.e-1 "), 2.5)
@@ -603,6 +614,19 @@ class BuiltinTest(unittest.TestCase):
def f(): pass
self.assertRaises(TypeError, hash, [])
self.assertRaises(TypeError, hash, {})
+ # Bug 1536021: Allow hash to return long objects
+ class X:
+ def __hash__(self):
+ return 2**100
+ self.assertEquals(type(hash(X())), int)
+ class Y(object):
+ def __hash__(self):
+ return 2**100
+ self.assertEquals(type(hash(Y())), int)
+ class Z(long):
+ def __hash__(self):
+ return self
+ self.assertEquals(hash(Z(42)), hash(42L))
def test_hex(self):
self.assertEqual(hex(16), '0x10')
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index 356c2e3..f198116 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -250,7 +250,7 @@ class BZ2FileTest(BaseTest):
bz2f = BZ2File(self.filename)
xlines = list(bz2f.readlines())
bz2f.close()
- self.assertEqual(lines, ['Test'])
+ self.assertEqual(xlines, ['Test'])
class BZ2CompressorTest(BaseTest):
@@ -344,6 +344,7 @@ def test_main():
BZ2DecompressorTest,
FuncTest
)
+ test_support.reap_children()
if __name__ == '__main__':
test_main()
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index ec860d1..5e89863 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -87,6 +87,7 @@ class CmdLineTest(unittest.TestCase):
def test_main():
test.test_support.run_unittest(CmdLineTest)
+ test.test_support.reap_children()
if __name__ == "__main__":
test_main()
diff --git a/Lib/test/test_code.py b/Lib/test/test_code.py
index 52bc894..4e68638 100644
--- a/Lib/test/test_code.py
+++ b/Lib/test/test_code.py
@@ -61,6 +61,23 @@ nlocals: 1
flags: 67
consts: ('None',)
+>>> def optimize_away():
+... 'doc string'
+... 'not a docstring'
+... 53
+... 53L
+
+>>> dump(optimize_away.func_code)
+name: optimize_away
+argcount: 0
+names: ()
+varnames: ()
+cellvars: ()
+freevars: ()
+nlocals: 0
+flags: 67
+consts: ("'doc string'", 'None')
+
"""
def consts(t):
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 6ea49cc..8153979 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -1166,6 +1166,12 @@ class BasicUnicodeTest(unittest.TestCase):
encoder = codecs.getencoder(encoding)
self.assertRaises(TypeError, encoder)
+ def test_encoding_map_type_initialized(self):
+ from encodings import cp1140
+ # This used to crash, we are only verifying there's no crash.
+ table_type = type(cp1140.encoding_table)
+ self.assertEqual(table_type, table_type)
+
class BasicStrTest(unittest.TestCase):
def test_basics(self):
s = "abc123"
diff --git a/Lib/test/test_commands.py b/Lib/test/test_commands.py
index 0f7d15f..b72a1b9 100644
--- a/Lib/test/test_commands.py
+++ b/Lib/test/test_commands.py
@@ -5,7 +5,7 @@
import unittest
import os, tempfile, re
-from test.test_support import TestSkipped, run_unittest
+from test.test_support import TestSkipped, run_unittest, reap_children
from commands import *
# The module says:
@@ -58,6 +58,7 @@ class CommandTests(unittest.TestCase):
def test_main():
run_unittest(CommandTests)
+ reap_children()
if __name__ == "__main__":
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 72c4f7e..a3f15bf 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -166,6 +166,16 @@ if 1:
pass"""
compile(s, "<string>", "exec")
+ # This test is probably specific to CPython and may not generalize
+ # to other implementations. We are trying to ensure that when
+ # the first line of code starts after 256, correct line numbers
+ # in tracebacks are still produced.
+ def test_leading_newlines(self):
+ s256 = "".join(["\n"] * 256 + ["spam"])
+ co = compile(s256, 'fn', 'exec')
+ self.assertEqual(co.co_firstlineno, 257)
+ self.assertEqual(co.co_lnotab, '')
+
def test_literals_with_leading_zeroes(self):
for arg in ["077787", "0xj", "0x.", "0e", "090000000000000",
"080000000000000", "000000000000009", "000000000000008"]:
@@ -211,6 +221,25 @@ if 1:
self.assertEqual(eval("-" + all_one_bits), -18446744073709551615L)
else:
self.fail("How many bits *does* this machine have???")
+ # Verify treatment of contant folding on -(sys.maxint+1)
+ # i.e. -2147483648 on 32 bit platforms. Should return int, not long.
+ self.assertTrue(isinstance(eval("%s" % (-sys.maxint - 1)), int))
+ self.assertTrue(isinstance(eval("%s" % (-sys.maxint - 2)), long))
+
+ if sys.maxint == 9223372036854775807:
+ def test_32_63_bit_values(self):
+ a = +4294967296 # 1 << 32
+ b = -4294967296 # 1 << 32
+ c = +281474976710656 # 1 << 48
+ d = -281474976710656 # 1 << 48
+ e = +4611686018427387904 # 1 << 62
+ f = -4611686018427387904 # 1 << 62
+ g = +9223372036854775807 # 1 << 63 - 1
+ h = -9223372036854775807 # 1 << 63 - 1
+
+ for variable in self.test_32_63_bit_values.func_code.co_consts:
+ if variable is not None:
+ self.assertTrue(isinstance(variable, int))
def test_sequence_unpacking_error(self):
# Verify sequence packing/unpacking with "or". SF bug #757818
@@ -238,6 +267,8 @@ if 1:
succeed = [
'import sys',
'import os, sys',
+ 'import os as bar',
+ 'import os.path as bar',
'from __future__ import nested_scopes, generators',
'from __future__ import (nested_scopes,\ngenerators)',
'from __future__ import (nested_scopes,\ngenerators,)',
@@ -257,6 +288,10 @@ if 1:
'import (sys',
'import sys)',
'import (os,)',
+ 'import os As bar',
+ 'import os.path a bar',
+ 'from sys import stdin As stdout',
+ 'from sys import stdin a stdout',
'from (sys) import stdin',
'from __future__ import (nested_scopes',
'from __future__ import nested_scopes)',
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py
index 48f1643..1efb6a6 100644
--- a/Lib/test/test_compiler.py
+++ b/Lib/test/test_compiler.py
@@ -56,13 +56,30 @@ class CompilerTest(unittest.TestCase):
def testYieldExpr(self):
compiler.compile("def g(): yield\n\n", "<string>", "exec")
+ def testTryExceptFinally(self):
+ # Test that except and finally clauses in one try stmt are recognized
+ c = compiler.compile("try:\n 1/0\nexcept:\n e = 1\nfinally:\n f = 1",
+ "<string>", "exec")
+ dct = {}
+ exec c in dct
+ self.assertEquals(dct.get('e'), 1)
+ self.assertEquals(dct.get('f'), 1)
+
def testDefaultArgs(self):
self.assertRaises(SyntaxError, compiler.parse, "def foo(a=1, b): pass")
+ def testDocstrings(self):
+ c = compiler.compile('"doc"', '<string>', 'exec')
+ self.assert_('__doc__' in c.co_names)
+ c = compiler.compile('def f():\n "doc"', '<string>', 'exec')
+ g = {}
+ exec c in g
+ self.assertEquals(g['f'].__doc__, "doc")
+
def testLineNo(self):
# Test that all nodes except Module have a correct lineno attribute.
filename = __file__
- if filename.endswith(".pyc") or filename.endswith(".pyo"):
+ if filename.endswith((".pyc", ".pyo")):
filename = filename[:-1]
tree = compiler.parseFile(filename)
self.check_lineno(tree)
@@ -87,6 +104,19 @@ class CompilerTest(unittest.TestCase):
self.assertEquals(flatten([1, [2]]), [1, 2])
self.assertEquals(flatten((1, (2,))), [1, 2])
+ def testNestedScope(self):
+ c = compiler.compile('def g():\n'
+ ' a = 1\n'
+ ' def f(): return a + 2\n'
+ ' return f()\n'
+ 'result = g()',
+ '<string>',
+ 'exec')
+ dct = {}
+ exec c in dct
+ self.assertEquals(dct.get('result'), 3)
+
+
NOLINENO = (compiler.ast.Module, compiler.ast.Stmt, compiler.ast.Discard)
###############################################################################
@@ -103,6 +133,12 @@ a, b = 2, 3
l = [(x, y) for x, y in zip(range(5), range(5,10))]
l[0]
l[3:4]
+d = {'a': 2}
+d = {}
+t = ()
+t = (1, 2)
+l = []
+l = [1, 2]
if l:
pass
else:
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index dc2f20b..4022149 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -212,6 +212,13 @@ def module_funcs(stdscr):
m = curses.getmouse()
curses.ungetmouse(*m)
+ if hasattr(curses, 'is_term_resized'):
+ curses.is_term_resized(*stdscr.getmaxyx())
+ if hasattr(curses, 'resizeterm'):
+ curses.resizeterm(*stdscr.getmaxyx())
+ if hasattr(curses, 'resize_term'):
+ curses.resize_term(*stdscr.getmaxyx())
+
def unit_tests():
from curses import ascii
for ch, expected in [('a', 'a'), ('A', 'A'),
diff --git a/Lib/test/test_defaultdict.py b/Lib/test/test_defaultdict.py
index b5a6628..134b5a8 100644
--- a/Lib/test/test_defaultdict.py
+++ b/Lib/test/test_defaultdict.py
@@ -4,6 +4,7 @@ import os
import copy
import tempfile
import unittest
+from test import test_support
from collections import defaultdict
@@ -131,5 +132,8 @@ class TestDefaultDict(unittest.TestCase):
self.assertEqual(d2, d1)
+def test_main():
+ test_support.run_unittest(TestDefaultDict)
+
if __name__ == "__main__":
- unittest.main()
+ test_main()
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 8ee431b..4a39be5 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1899,6 +1899,16 @@ def properties():
prop2 = property(fset=setter)
vereq(prop2.__doc__, None)
+ # this segfaulted in 2.5b2
+ try:
+ import _testcapi
+ except ImportError:
+ pass
+ else:
+ class X(object):
+ p = property(_testcapi.test_with_docstring)
+
+
def supers():
if verbose: print "Testing super..."
@@ -3046,6 +3056,21 @@ def kwdargs():
list.__init__(a, sequence=[0, 1, 2])
vereq(a, [0, 1, 2])
+def recursive__call__():
+ if verbose: print ("Testing recursive __call__() by setting to instance of "
+ "class ...")
+ class A(object):
+ pass
+
+ A.__call__ = A()
+ try:
+ A()()
+ except RuntimeError:
+ pass
+ else:
+ raise TestFailed("Recursion limit should have been reached for "
+ "__call__()")
+
def delhook():
if verbose: print "Testing __del__ hook..."
log = []
@@ -3803,6 +3828,13 @@ def weakref_segfault():
o.whatever = Provoker(o)
del o
+def wrapper_segfault():
+ # SF 927248: deeply nested wrappers could cause stack overflow
+ f = lambda:None
+ for i in xrange(1000000):
+ f = f.__call__
+ f = None
+
# Fix SF #762455, segfault when sys.stdout is changed in getattr
def filefault():
if verbose:
@@ -3957,6 +3989,7 @@ def notimplemented():
def test_main():
weakref_segfault() # Must be first, somehow
+ wrapper_segfault()
do_this_first()
class_docstrings()
lists()
@@ -4015,6 +4048,7 @@ def test_main():
buffer_inherit()
str_of_str_subclass()
kwdargs()
+ recursive__call__()
delhook()
hashinherit()
strops()
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index 081941d..c31092c 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -81,6 +81,13 @@ dis_bug1333982 = """\
bug1333982.func_code.co_firstlineno + 2,
bug1333982.func_code.co_firstlineno + 3)
+_BIG_LINENO_FORMAT = """\
+%3d 0 LOAD_GLOBAL 0 (spam)
+ 3 POP_TOP
+ 4 LOAD_CONST 0 (None)
+ 7 RETURN_VALUE
+"""
+
class DisTests(unittest.TestCase):
def do_disassembly_test(self, func, expected):
s = StringIO.StringIO()
@@ -124,6 +131,23 @@ class DisTests(unittest.TestCase):
if __debug__:
self.do_disassembly_test(bug1333982, dis_bug1333982)
+ def test_big_linenos(self):
+ def func(count):
+ namespace = {}
+ func = "def foo():\n " + "".join(["\n "] * count + ["spam\n"])
+ exec func in namespace
+ return namespace['foo']
+
+ # Test all small ranges
+ for i in xrange(1, 300):
+ expected = _BIG_LINENO_FORMAT % (i + 2)
+ self.do_disassembly_test(func(i), expected)
+
+ # Test some larger ranges too
+ for i in xrange(300, 5000, 10):
+ expected = _BIG_LINENO_FORMAT % (i + 2)
+ self.do_disassembly_test(func(i), expected)
+
def test_main():
run_unittest(DisTests)
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 01f7acd..e8379c5 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -419,7 +419,6 @@ methods, classmethods, staticmethods, properties, and nested classes.
>>> finder = doctest.DocTestFinder()
>>> tests = finder.find(SampleClass)
- >>> tests.sort()
>>> for t in tests:
... print '%2s %s' % (len(t.examples), t.name)
3 SampleClass
@@ -435,7 +434,6 @@ methods, classmethods, staticmethods, properties, and nested classes.
New-style classes are also supported:
>>> tests = finder.find(SampleNewStyleClass)
- >>> tests.sort()
>>> for t in tests:
... print '%2s %s' % (len(t.examples), t.name)
1 SampleNewStyleClass
@@ -475,7 +473,6 @@ functions, classes, and the `__test__` dictionary, if it exists:
>>> # ignoring the objects since they weren't defined in m.
>>> import test.test_doctest
>>> tests = finder.find(m, module=test.test_doctest)
- >>> tests.sort()
>>> for t in tests:
... print '%2s %s' % (len(t.examples), t.name)
1 some_module
@@ -499,7 +496,6 @@ will only be generated for it once:
>>> from test import doctest_aliases
>>> tests = excl_empty_finder.find(doctest_aliases)
- >>> tests.sort()
>>> print len(tests)
2
>>> print tests[0].name
@@ -517,7 +513,6 @@ Empty Tests
By default, an object with no doctests doesn't create any tests:
>>> tests = doctest.DocTestFinder().find(SampleClass)
- >>> tests.sort()
>>> for t in tests:
... print '%2s %s' % (len(t.examples), t.name)
3 SampleClass
@@ -536,7 +531,6 @@ is really to support backward compatibility in what doctest.master.summarize()
displays.
>>> tests = doctest.DocTestFinder(exclude_empty=False).find(SampleClass)
- >>> tests.sort()
>>> for t in tests:
... print '%2s %s' % (len(t.examples), t.name)
3 SampleClass
@@ -557,7 +551,6 @@ DocTestFinder can be told not to look for tests in contained objects
using the `recurse` flag:
>>> tests = doctest.DocTestFinder(recurse=False).find(SampleClass)
- >>> tests.sort()
>>> for t in tests:
... print '%2s %s' % (len(t.examples), t.name)
3 SampleClass
diff --git a/Lib/test/test_email_codecs.py b/Lib/test/test_email_codecs.py
index aadd537..c550a6f 100644
--- a/Lib/test/test_email_codecs.py
+++ b/Lib/test/test_email_codecs.py
@@ -1,11 +1,15 @@
# Copyright (C) 2002 Python Software Foundation
# email package unit tests for (optional) Asian codecs
-import unittest
# The specific tests now live in Lib/email/test
-from email.test.test_email_codecs import suite
+from email.test import test_email_codecs
+from email.test import test_email_codecs_renamed
+from test import test_support
+def test_main():
+ suite = test_email_codecs.suite()
+ suite.addTest(test_email_codecs_renamed.suite())
+ test_support.run_suite(suite)
-
if __name__ == '__main__':
- unittest.main(defaultTest='suite')
+ test_main()
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index ebe60c1..be2cca1 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -314,6 +314,18 @@ class ExceptionTests(unittest.TestCase):
x = DerivedException(fancy_arg=42)
self.assertEquals(x.fancy_arg, 42)
+ def testInfiniteRecursion(self):
+ def f():
+ return f()
+ self.assertRaises(RuntimeError, f)
+
+ def g():
+ try:
+ return g()
+ except ValueError:
+ return -1
+ self.assertRaises(RuntimeError, g)
+
def test_main():
run_unittest(ExceptionTests)
diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py
index f53b13a..58a57b5 100755
--- a/Lib/test/test_fcntl.py
+++ b/Lib/test/test_fcntl.py
@@ -20,9 +20,10 @@ else:
if sys.platform.startswith('atheos'):
start_len = "qq"
-if sys.platform in ('netbsd1', 'netbsd2', 'Darwin1.2', 'darwin',
- 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5', 'freebsd6',
- 'freebsd7',
+if sys.platform in ('netbsd1', 'netbsd2', 'netbsd3',
+ 'Darwin1.2', 'darwin',
+ 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5',
+ 'freebsd6', 'freebsd7',
'bsdos2', 'bsdos3', 'bsdos4',
'openbsd', 'openbsd2', 'openbsd3'):
if struct.calcsize('l') == 8:
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py
index dcfa265..234920d 100644
--- a/Lib/test/test_file.py
+++ b/Lib/test/test_file.py
@@ -11,14 +11,12 @@ class AutoFileTests(unittest.TestCase):
# file tests for which a test file is automatically set up
def setUp(self):
- self.f = file(TESTFN, 'wb')
+ self.f = open(TESTFN, 'wb')
def tearDown(self):
- try:
- if self.f:
- self.f.close()
- except IOError:
- pass
+ if self.f:
+ self.f.close()
+ os.remove(TESTFN)
def testWeakRefs(self):
# verify weak references
@@ -80,9 +78,11 @@ class AutoFileTests(unittest.TestCase):
def testWritelinesNonString(self):
# verify writelines with non-string object
- class NonString: pass
+ class NonString:
+ pass
- self.assertRaises(TypeError, self.f.writelines, [NonString(), NonString()])
+ self.assertRaises(TypeError, self.f.writelines,
+ [NonString(), NonString()])
def testRepr(self):
# verify repr works
@@ -93,19 +93,21 @@ class AutoFileTests(unittest.TestCase):
self.assertEquals(f.name, TESTFN)
self.assert_(not f.isatty())
self.assert_(not f.closed)
-
+
self.assertRaises(TypeError, f.readinto, "")
f.close()
self.assert_(f.closed)
def testMethods(self):
methods = ['fileno', 'flush', 'isatty', 'next', 'read', 'readinto',
- 'readline', 'readlines', 'seek', 'tell', 'truncate', 'write',
- '__iter__']
+ 'readline', 'readlines', 'seek', 'tell', 'truncate',
+ 'write', '__iter__']
if sys.platform.startswith('atheos'):
methods.remove('truncate')
- self.f.close()
+ # __exit__ should close the file
+ self.f.__exit__(None, None, None)
+ self.assert_(self.f.closed)
for methodname in methods:
method = getattr(self.f, methodname)
@@ -113,6 +115,14 @@ class AutoFileTests(unittest.TestCase):
self.assertRaises(ValueError, method)
self.assertRaises(ValueError, self.f.writelines, [])
+ # file is closed, __exit__ shouldn't do anything
+ self.assertEquals(self.f.__exit__(None, None, None), None)
+ # it must also return None if an exception was given
+ try:
+ 1/0
+ except:
+ self.assertEquals(self.f.__exit__(*sys.exc_info()), None)
+
class OtherFileTests(unittest.TestCase):
@@ -120,7 +130,7 @@ class OtherFileTests(unittest.TestCase):
# check invalid mode strings
for mode in ("", "aU", "wU+"):
try:
- f = file(TESTFN, mode)
+ f = open(TESTFN, mode)
except ValueError:
pass
else:
@@ -142,6 +152,7 @@ class OtherFileTests(unittest.TestCase):
f = open(unicode(TESTFN), "w")
self.assert_(repr(f).startswith("<open file u'" + TESTFN))
f.close()
+ os.unlink(TESTFN)
def testBadModeArgument(self):
# verify that we get a sensible error message for bad mode argument
@@ -182,11 +193,11 @@ class OtherFileTests(unittest.TestCase):
def bug801631():
# SF bug <http://www.python.org/sf/801631>
# "file.truncate fault on windows"
- f = file(TESTFN, 'wb')
+ f = open(TESTFN, 'wb')
f.write('12345678901') # 11 bytes
f.close()
- f = file(TESTFN,'rb+')
+ f = open(TESTFN,'rb+')
data = f.read(5)
if data != '12345':
self.fail("Read on file opened for update failed %r" % data)
@@ -208,14 +219,14 @@ class OtherFileTests(unittest.TestCase):
os.unlink(TESTFN)
def testIteration(self):
- # Test the complex interaction when mixing file-iteration and the various
- # read* methods. Ostensibly, the mixture could just be tested to work
- # when it should work according to the Python language, instead of fail
- # when it should fail according to the current CPython implementation.
- # People don't always program Python the way they should, though, and the
- # implemenation might change in subtle ways, so we explicitly test for
- # errors, too; the test will just have to be updated when the
- # implementation changes.
+ # Test the complex interaction when mixing file-iteration and the
+ # various read* methods. Ostensibly, the mixture could just be tested
+ # to work when it should work according to the Python language,
+ # instead of fail when it should fail according to the current CPython
+ # implementation. People don't always program Python the way they
+ # should, though, and the implemenation might change in subtle ways,
+ # so we explicitly test for errors, too; the test will just have to
+ # be updated when the implementation changes.
dataoffset = 16384
filler = "ham\n"
assert not dataoffset % len(filler), \
@@ -253,12 +264,13 @@ class OtherFileTests(unittest.TestCase):
(methodname, args))
f.close()
- # Test to see if harmless (by accident) mixing of read* and iteration
- # still works. This depends on the size of the internal iteration
- # buffer (currently 8192,) but we can test it in a flexible manner.
- # Each line in the bag o' ham is 4 bytes ("h", "a", "m", "\n"), so
- # 4096 lines of that should get us exactly on the buffer boundary for
- # any power-of-2 buffersize between 4 and 16384 (inclusive).
+ # Test to see if harmless (by accident) mixing of read* and
+ # iteration still works. This depends on the size of the internal
+ # iteration buffer (currently 8192,) but we can test it in a
+ # flexible manner. Each line in the bag o' ham is 4 bytes
+ # ("h", "a", "m", "\n"), so 4096 lines of that should get us
+ # exactly on the buffer boundary for any power-of-2 buffersize
+ # between 4 and 16384 (inclusive).
f = open(TESTFN, 'rb')
for i in range(nchunks):
f.next()
@@ -319,7 +331,13 @@ class OtherFileTests(unittest.TestCase):
def test_main():
- run_unittest(AutoFileTests, OtherFileTests)
+ # Historically, these tests have been sloppy about removing TESTFN.
+ # So get rid of it no matter what.
+ try:
+ run_unittest(AutoFileTests, OtherFileTests)
+ finally:
+ if os.path.exists(TESTFN):
+ os.unlink(TESTFN)
if __name__ == '__main__':
test_main()
diff --git a/Lib/test/test_filecmp.py b/Lib/test/test_filecmp.py
index c54119c..503562b 100644
--- a/Lib/test/test_filecmp.py
+++ b/Lib/test/test_filecmp.py
@@ -1,5 +1,5 @@
-import os, filecmp, shutil, tempfile
+import os, filecmp, shutil, tempfile, shutil
import unittest
from test import test_support
@@ -49,6 +49,7 @@ class DirCompareTestCase(unittest.TestCase):
self.caseinsensitive = os.path.normcase('A') == os.path.normcase('a')
data = 'Contents of file go here.\n'
for dir in [self.dir, self.dir_same, self.dir_diff]:
+ shutil.rmtree(dir, True)
os.mkdir(dir)
if self.caseinsensitive and dir is self.dir_same:
fn = 'FiLe' # Verify case-insensitive comparison
diff --git a/Lib/test/test_fork1.py b/Lib/test/test_fork1.py
index cba5fc7..e64e398 100644
--- a/Lib/test/test_fork1.py
+++ b/Lib/test/test_fork1.py
@@ -2,8 +2,9 @@
"""
import os
+import time
from test.fork_wait import ForkWait
-from test.test_support import TestSkipped, run_unittest
+from test.test_support import TestSkipped, run_unittest, reap_children
try:
os.fork
@@ -12,12 +13,20 @@ except AttributeError:
class ForkTest(ForkWait):
def wait_impl(self, cpid):
- spid, status = os.waitpid(cpid, 0)
+ for i in range(10):
+ # waitpid() shouldn't hang, but some of the buildbots seem to hang
+ # in the forking tests. This is an attempt to fix the problem.
+ spid, status = os.waitpid(cpid, os.WNOHANG)
+ if spid == cpid:
+ break
+ time.sleep(1.0)
+
self.assertEqual(spid, cpid)
self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
def test_main():
run_unittest(ForkTest)
+ reap_children()
if __name__ == "__main__":
test_main()
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index a184a8b..ee36413 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -1497,22 +1497,55 @@ And a more sane, but still weird usage:
<type 'generator'>
+A yield expression with augmented assignment.
+
+>>> def coroutine(seq):
+... count = 0
+... while count < 200:
+... count += yield
+... seq.append(count)
+>>> seq = []
+>>> c = coroutine(seq)
+>>> c.next()
+>>> print seq
+[]
+>>> c.send(10)
+>>> print seq
+[10]
+>>> c.send(10)
+>>> print seq
+[10, 20]
+>>> c.send(10)
+>>> print seq
+[10, 20, 30]
+
+
Check some syntax errors for yield expressions:
>>> f=lambda: (yield 1),(yield 2)
Traceback (most recent call last):
...
-SyntaxError: 'yield' outside function (<doctest test.test_generators.__test__.coroutine[10]>, line 1)
+SyntaxError: 'yield' outside function (<doctest test.test_generators.__test__.coroutine[21]>, line 1)
>>> def f(): return lambda x=(yield): 1
Traceback (most recent call last):
...
-SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.__test__.coroutine[11]>, line 1)
+SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.__test__.coroutine[22]>, line 1)
>>> def f(): x = yield = y
Traceback (most recent call last):
...
-SyntaxError: assignment to yield expression not possible (<doctest test.test_generators.__test__.coroutine[12]>, line 1)
+SyntaxError: assignment to yield expression not possible (<doctest test.test_generators.__test__.coroutine[23]>, line 1)
+
+>>> def f(): (yield bar) = y
+Traceback (most recent call last):
+ ...
+SyntaxError: can't assign to yield expression (<doctest test.test_generators.__test__.coroutine[24]>, line 1)
+
+>>> def f(): (yield bar) += y
+Traceback (most recent call last):
+ ...
+SyntaxError: augmented assignment to yield expression not possible (<doctest test.test_generators.__test__.coroutine[25]>, line 1)
Now check some throw() conditions:
diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py
index e414757..2598a79 100644
--- a/Lib/test/test_genexps.py
+++ b/Lib/test/test_genexps.py
@@ -109,7 +109,7 @@ for iterability
Traceback (most recent call last):
File "<pyshell#4>", line 1, in -toplevel-
(i for i in 6)
- TypeError: iteration over non-sequence
+ TypeError: 'int' object is not iterable
Verify late binding for the outermost if-expression
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index 8864e8e..c428f45 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -233,8 +233,25 @@ class LongLong_TestCase(unittest.TestCase):
self.failUnlessEqual(VERY_LARGE & ULLONG_MAX, getargs_K(VERY_LARGE))
+
+class Tuple_TestCase(unittest.TestCase):
+ def test_tuple(self):
+ from _testcapi import getargs_tuple
+
+ ret = getargs_tuple(1, (2, 3))
+ self.assertEquals(ret, (1,2,3))
+
+ # make sure invalid tuple arguments are handled correctly
+ class seq:
+ def __len__(self):
+ return 2
+ def __getitem__(self, n):
+ raise ValueError
+ self.assertRaises(TypeError, getargs_tuple, 1, seq())
+
+
def test_main():
- tests = [Signed_TestCase, Unsigned_TestCase]
+ tests = [Signed_TestCase, Unsigned_TestCase, Tuple_TestCase]
try:
from _testcapi import getargs_L, getargs_K
except ImportError:
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py
index 4bb4e45..f160867 100644
--- a/Lib/test/test_grammar.py
+++ b/Lib/test/test_grammar.py
@@ -531,6 +531,11 @@ n = 0
for x in Squares(10): n = n+x
if n != 285: raise TestFailed, 'for over growing sequence'
+result = []
+for x, in [(1,), (2,), (3,)]:
+ result.append(x)
+vereq(result, [1, 2, 3])
+
print 'try_stmt'
### try_stmt: 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite]
### | 'try' ':' suite 'finally' ':' suite
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index d9fd93d..99140d2 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -1,6 +1,8 @@
import sys
+import types
import unittest
import inspect
+import datetime
from test.test_support import TESTFN, run_unittest
@@ -15,7 +17,7 @@ from test import inspect_fodder2 as mod2
# isdatadescriptor
modfile = mod.__file__
-if modfile.endswith('c') or modfile.endswith('o'):
+if modfile.endswith(('c', 'o')):
modfile = modfile[:-1]
import __builtin__
@@ -40,10 +42,12 @@ class IsTestBase(unittest.TestCase):
self.failIf(other(obj), 'not %s(%s)' % (other.__name__, exp))
class TestPredicates(IsTestBase):
- def test_eleven(self):
- # Doc/lib/libinspect.tex claims there are 11 such functions
+ def test_thirteen(self):
count = len(filter(lambda x:x.startswith('is'), dir(inspect)))
- self.assertEqual(count, 11, "There are %d (not 11) is* functions" % count)
+ # Doc/lib/libinspect.tex claims there are 13 such functions
+ expected = 13
+ err_msg = "There are %d (not %d) is* functions" % (count, expected)
+ self.assertEqual(count, expected, err_msg)
def test_excluding_predicates(self):
self.istest(inspect.isbuiltin, 'sys.exit')
@@ -58,6 +62,15 @@ class TestPredicates(IsTestBase):
self.istest(inspect.istraceback, 'tb')
self.istest(inspect.isdatadescriptor, '__builtin__.file.closed')
self.istest(inspect.isdatadescriptor, '__builtin__.file.softspace')
+ if hasattr(types, 'GetSetDescriptorType'):
+ self.istest(inspect.isgetsetdescriptor,
+ 'type(tb.tb_frame).f_locals')
+ else:
+ self.failIf(inspect.isgetsetdescriptor(type(tb.tb_frame).f_locals))
+ if hasattr(types, 'MemberDescriptorType'):
+ self.istest(inspect.ismemberdescriptor, 'datetime.timedelta.days')
+ else:
+ self.failIf(inspect.ismemberdescriptor(datetime.timedelta.days))
def test_isroutine(self):
self.assert_(inspect.isroutine(mod.spam))
@@ -180,6 +193,17 @@ class TestRetrievingSourceCode(GetSourceBase):
def test_getfile(self):
self.assertEqual(inspect.getfile(mod.StupidGit), mod.__file__)
+ def test_getmodule_recursion(self):
+ from new import module
+ name = '__inspect_dummy'
+ m = sys.modules[name] = module(name)
+ m.__file__ = "<string>" # hopefully not a real filename...
+ m.__loader__ = "dummy" # pretend the filename is understood by a loader
+ exec "def x(): pass" in m.__dict__
+ self.assertEqual(inspect.getsourcefile(m.x.func_code), '<string>')
+ del sys.modules[name]
+ inspect.getmodule(compile('a=10','','single'))
+
class TestDecorators(GetSourceBase):
fodderFile = mod2
diff --git a/Lib/test/test_iterlen.py b/Lib/test/test_iterlen.py
index bcd0a6f..af4467e 100644
--- a/Lib/test/test_iterlen.py
+++ b/Lib/test/test_iterlen.py
@@ -235,9 +235,7 @@ class TestSeqIterReversed(TestInvariantWithoutMutations):
self.assertEqual(len(it), 0)
-
-if __name__ == "__main__":
-
+def test_main():
unittests = [
TestRepeat,
TestXrange,
@@ -255,3 +253,6 @@ if __name__ == "__main__":
TestSeqIterReversed,
]
test_support.run_unittest(*unittests)
+
+if __name__ == "__main__":
+ test_main()
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 73f8288..68c23c2 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -480,6 +480,8 @@ def test4():
f.close()
try:
logging.config.fileConfig(fn)
+ #call again to make sure cleanup is correct
+ logging.config.fileConfig(fn)
except:
t = sys.exc_info()[0]
message(str(t))
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
index 914a20c..45dd118 100644
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -461,7 +461,7 @@ class TestMaildir(TestMailbox):
def setUp(self):
TestMailbox.setUp(self)
- if os.name == 'nt':
+ if os.name in ('nt', 'os2'):
self._box.colon = '!'
def test_add_MM(self):
@@ -520,7 +520,7 @@ class TestMaildir(TestMailbox):
# Initialize an existing mailbox
self.tearDown()
for subdir in '', 'tmp', 'new', 'cur':
- os.mkdir(os.path.join(self._path, subdir))
+ os.mkdir(os.path.normpath(os.path.join(self._path, subdir)))
self._box = mailbox.Maildir(self._path)
self._check_basics(factory=rfc822.Message)
self._box = mailbox.Maildir(self._path, factory=None)
@@ -720,6 +720,30 @@ class _TestMboxMMDF(TestMailbox):
self.assert_(contents == open(self._path, 'rb').read())
self._box = self._factory(self._path)
+ def test_lock_conflict(self):
+ # Fork off a subprocess that will lock the file for 2 seconds,
+ # unlock it, and then exit.
+ if not hasattr(os, 'fork'):
+ return
+ pid = os.fork()
+ if pid == 0:
+ # In the child, lock the mailbox.
+ self._box.lock()
+ time.sleep(2)
+ self._box.unlock()
+ os._exit(0)
+
+ # In the parent, sleep a bit to give the child time to acquire
+ # the lock.
+ time.sleep(0.5)
+ self.assertRaises(mailbox.ExternalClashError,
+ self._box.lock)
+
+ # Wait for child to exit. Locking should now succeed.
+ exited_pid, status = os.waitpid(pid, 0)
+ self._box.lock()
+ self._box.unlock()
+
class TestMbox(_TestMboxMMDF):
@@ -1761,6 +1785,7 @@ def test_main():
TestMessageConversion, TestProxyFile, TestPartialFile,
MaildirTestCase)
test_support.run_unittest(*tests)
+ test_support.reap_children()
if __name__ == '__main__':
diff --git a/Lib/test/test_mimetools.py b/Lib/test/test_mimetools.py
index 96bbb36..b0b5b01 100644
--- a/Lib/test/test_mimetools.py
+++ b/Lib/test/test_mimetools.py
@@ -1,7 +1,7 @@
import unittest
from test import test_support
-import string, StringIO, mimetools, sets
+import string, StringIO, mimetools
msgtext1 = mimetools.Message(StringIO.StringIO(
"""Content-Type: text/plain; charset=iso-8859-1; format=flowed
@@ -25,7 +25,7 @@ class MimeToolsTest(unittest.TestCase):
self.assertEqual(o.getvalue(), start)
def test_boundary(self):
- s = sets.Set([""])
+ s = set([""])
for i in xrange(100):
nb = mimetools.choose_boundary()
self.assert_(nb not in s)
diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py
index 8c584ad..0190c2f 100644
--- a/Lib/test/test_mimetypes.py
+++ b/Lib/test/test_mimetypes.py
@@ -1,7 +1,6 @@
import mimetypes
import StringIO
import unittest
-from sets import Set
from test import test_support
@@ -52,8 +51,8 @@ class MimeTypesTestCase(unittest.TestCase):
# First try strict. Use a set here for testing the results because if
# test_urllib2 is run before test_mimetypes, global state is modified
# such that the 'all' set will have more items in it.
- all = Set(self.db.guess_all_extensions('text/plain', strict=True))
- unless(all >= Set(['.bat', '.c', '.h', '.ksh', '.pl', '.txt']))
+ all = set(self.db.guess_all_extensions('text/plain', strict=True))
+ unless(all >= set(['.bat', '.c', '.h', '.ksh', '.pl', '.txt']))
# And now non-strict
all = self.db.guess_all_extensions('image/jpg', strict=False)
all.sort()
diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
index b9377ae..a6d309f 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -1,4 +1,4 @@
-# test for xmlcore.dom.minidom
+# test for xml.dom.minidom
import os
import sys
@@ -7,12 +7,12 @@ import traceback
from StringIO import StringIO
from test.test_support import verbose
-import xmlcore.dom
-import xmlcore.dom.minidom
-import xmlcore.parsers.expat
+import xml.dom
+import xml.dom.minidom
+import xml.parsers.expat
-from xmlcore.dom.minidom import parse, Node, Document, parseString
-from xmlcore.dom.minidom import getDOMImplementation
+from xml.dom.minidom import parse, Node, Document, parseString
+from xml.dom.minidom import getDOMImplementation
if __name__ == "__main__":
@@ -138,29 +138,29 @@ def testLegalChildren():
text = dom.createTextNode('text')
try: dom.appendChild(text)
- except xmlcore.dom.HierarchyRequestErr: pass
+ except xml.dom.HierarchyRequestErr: pass
else:
print "dom.appendChild didn't raise HierarchyRequestErr"
dom.appendChild(elem)
try: dom.insertBefore(text, elem)
- except xmlcore.dom.HierarchyRequestErr: pass
+ except xml.dom.HierarchyRequestErr: pass
else:
print "dom.appendChild didn't raise HierarchyRequestErr"
try: dom.replaceChild(text, elem)
- except xmlcore.dom.HierarchyRequestErr: pass
+ except xml.dom.HierarchyRequestErr: pass
else:
print "dom.appendChild didn't raise HierarchyRequestErr"
nodemap = elem.attributes
try: nodemap.setNamedItem(text)
- except xmlcore.dom.HierarchyRequestErr: pass
+ except xml.dom.HierarchyRequestErr: pass
else:
print "NamedNodeMap.setNamedItem didn't raise HierarchyRequestErr"
try: nodemap.setNamedItemNS(text)
- except xmlcore.dom.HierarchyRequestErr: pass
+ except xml.dom.HierarchyRequestErr: pass
else:
print "NamedNodeMap.setNamedItemNS didn't raise HierarchyRequestErr"
@@ -439,7 +439,7 @@ def testProcessingInstruction():
and pi.firstChild is None
and pi.lastChild is None
and pi.localName is None
- and pi.namespaceURI == xmlcore.dom.EMPTY_NAMESPACE)
+ and pi.namespaceURI == xml.dom.EMPTY_NAMESPACE)
def testProcessingInstructionRepr(): pass
@@ -454,7 +454,7 @@ def testTooManyDocumentElements():
elem = doc.createElement("extra")
try:
doc.appendChild(elem)
- except xmlcore.dom.HierarchyRequestErr:
+ except xml.dom.HierarchyRequestErr:
pass
else:
print "Failed to catch expected exception when" \
@@ -491,7 +491,7 @@ def testRemoveNamedItem():
confirm(a1.isSameNode(a2))
try:
attrs.removeNamedItem("a")
- except xmlcore.dom.NotFoundErr:
+ except xml.dom.NotFoundErr:
pass
def testRemoveNamedItemNS():
@@ -503,7 +503,7 @@ def testRemoveNamedItemNS():
confirm(a1.isSameNode(a2))
try:
attrs.removeNamedItemNS("http://xml.python.org/", "b")
- except xmlcore.dom.NotFoundErr:
+ except xml.dom.NotFoundErr:
pass
def testAttrListValues(): pass
@@ -682,7 +682,7 @@ def check_import_document(deep, testName):
doc2 = parseString("<doc/>")
try:
doc1.importNode(doc2, deep)
- except xmlcore.dom.NotSupportedErr:
+ except xml.dom.NotSupportedErr:
pass
else:
raise Exception(testName +
@@ -705,14 +705,12 @@ def create_nonempty_doctype():
doctype = getDOMImplementation().createDocumentType("doc", None, None)
doctype.entities._seq = []
doctype.notations._seq = []
- notation = xmlcore.dom.minidom.Notation(
- "my-notation", None,
- "http://xml.python.org/notations/my")
+ notation = xml.dom.minidom.Notation("my-notation", None,
+ "http://xml.python.org/notations/my")
doctype.notations._seq.append(notation)
- entity = xmlcore.dom.minidom.Entity(
- "my-entity", None,
- "http://xml.python.org/entities/my",
- "my-notation")
+ entity = xml.dom.minidom.Entity("my-entity", None,
+ "http://xml.python.org/entities/my",
+ "my-notation")
entity.version = "1.0"
entity.encoding = "utf-8"
entity.actualEncoding = "us-ascii"
@@ -731,7 +729,7 @@ def testImportDocumentTypeShallow():
target = create_doc_without_doctype()
try:
imported = target.importNode(src.doctype, 0)
- except xmlcore.dom.NotSupportedErr:
+ except xml.dom.NotSupportedErr:
pass
else:
raise Exception(
@@ -742,7 +740,7 @@ def testImportDocumentTypeDeep():
target = create_doc_without_doctype()
try:
imported = target.importNode(src.doctype, 1)
- except xmlcore.dom.NotSupportedErr:
+ except xml.dom.NotSupportedErr:
pass
else:
raise Exception(
@@ -850,7 +848,7 @@ def testNodeListItem():
doc.unlink()
def testSAX2DOM():
- from xmlcore.dom import pulldom
+ from xml.dom import pulldom
sax2dom = pulldom.SAX2DOM()
sax2dom.startDocument()
@@ -940,11 +938,11 @@ def testRenameAttribute():
attr = elem.attributes['a']
# Simple renaming
- attr = doc.renameNode(attr, xmlcore.dom.EMPTY_NAMESPACE, "b")
+ attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "b")
confirm(attr.name == "b"
and attr.nodeName == "b"
and attr.localName is None
- and attr.namespaceURI == xmlcore.dom.EMPTY_NAMESPACE
+ and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE
and attr.prefix is None
and attr.value == "v"
and elem.getAttributeNode("a") is None
@@ -989,11 +987,11 @@ def testRenameAttribute():
and attrmap[("http://xml.python.org/ns2", "d")].isSameNode(attr))
# Rename back to a simple non-NS node
- attr = doc.renameNode(attr, xmlcore.dom.EMPTY_NAMESPACE, "e")
+ attr = doc.renameNode(attr, xml.dom.EMPTY_NAMESPACE, "e")
confirm(attr.name == "e"
and attr.nodeName == "e"
and attr.localName is None
- and attr.namespaceURI == xmlcore.dom.EMPTY_NAMESPACE
+ and attr.namespaceURI == xml.dom.EMPTY_NAMESPACE
and attr.prefix is None
and attr.value == "v"
and elem.getAttributeNode("a") is None
@@ -1007,7 +1005,7 @@ def testRenameAttribute():
try:
doc.renameNode(attr, "http://xml.python.org/ns", "xmlns")
- except xmlcore.dom.NamespaceErr:
+ except xml.dom.NamespaceErr:
pass
else:
print "expected NamespaceErr"
@@ -1020,11 +1018,11 @@ def testRenameElement():
elem = doc.documentElement
# Simple renaming
- elem = doc.renameNode(elem, xmlcore.dom.EMPTY_NAMESPACE, "a")
+ elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "a")
confirm(elem.tagName == "a"
and elem.nodeName == "a"
and elem.localName is None
- and elem.namespaceURI == xmlcore.dom.EMPTY_NAMESPACE
+ and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE
and elem.prefix is None
and elem.ownerDocument.isSameNode(doc))
@@ -1047,11 +1045,11 @@ def testRenameElement():
and elem.ownerDocument.isSameNode(doc))
# Rename back to a simple non-NS node
- elem = doc.renameNode(elem, xmlcore.dom.EMPTY_NAMESPACE, "d")
+ elem = doc.renameNode(elem, xml.dom.EMPTY_NAMESPACE, "d")
confirm(elem.tagName == "d"
and elem.nodeName == "d"
and elem.localName is None
- and elem.namespaceURI == xmlcore.dom.EMPTY_NAMESPACE
+ and elem.namespaceURI == xml.dom.EMPTY_NAMESPACE
and elem.prefix is None
and elem.ownerDocument.isSameNode(doc))
@@ -1062,15 +1060,15 @@ def checkRenameNodeSharedConstraints(doc, node):
# Make sure illegal NS usage is detected:
try:
doc.renameNode(node, "http://xml.python.org/ns", "xmlns:foo")
- except xmlcore.dom.NamespaceErr:
+ except xml.dom.NamespaceErr:
pass
else:
print "expected NamespaceErr"
doc2 = parseString("<doc/>")
try:
- doc2.renameNode(node, xmlcore.dom.EMPTY_NAMESPACE, "foo")
- except xmlcore.dom.WrongDocumentErr:
+ doc2.renameNode(node, xml.dom.EMPTY_NAMESPACE, "foo")
+ except xml.dom.WrongDocumentErr:
pass
else:
print "expected WrongDocumentErr"
@@ -1078,12 +1076,12 @@ def checkRenameNodeSharedConstraints(doc, node):
def testRenameOther():
# We have to create a comment node explicitly since not all DOM
# builders used with minidom add comments to the DOM.
- doc = xmlcore.dom.minidom.getDOMImplementation().createDocument(
- xmlcore.dom.EMPTY_NAMESPACE, "e", None)
+ doc = xml.dom.minidom.getDOMImplementation().createDocument(
+ xml.dom.EMPTY_NAMESPACE, "e", None)
node = doc.createComment("comment")
try:
- doc.renameNode(node, xmlcore.dom.EMPTY_NAMESPACE, "foo")
- except xmlcore.dom.NotSupportedErr:
+ doc.renameNode(node, xml.dom.EMPTY_NAMESPACE, "foo")
+ except xml.dom.NotSupportedErr:
pass
else:
print "expected NotSupportedErr when renaming comment node"
@@ -1194,13 +1192,13 @@ def testSchemaType():
# since each supports a different level of DTD information.
t = elem.schemaType
confirm(t.name is None
- and t.namespace == xmlcore.dom.EMPTY_NAMESPACE)
+ and t.namespace == xml.dom.EMPTY_NAMESPACE)
names = "id notid text enum ref refs ent ents nm nms".split()
for name in names:
a = elem.getAttributeNode(name)
t = a.schemaType
confirm(hasattr(t, "name")
- and t.namespace == xmlcore.dom.EMPTY_NAMESPACE)
+ and t.namespace == xml.dom.EMPTY_NAMESPACE)
def testSetIdAttribute():
doc = parseString("<doc a1='v' a2='w'/>")
@@ -1229,7 +1227,7 @@ def testSetIdAttribute():
and a2.isId
and not a3.isId)
# renaming an attribute should not affect its ID-ness:
- doc.renameNode(a2, xmlcore.dom.EMPTY_NAMESPACE, "an")
+ doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
confirm(e.isSameNode(doc.getElementById("w"))
and a2.isId)
@@ -1265,7 +1263,7 @@ def testSetIdAttributeNS():
confirm(not a3.isId)
confirm(doc.getElementById("v") is None)
# renaming an attribute should not affect its ID-ness:
- doc.renameNode(a2, xmlcore.dom.EMPTY_NAMESPACE, "an")
+ doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
confirm(e.isSameNode(doc.getElementById("w"))
and a2.isId)
@@ -1301,7 +1299,7 @@ def testSetIdAttributeNode():
confirm(not a3.isId)
confirm(doc.getElementById("v") is None)
# renaming an attribute should not affect its ID-ness:
- doc.renameNode(a2, xmlcore.dom.EMPTY_NAMESPACE, "an")
+ doc.renameNode(a2, xml.dom.EMPTY_NAMESPACE, "an")
confirm(e.isSameNode(doc.getElementById("w"))
and a2.isId)
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
index 276b9af..397ebeb 100644
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -6,17 +6,37 @@
from test import test_support
from test import test_multibytecodec_support
-import unittest, StringIO, codecs, sys
+from test.test_support import TESTFN
+import unittest, StringIO, codecs, sys, os
+
+ALL_CJKENCODINGS = [
+# _codecs_cn
+ 'gb2312', 'gbk', 'gb18030', 'hz',
+# _codecs_hk
+ 'big5hkscs',
+# _codecs_jp
+ 'cp932', 'shift_jis', 'euc_jp', 'euc_jisx0213', 'shift_jisx0213',
+ 'euc_jis_2004', 'shift_jis_2004',
+# _codecs_kr
+ 'cp949', 'euc_kr', 'johab',
+# _codecs_tw
+ 'big5', 'cp950',
+# _codecs_iso2022
+ 'iso2022_jp', 'iso2022_jp_1', 'iso2022_jp_2', 'iso2022_jp_2004',
+ 'iso2022_jp_3', 'iso2022_jp_ext', 'iso2022_kr',
+]
class Test_MultibyteCodec(unittest.TestCase):
def test_nullcoding(self):
- self.assertEqual(''.decode('gb18030'), u'')
- self.assertEqual(unicode('', 'gb18030'), u'')
- self.assertEqual(u''.encode('gb18030'), '')
+ for enc in ALL_CJKENCODINGS:
+ self.assertEqual(''.decode(enc), u'')
+ self.assertEqual(unicode('', enc), u'')
+ self.assertEqual(u''.encode(enc), '')
def test_str_decode(self):
- self.assertEqual('abcd'.encode('gb18030'), 'abcd')
+ for enc in ALL_CJKENCODINGS:
+ self.assertEqual('abcd'.encode(enc), 'abcd')
def test_errorcallback_longindex(self):
dec = codecs.getdecoder('euc-kr')
@@ -25,6 +45,14 @@ class Test_MultibyteCodec(unittest.TestCase):
self.assertRaises(IndexError, dec,
'apple\x92ham\x93spam', 'test.cjktest')
+ def test_codingspec(self):
+ try:
+ for enc in ALL_CJKENCODINGS:
+ print >> open(TESTFN, 'w'), '# coding:', enc
+ exec open(TESTFN)
+ finally:
+ os.unlink(TESTFN)
+
class Test_IncrementalEncoder(unittest.TestCase):
def test_stateless(self):
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py
index 79df906..4582fa7 100644
--- a/Lib/test/test_optparse.py
+++ b/Lib/test/test_optparse.py
@@ -15,7 +15,7 @@ import copy
import types
import unittest
-from cStringIO import StringIO
+from StringIO import StringIO
from pprint import pprint
from test import test_support
@@ -164,15 +164,23 @@ and kwargs %(kwargs)r
expected_error=None):
"""Assert the parser prints the expected output on stdout."""
save_stdout = sys.stdout
+ encoding = getattr(save_stdout, 'encoding', None)
try:
try:
sys.stdout = StringIO()
+ if encoding:
+ sys.stdout.encoding = encoding
self.parser.parse_args(cmdline_args)
finally:
output = sys.stdout.getvalue()
sys.stdout = save_stdout
except InterceptedError, err:
+ self.assert_(
+ type(output) is types.StringType,
+ "expected output to be an ordinary string, not %r"
+ % type(output))
+
if output != expected_output:
self.fail("expected: \n'''\n" + expected_output +
"'''\nbut got \n'''\n" + output + "'''")
@@ -1452,10 +1460,26 @@ class TestHelp(BaseTest):
make_option("--foo", action="append", type="string", dest='foo',
help="store FOO in the foo list for later fooing"),
]
+
+ # We need to set COLUMNS for the OptionParser constructor, but
+ # we must restore its original value -- otherwise, this test
+ # screws things up for other tests when it's part of the Python
+ # test suite.
+ orig_columns = os.environ.get('COLUMNS')
os.environ['COLUMNS'] = str(columns)
- return InterceptingOptionParser(option_list=options)
+ try:
+ return InterceptingOptionParser(option_list=options)
+ finally:
+ if orig_columns is None:
+ del os.environ['COLUMNS']
+ else:
+ os.environ['COLUMNS'] = orig_columns
def assertHelpEquals(self, expected_output):
+ if type(expected_output) is types.UnicodeType:
+ encoding = self.parser._get_encoding(sys.stdout)
+ expected_output = expected_output.encode(encoding, "replace")
+
save_argv = sys.argv[:]
try:
# Make optparse believe bar.py is being executed.
@@ -1486,6 +1510,27 @@ class TestHelp(BaseTest):
self.parser = self.make_parser(60)
self.assertHelpEquals(_expected_help_short_lines)
+ def test_help_unicode(self):
+ self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE)
+ self.parser.add_option("-a", action="store_true", help=u"ol\u00E9!")
+ expect = u"""\
+Options:
+ -h, --help show this help message and exit
+ -a ol\u00E9!
+"""
+ self.assertHelpEquals(expect)
+
+ def test_help_unicode_description(self):
+ self.parser = InterceptingOptionParser(usage=SUPPRESS_USAGE,
+ description=u"ol\u00E9!")
+ expect = u"""\
+ol\u00E9!
+
+Options:
+ -h, --help show this help message and exit
+"""
+ self.assertHelpEquals(expect)
+
def test_help_description_groups(self):
self.parser.set_description(
"This is the program description for %prog. %prog has "
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index ffc9420..9497777 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -11,6 +11,19 @@ from test import test_support
warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, __name__)
warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__)
+# Tests creating TESTFN
+class FileTests(unittest.TestCase):
+ def setUp(self):
+ if os.path.exists(test_support.TESTFN):
+ os.unlink(test_support.TESTFN)
+ tearDown = setUp
+
+ def test_access(self):
+ f = os.open(test_support.TESTFN, os.O_CREAT|os.O_RDWR)
+ os.close(f)
+ self.assert_(os.access(test_support.TESTFN, os.W_OK))
+
+
class TemporaryFileTests(unittest.TestCase):
def setUp(self):
self.files = []
@@ -393,6 +406,7 @@ if sys.platform != 'win32':
def test_main():
test_support.run_unittest(
+ FileTests,
TemporaryFileTests,
StatAttributeTests,
EnvironTests,
diff --git a/Lib/test/test_ossaudiodev.py b/Lib/test/test_ossaudiodev.py
index 8810516..5868ea7 100644
--- a/Lib/test/test_ossaudiodev.py
+++ b/Lib/test/test_ossaudiodev.py
@@ -40,6 +40,10 @@ def read_sound_file(path):
data = audioop.ulaw2lin(data, 2)
return (data, rate, 16, nchannels)
+# version of assert that still works with -O
+def _assert(expr, message=None):
+ if not expr:
+ raise AssertionError(message or "assertion failed")
def play_sound_file(data, rate, ssize, nchannels):
try:
@@ -57,9 +61,9 @@ def play_sound_file(data, rate, ssize, nchannels):
dsp.fileno()
# Make sure the read-only attributes work.
- assert dsp.closed is False, "dsp.closed is not False"
- assert dsp.name == "/dev/dsp"
- assert dsp.mode == 'w', "bad dsp.mode: %r" % dsp.mode
+ _assert(dsp.closed is False, "dsp.closed is not False")
+ _assert(dsp.name == "/dev/dsp")
+ _assert(dsp.mode == 'w', "bad dsp.mode: %r" % dsp.mode)
# And make sure they're really read-only.
for attr in ('closed', 'name', 'mode'):
@@ -69,14 +73,23 @@ def play_sound_file(data, rate, ssize, nchannels):
except TypeError:
pass
+ # Compute expected running time of sound sample (in seconds).
+ expected_time = float(len(data)) / (ssize/8) / nchannels / rate
+
# set parameters based on .au file headers
dsp.setparameters(AFMT_S16_NE, nchannels, rate)
+ print ("playing test sound file (expected running time: %.2f sec)"
+ % expected_time)
t1 = time.time()
- print "playing test sound file..."
dsp.write(data)
dsp.close()
t2 = time.time()
- print "elapsed time: %.1f sec" % (t2-t1)
+ elapsed_time = t2 - t1
+
+ percent_diff = (abs(elapsed_time - expected_time) / expected_time) * 100
+ _assert(percent_diff <= 10.0, \
+ ("elapsed time (%.2f sec) > 10%% off of expected time (%.2f sec)"
+ % (elapsed_time, expected_time)))
def test_setparameters(dsp):
# Two configurations for testing:
@@ -101,11 +114,11 @@ def test_setparameters(dsp):
# setparameters() should be able to set this configuration in
# either strict or non-strict mode.
result = dsp.setparameters(fmt, channels, rate, False)
- assert result == (fmt, channels, rate), \
- "setparameters%r: returned %r" % (config + result)
+ _assert(result == (fmt, channels, rate),
+ "setparameters%r: returned %r" % (config, result))
result = dsp.setparameters(fmt, channels, rate, True)
- assert result == (fmt, channels, rate), \
- "setparameters%r: returned %r" % (config + result)
+ _assert(result == (fmt, channels, rate),
+ "setparameters%r: returned %r" % (config, result))
def test_bad_setparameters(dsp):
@@ -123,8 +136,8 @@ def test_bad_setparameters(dsp):
]:
(fmt, channels, rate) = config
result = dsp.setparameters(fmt, channels, rate, False)
- assert result != config, \
- "setparameters: unexpectedly got requested configuration"
+ _assert(result != config,
+ "setparameters: unexpectedly got requested configuration")
try:
result = dsp.setparameters(fmt, channels, rate, True)
@@ -145,6 +158,6 @@ def test():
#test_bad_setparameters(dsp)
finally:
dsp.close()
- assert dsp.closed is True, "dsp.closed is not True"
+ _assert(dsp.closed is True, "dsp.closed is not True")
test()
diff --git a/Lib/test/test_pep292.py b/Lib/test/test_pep292.py
index 2a4353a..d1100ea 100644
--- a/Lib/test/test_pep292.py
+++ b/Lib/test/test_pep292.py
@@ -58,6 +58,13 @@ class TestTemplate(unittest.TestCase):
s = Template('tim has eaten ${count} bags of ham today')
eq(s.substitute(d), 'tim has eaten 7 bags of ham today')
+ def test_tupleargs(self):
+ eq = self.assertEqual
+ s = Template('$who ate ${meal}')
+ d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao'))
+ eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')")
+ eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')")
+
def test_SafeTemplate(self):
eq = self.assertEqual
s = Template('$who likes ${what} for ${meal}')
diff --git a/Lib/test/test_popen.py b/Lib/test/test_popen.py
index 2b687ad..fbf5e05 100644
--- a/Lib/test/test_popen.py
+++ b/Lib/test/test_popen.py
@@ -6,7 +6,7 @@
import os
import sys
-from test.test_support import TestSkipped
+from test.test_support import TestSkipped, reap_children
from os import popen
# Test that command-lines get down as we expect.
@@ -35,5 +35,6 @@ def _test_commandline():
def main():
print "Test popen:"
_test_commandline()
+ reap_children()
main()
diff --git a/Lib/test/test_popen2.py b/Lib/test/test_popen2.py
index 4db3cd1..2d54eb0 100644
--- a/Lib/test/test_popen2.py
+++ b/Lib/test/test_popen2.py
@@ -5,7 +5,7 @@
import os
import sys
-from test.test_support import TestSkipped
+from test.test_support import TestSkipped, reap_children
# popen2 contains its own testing routine
# which is especially useful to see if open files
@@ -75,3 +75,4 @@ def _test():
main()
_test()
+reap_children()
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py
index a9a5e8f..0698818 100644
--- a/Lib/test/test_pyexpat.py
+++ b/Lib/test/test_pyexpat.py
@@ -365,3 +365,24 @@ parser.Parse('''<a>
<c/>
</b>
</a>''', 1)
+
+
+def test_parse_only_xml_data():
+ # http://python.org/sf/1296433
+ #
+ xml = "<?xml version='1.0' encoding='iso8859'?><s>%s</s>" % ('a' * 1025)
+ # this one doesn't crash
+ #xml = "<?xml version='1.0'?><s>%s</s>" % ('a' * 10000)
+
+ def handler(text):
+ raise Exception
+
+ parser = expat.ParserCreate()
+ parser.CharacterDataHandler = handler
+
+ try:
+ parser.Parse(xml)
+ except:
+ pass
+
+test_parse_only_xml_data()
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index ded81fb..af4c7dd 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -1,17 +1,17 @@
# regression test for SAX 2.0 -*- coding: iso-8859-1 -*-
# $Id$
-from xmlcore.sax import make_parser, ContentHandler, \
- SAXException, SAXReaderNotAvailable, SAXParseException
+from xml.sax import make_parser, ContentHandler, \
+ SAXException, SAXReaderNotAvailable, SAXParseException
try:
make_parser()
except SAXReaderNotAvailable:
# don't try to test this module if we cannot create a parser
raise ImportError("no XML parsers available")
-from xmlcore.sax.saxutils import XMLGenerator, escape, unescape, quoteattr, \
- XMLFilterBase
-from xmlcore.sax.expatreader import create_parser
-from xmlcore.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
+from xml.sax.saxutils import XMLGenerator, escape, unescape, quoteattr, \
+ XMLFilterBase
+from xml.sax.expatreader import create_parser
+from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
from cStringIO import StringIO
from test.test_support import verify, verbose, TestFailed, findfile
import os
@@ -36,17 +36,17 @@ def test_make_parser2():
# Creating parsers several times in a row should succeed.
# Testing this because there have been failures of this kind
# before.
- from xmlcore.sax import make_parser
+ from xml.sax import make_parser
p = make_parser()
- from xmlcore.sax import make_parser
+ from xml.sax import make_parser
p = make_parser()
- from xmlcore.sax import make_parser
+ from xml.sax import make_parser
p = make_parser()
- from xmlcore.sax import make_parser
+ from xml.sax import make_parser
p = make_parser()
- from xmlcore.sax import make_parser
+ from xml.sax import make_parser
p = make_parser()
- from xmlcore.sax import make_parser
+ from xml.sax import make_parser
p = make_parser()
except:
return 0
@@ -108,7 +108,7 @@ def test_make_parser():
try:
# Creating a parser should succeed - it should fall back
# to the expatreader
- p = make_parser(['xmlcore.parsers.no_such_parser'])
+ p = make_parser(['xml.parsers.no_such_parser'])
except:
return 0
else:
@@ -175,11 +175,14 @@ def test_xmlgen_attr_escape():
gen.endElement("e")
gen.startElement("e", {"a": "'\""})
gen.endElement("e")
+ gen.startElement("e", {"a": "\n\r\t"})
+ gen.endElement("e")
gen.endElement("doc")
gen.endDocument()
- return result.getvalue() == start \
- + "<doc a='\"'><e a=\"'\"></e><e a=\"'&quot;\"></e></doc>"
+ return result.getvalue() == start + ("<doc a='\"'><e a=\"'\"></e>"
+ "<e a=\"'&quot;\"></e>"
+ "<e a=\"&#10;&#13;&#9;\"></e></doc>")
def test_xmlgen_ignorable():
result = StringIO()
@@ -668,6 +671,55 @@ def test_nsattrs_wattr():
attrs.getQNameByName((ns_uri, "attr")) == "ns:attr"
+# During the development of Python 2.5, an attempt to move the "xml"
+# package implementation to a new package ("xmlcore") proved painful.
+# The goal of this change was to allow applications to be able to
+# obtain and rely on behavior in the standard library implementation
+# of the XML support without needing to be concerned about the
+# availability of the PyXML implementation.
+#
+# While the existing import hackery in Lib/xml/__init__.py can cause
+# PyXML's _xmlpus package to supplant the "xml" package, that only
+# works because either implementation uses the "xml" package name for
+# imports.
+#
+# The move resulted in a number of problems related to the fact that
+# the import machinery's "package context" is based on the name that's
+# being imported rather than the __name__ of the actual package
+# containment; it wasn't possible for the "xml" package to be replaced
+# by a simple module that indirected imports to the "xmlcore" package.
+#
+# The following two tests exercised bugs that were introduced in that
+# attempt. Keeping these tests around will help detect problems with
+# other attempts to provide reliable access to the standard library's
+# implementation of the XML support.
+
+def test_sf_1511497():
+ # Bug report: http://www.python.org/sf/1511497
+ import sys
+ old_modules = sys.modules.copy()
+ for modname in sys.modules.keys():
+ if modname.startswith("xml."):
+ del sys.modules[modname]
+ try:
+ import xml.sax.expatreader
+ module = xml.sax.expatreader
+ return module.__name__ == "xml.sax.expatreader"
+ finally:
+ sys.modules.update(old_modules)
+
+def test_sf_1513611():
+ # Bug report: http://www.python.org/sf/1513611
+ sio = StringIO("invalid")
+ parser = make_parser()
+ from xml.sax import SAXParseException
+ try:
+ parser.parse(sio)
+ except SAXParseException:
+ return True
+ else:
+ return False
+
# ===== Main program
def make_test_output():
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py
index f37254c..239745c 100644
--- a/Lib/test/test_scope.py
+++ b/Lib/test/test_scope.py
@@ -299,6 +299,17 @@ except NameError:
else:
raise TestFailed
+# test for bug #1501934: incorrect LOAD/STORE_GLOBAL generation
+global_x = 1
+def f():
+ global_x += 1
+try:
+ f()
+except UnboundLocalError:
+ pass
+else:
+ raise TestFailed, 'scope of global_x not correctly determined'
+
print "14. complex definitions"
def makeReturner(*lst):
diff --git a/Lib/test/test_select.py b/Lib/test/test_select.py
index eaec52b..d341324 100644
--- a/Lib/test/test_select.py
+++ b/Lib/test/test_select.py
@@ -1,5 +1,5 @@
# Testing select module
-from test.test_support import verbose
+from test.test_support import verbose, reap_children
import select
import os
@@ -65,5 +65,6 @@ def test():
continue
print 'Unexpected return values from select():', rfd, wfd, xfd
p.close()
+ reap_children()
test()
diff --git a/Lib/test/test_sgmllib.py b/Lib/test/test_sgmllib.py
index 8e8b02f..28a21a4 100644
--- a/Lib/test/test_sgmllib.py
+++ b/Lib/test/test_sgmllib.py
@@ -1,4 +1,6 @@
+import htmlentitydefs
import pprint
+import re
import sgmllib
import unittest
from test import test_support
@@ -64,6 +66,37 @@ class CDATAEventCollector(EventCollector):
self.setliteral()
+class HTMLEntityCollector(EventCollector):
+
+ entity_or_charref = re.compile('(?:&([a-zA-Z][-.a-zA-Z0-9]*)'
+ '|&#(x[0-9a-zA-Z]+|[0-9]+))(;?)')
+
+ def convert_charref(self, name):
+ self.append(("charref", "convert", name))
+ if name[0] != "x":
+ return EventCollector.convert_charref(self, name)
+
+ def convert_codepoint(self, codepoint):
+ self.append(("codepoint", "convert", codepoint))
+ EventCollector.convert_codepoint(self, codepoint)
+
+ def convert_entityref(self, name):
+ self.append(("entityref", "convert", name))
+ return EventCollector.convert_entityref(self, name)
+
+ # These to record that they were called, then pass the call along
+ # to the default implementation so that it's actions can be
+ # recorded.
+
+ def handle_charref(self, data):
+ self.append(("charref", data))
+ sgmllib.SGMLParser.handle_charref(self, data)
+
+ def handle_entityref(self, data):
+ self.append(("entityref", data))
+ sgmllib.SGMLParser.handle_entityref(self, data)
+
+
class SGMLParserTestCase(unittest.TestCase):
collector = EventCollector
@@ -218,7 +251,9 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
"""Substitution of entities and charrefs in attribute values"""
# SF bug #1452246
self.check_events("""<a b=&lt; c=&lt;&gt; d=&lt-&gt; e='&lt; '
- f="&xxx;" g='&#32;&#33;' h='&#500;' i='x?a=b&c=d;'>""",
+ f="&xxx;" g='&#32;&#33;' h='&#500;'
+ i='x?a=b&c=d;'
+ j='&amp;#42;' k='&#38;#42;'>""",
[("starttag", "a", [("b", "<"),
("c", "<>"),
("d", "&lt->"),
@@ -226,13 +261,59 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
("f", "&xxx;"),
("g", " !"),
("h", "&#500;"),
- ("i", "x?a=b&c=d;"), ])])
+ ("i", "x?a=b&c=d;"),
+ ("j", "&#42;"),
+ ("k", "&#42;"),
+ ])])
+
+ def test_convert_overrides(self):
+ # This checks that the character and entity reference
+ # conversion helpers are called at the documented times. No
+ # attempt is made to really change what the parser accepts.
+ #
+ self.collector = HTMLEntityCollector
+ self.check_events(('<a title="&ldquo;test&#x201d;">foo</a>'
+ '&foobar;&#42;'), [
+ ('entityref', 'convert', 'ldquo'),
+ ('charref', 'convert', 'x201d'),
+ ('starttag', 'a', [('title', '&ldquo;test&#x201d;')]),
+ ('data', 'foo'),
+ ('endtag', 'a'),
+ ('entityref', 'foobar'),
+ ('entityref', 'convert', 'foobar'),
+ ('charref', '42'),
+ ('charref', 'convert', '42'),
+ ('codepoint', 'convert', 42),
+ ])
+
+ def test_attr_values_quoted_markup(self):
+ """Multi-line and markup in attribute values"""
+ self.check_events("""<a title='foo\n<br>bar'>text</a>""",
+ [("starttag", "a", [("title", "foo\n<br>bar")]),
+ ("data", "text"),
+ ("endtag", "a")])
+ self.check_events("""<a title='less < than'>text</a>""",
+ [("starttag", "a", [("title", "less < than")]),
+ ("data", "text"),
+ ("endtag", "a")])
+ self.check_events("""<a title='greater > than'>text</a>""",
+ [("starttag", "a", [("title", "greater > than")]),
+ ("data", "text"),
+ ("endtag", "a")])
def test_attr_funky_names(self):
self.check_events("""<a a.b='v' c:d=v e-f=v>""", [
("starttag", "a", [("a.b", "v"), ("c:d", "v"), ("e-f", "v")]),
])
+ def test_attr_value_ip6_url(self):
+ # http://www.python.org/sf/853506
+ self.check_events(("<a href='http://[1080::8:800:200C:417A]/'>"
+ "<a href=http://[1080::8:800:200C:417A]/>"), [
+ ("starttag", "a", [("href", "http://[1080::8:800:200C:417A]/")]),
+ ("starttag", "a", [("href", "http://[1080::8:800:200C:417A]/")]),
+ ])
+
def test_illegal_declarations(self):
s = 'abc<!spacer type="block" height="25">def'
self.check_events(s, [
@@ -301,8 +382,8 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
# that needs to be carefully considered before changing it.
def _test_starttag_end_boundary(self):
- self.check_events("""<a b='<'>""", [("starttag", "a", [("b", "<")])])
- self.check_events("""<a b='>'>""", [("starttag", "a", [("b", ">")])])
+ self.check_events("<a b='<'>", [("starttag", "a", [("b", "<")])])
+ self.check_events("<a b='>'>", [("starttag", "a", [("b", ">")])])
def _test_buffer_artefacts(self):
output = [("starttag", "a", [("b", "<")])]
@@ -322,17 +403,17 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
self.check_events(["<a b='>'", ">"], output)
output = [("comment", "abc")]
- self._run_check(["", "<!--abc-->"], output)
- self._run_check(["<", "!--abc-->"], output)
- self._run_check(["<!", "--abc-->"], output)
- self._run_check(["<!-", "-abc-->"], output)
- self._run_check(["<!--", "abc-->"], output)
- self._run_check(["<!--a", "bc-->"], output)
- self._run_check(["<!--ab", "c-->"], output)
- self._run_check(["<!--abc", "-->"], output)
- self._run_check(["<!--abc-", "->"], output)
- self._run_check(["<!--abc--", ">"], output)
- self._run_check(["<!--abc-->", ""], output)
+ self.check_events(["", "<!--abc-->"], output)
+ self.check_events(["<", "!--abc-->"], output)
+ self.check_events(["<!", "--abc-->"], output)
+ self.check_events(["<!-", "-abc-->"], output)
+ self.check_events(["<!--", "abc-->"], output)
+ self.check_events(["<!--a", "bc-->"], output)
+ self.check_events(["<!--ab", "c-->"], output)
+ self.check_events(["<!--abc", "-->"], output)
+ self.check_events(["<!--abc-", "->"], output)
+ self.check_events(["<!--abc--", ">"], output)
+ self.check_events(["<!--abc-->", ""], output)
def _test_starttag_junk_chars(self):
self.check_parse_error("<")
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index 6ab5a35..da71fa8 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -74,6 +74,53 @@ class TestShutil(unittest.TestCase):
except:
pass
+ def test_copytree_simple(self):
+ def write_data(path, data):
+ f = open(path, "w")
+ f.write(data)
+ f.close()
+
+ def read_data(path):
+ f = open(path)
+ data = f.read()
+ f.close()
+ return data
+
+ src_dir = tempfile.mkdtemp()
+ dst_dir = os.path.join(tempfile.mkdtemp(), 'destination')
+
+ write_data(os.path.join(src_dir, 'test.txt'), '123')
+
+ os.mkdir(os.path.join(src_dir, 'test_dir'))
+ write_data(os.path.join(src_dir, 'test_dir', 'test.txt'), '456')
+
+ try:
+ shutil.copytree(src_dir, dst_dir)
+ self.assertTrue(os.path.isfile(os.path.join(dst_dir, 'test.txt')))
+ self.assertTrue(os.path.isdir(os.path.join(dst_dir, 'test_dir')))
+ self.assertTrue(os.path.isfile(os.path.join(dst_dir, 'test_dir',
+ 'test.txt')))
+ actual = read_data(os.path.join(dst_dir, 'test.txt'))
+ self.assertEqual(actual, '123')
+ actual = read_data(os.path.join(dst_dir, 'test_dir', 'test.txt'))
+ self.assertEqual(actual, '456')
+ finally:
+ for path in (
+ os.path.join(src_dir, 'test.txt'),
+ os.path.join(dst_dir, 'test.txt'),
+ os.path.join(src_dir, 'test_dir', 'test.txt'),
+ os.path.join(dst_dir, 'test_dir', 'test.txt'),
+ ):
+ if os.path.exists(path):
+ os.remove(path)
+ for path in (
+ os.path.join(src_dir, 'test_dir'),
+ os.path.join(dst_dir, 'test_dir'),
+ ):
+ if os.path.exists(path):
+ os.removedirs(path)
+
+
if hasattr(os, "symlink"):
def test_dont_copy_file_onto_link_to_itself(self):
# bug 851123.
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index f7fcb04..a6267d2 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -25,7 +25,11 @@ script = """
) &
""" % vars()
+a_called = b_called = False
+
def handlerA(*args):
+ global a_called
+ a_called = True
if verbose:
print "handlerA", args
@@ -33,11 +37,14 @@ class HandlerBCalled(Exception):
pass
def handlerB(*args):
+ global b_called
+ b_called = True
if verbose:
print "handlerB", args
raise HandlerBCalled, args
-signal.alarm(20) # Entire test lasts at most 20 sec.
+MAX_DURATION = 20
+signal.alarm(MAX_DURATION) # Entire test should last at most 20 sec.
hup = signal.signal(signal.SIGHUP, handlerA)
usr1 = signal.signal(signal.SIGUSR1, handlerB)
usr2 = signal.signal(signal.SIGUSR2, signal.SIG_IGN)
@@ -65,9 +72,35 @@ try:
except TypeError:
pass
+# Set up a child to send an alarm signal to us (the parent) after waiting
+# long enough to receive the alarm. It seems we miss the alarm for some
+# reason. This will hopefully stop the hangs on Tru64/Alpha.
+def force_test_exit():
+ # Sigh, both imports seem necessary to avoid errors.
+ import os
+ fork_pid = os.fork()
+ if fork_pid == 0:
+ # In child
+ import os, time
+ try:
+ # Wait 5 seconds longer than the expected alarm to give enough
+ # time for the normal sequence of events to occur. This is
+ # just a stop-gap to prevent the test from hanging.
+ time.sleep(MAX_DURATION + 5)
+ print >> sys.__stdout__, ' child should not have to kill parent'
+ for i in range(3):
+ os.kill(pid, signal.SIGALARM)
+ finally:
+ os._exit(0)
+ # In parent (or error)
+ return fork_pid
+
try:
os.system(script)
+ # Try to ensure this test exits even if there is some problem with alarm.
+ # Tru64/Alpha sometimes hangs and is ultimately killed by the buildbot.
+ fork_pid = force_test_exit()
print "starting pause() loop..."
try:
@@ -88,6 +121,22 @@ try:
if verbose:
print "KeyboardInterrupt (assume the alarm() went off)"
+ # Forcibly kill the child we created to ping us if there was a test error.
+ try:
+ # Make sure we don't kill ourself if there was a fork error.
+ if fork_pid > 0:
+ os.kill(fork_pid, signal.SIGKILL)
+ except:
+ # If the child killed us, it has probably exited. Killing a
+ # non-existant process will raise an error which we don't care about.
+ pass
+
+ if not a_called:
+ print 'HandlerA not called'
+
+ if not b_called:
+ print 'HandlerB not called'
+
finally:
signal.signal(signal.SIGHUP, hup)
signal.signal(signal.SIGUSR1, usr1)
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 01b9b5b..356b801 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -11,6 +11,7 @@ import Queue
import sys
import array
from weakref import proxy
+import signal
PORT = 50007
HOST = 'localhost'
@@ -21,7 +22,8 @@ class SocketTCPTest(unittest.TestCase):
def setUp(self):
self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- self.serv.bind((HOST, PORT))
+ global PORT
+ PORT = test_support.bind_port(self.serv, HOST, PORT)
self.serv.listen(1)
def tearDown(self):
@@ -33,7 +35,8 @@ class SocketUDPTest(unittest.TestCase):
def setUp(self):
self.serv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
- self.serv.bind((HOST, PORT))
+ global PORT
+ PORT = test_support.bind_port(self.serv, HOST, PORT)
def tearDown(self):
self.serv.close()
@@ -447,7 +450,12 @@ class GeneralModuleTests(unittest.TestCase):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(("0.0.0.0", PORT+1))
name = sock.getsockname()
- self.assertEqual(name, ("0.0.0.0", PORT+1))
+ # XXX(nnorwitz): http://tinyurl.com/os5jz seems to indicate
+ # it reasonable to get the host's addr in addition to 0.0.0.0.
+ # At least for eCos. This is required for the S/390 to pass.
+ my_ip_addr = socket.gethostbyname(socket.gethostname())
+ self.assert_(name[0] in ("0.0.0.0", my_ip_addr), '%s invalid' % name[0])
+ self.assertEqual(name[1], PORT+1)
def testGetSockOpt(self):
# Testing getsockopt()
@@ -575,6 +583,21 @@ class BasicUDPTest(ThreadedUDPSocketTest):
def _testRecvFrom(self):
self.cli.sendto(MSG, 0, (HOST, PORT))
+class TCPCloserTest(ThreadedTCPSocketTest):
+
+ def testClose(self):
+ conn, addr = self.serv.accept()
+ conn.close()
+
+ sd = self.cli
+ read, write, err = select.select([sd], [], [], 1.0)
+ self.assertEqual(read, [sd])
+ self.assertEqual(sd.recv(1), '')
+
+ def _testClose(self):
+ self.cli.connect((HOST, PORT))
+ time.sleep(1.0)
+
class BasicSocketPairTest(SocketPairTest):
def __init__(self, methodName='runTest'):
@@ -795,6 +818,37 @@ class TCPTimeoutTest(SocketTCPTest):
if not ok:
self.fail("accept() returned success when we did not expect it")
+ def testInterruptedTimeout(self):
+ # XXX I don't know how to do this test on MSWindows or any other
+ # plaform that doesn't support signal.alarm() or os.kill(), though
+ # the bug should have existed on all platforms.
+ if not hasattr(signal, "alarm"):
+ return # can only test on *nix
+ self.serv.settimeout(5.0) # must be longer than alarm
+ class Alarm(Exception):
+ pass
+ def alarm_handler(signal, frame):
+ raise Alarm
+ old_alarm = signal.signal(signal.SIGALRM, alarm_handler)
+ try:
+ signal.alarm(2) # POSIX allows alarm to be up to 1 second early
+ try:
+ foo = self.serv.accept()
+ except socket.timeout:
+ self.fail("caught timeout instead of Alarm")
+ except Alarm:
+ pass
+ except:
+ self.fail("caught other exception instead of Alarm")
+ else:
+ self.fail("nothing caught")
+ signal.alarm(0) # shut off alarm
+ except Alarm:
+ self.fail("got Alarm in wrong place")
+ finally:
+ # no alarm can be pending. Safe to restore old handler.
+ signal.signal(signal.SIGALRM, old_alarm)
+
class UDPTimeoutTest(SocketTCPTest):
def testUDPTimeout(self):
@@ -883,8 +937,8 @@ class BufferIOTest(SocketConnectedTest):
self.serv_conn.send(buf)
def test_main():
- tests = [GeneralModuleTests, BasicTCPTest, TCPTimeoutTest, TestExceptions,
- BufferIOTest]
+ tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest,
+ TestExceptions, BufferIOTest]
if sys.platform != 'mac':
tests.extend([ BasicUDPTest, UDPTimeoutTest ])
@@ -899,7 +953,10 @@ def test_main():
tests.append(BasicSocketPairTest)
if sys.platform == 'linux2':
tests.append(TestLinuxAbstractNamespace)
+
+ thread_info = test_support.threading_setup()
test_support.run_unittest(*tests)
+ test_support.threading_cleanup(*thread_info)
if __name__ == "__main__":
test_main()
diff --git a/Lib/test/test_socket_ssl.py b/Lib/test/test_socket_ssl.py
index 1091383..3c9c9f0 100644
--- a/Lib/test/test_socket_ssl.py
+++ b/Lib/test/test_socket_ssl.py
@@ -3,6 +3,7 @@
import sys
from test import test_support
import socket
+import errno
# Optionally test SSL support. This requires the 'network' resource as given
# on the regrtest command line.
@@ -33,6 +34,13 @@ def test_basic():
def test_timeout():
test_support.requires('network')
+ def error_msg(extra_msg):
+ print >> sys.stderr, """\
+ WARNING: an attempt to connect to %r %s, in
+ test_timeout. That may be legitimate, but is not the outcome we hoped
+ for. If this message is seen often, test_timeout should be changed to
+ use a more reliable address.""" % (ADDR, extra_msg)
+
if test_support.verbose:
print "test_timeout ..."
@@ -48,12 +56,14 @@ def test_timeout():
try:
s.connect(ADDR)
except socket.timeout:
- print >> sys.stderr, """\
- WARNING: an attempt to connect to %r timed out, in
- test_timeout. That may be legitimate, but is not the outcome we hoped
- for. If this message is seen often, test_timeout should be changed to
- use a more reliable address.""" % (ADDR,)
+ error_msg('timed out')
return
+ except socket.error, exc: # In case connection is refused.
+ if exc.args[0] == errno.ECONNREFUSED:
+ error_msg('was refused')
+ return
+ else:
+ raise
ss = socket.ssl(s)
# Read part of return welcome banner twice.
@@ -71,7 +81,7 @@ def test_rude_shutdown():
return
# Some random port to connect to.
- PORT = 9934
+ PORT = [9934]
listener_ready = threading.Event()
listener_gone = threading.Event()
@@ -82,7 +92,7 @@ def test_rude_shutdown():
# know the socket is gone.
def listener():
s = socket.socket()
- s.bind(('', PORT))
+ PORT[0] = test_support.bind_port(s, '', PORT[0])
s.listen(5)
listener_ready.set()
s.accept()
@@ -92,7 +102,7 @@ def test_rude_shutdown():
def connector():
listener_ready.wait()
s = socket.socket()
- s.connect(('localhost', PORT))
+ s.connect(('localhost', PORT[0]))
listener_gone.wait()
try:
ssl_sock = socket.ssl(s)
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index 1245ba5..dd4532f 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -1,11 +1,13 @@
# Test suite for SocketServer.py
from test import test_support
-from test.test_support import verbose, verify, TESTFN, TestSkipped
+from test.test_support import (verbose, verify, TESTFN, TestSkipped,
+ reap_children)
test_support.requires('network')
from SocketServer import *
import socket
+import errno
import select
import time
import threading
@@ -77,6 +79,11 @@ class ServerThread(threading.Thread):
pass
if verbose: print "thread: creating server"
svr = svrcls(self.__addr, self.__hdlrcls)
+ # pull the address out of the server in case it changed
+ # this can happen if another process is using the port
+ addr = getattr(svr, 'server_address')
+ if addr:
+ self.__addr = addr
if verbose: print "thread: serving three times"
svr.serve_a_few()
if verbose: print "thread: done"
@@ -136,7 +143,25 @@ def testloop(proto, servers, hdlrcls, testfunc):
t.join()
if verbose: print "done"
-tcpservers = [TCPServer, ThreadingTCPServer]
+class ForgivingTCPServer(TCPServer):
+ # prevent errors if another process is using the port we want
+ def server_bind(self):
+ host, default_port = self.server_address
+ # this code shamelessly stolen from test.test_support
+ # the ports were changed to protect the innocent
+ import sys
+ for port in [default_port, 3434, 8798, 23833]:
+ try:
+ self.server_address = host, port
+ TCPServer.server_bind(self)
+ break
+ except socket.error, (err, msg):
+ if err != errno.EADDRINUSE:
+ raise
+ print >>sys.__stderr__, \
+ ' WARNING: failed to listen on port %d, trying another' % port
+
+tcpservers = [ForgivingTCPServer, ThreadingTCPServer]
if hasattr(os, 'fork') and os.name not in ('os2',):
tcpservers.append(ForkingTCPServer)
udpservers = [UDPServer, ThreadingUDPServer]
@@ -175,6 +200,7 @@ def test_main():
testall()
finally:
cleanup()
+ reap_children()
if __name__ == "__main__":
test_main()
diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py
index aa458e6..66fd667 100644
--- a/Lib/test/test_struct.py
+++ b/Lib/test/test_struct.py
@@ -15,9 +15,11 @@ try:
except ImportError:
PY_STRUCT_RANGE_CHECKING = 0
PY_STRUCT_OVERFLOW_MASKING = 1
+ PY_STRUCT_FLOAT_COERCE = 2
else:
- PY_STRUCT_RANGE_CHECKING = _struct._PY_STRUCT_RANGE_CHECKING
- PY_STRUCT_OVERFLOW_MASKING = _struct._PY_STRUCT_OVERFLOW_MASKING
+ PY_STRUCT_RANGE_CHECKING = getattr(_struct, '_PY_STRUCT_RANGE_CHECKING', 0)
+ PY_STRUCT_OVERFLOW_MASKING = getattr(_struct, '_PY_STRUCT_OVERFLOW_MASKING', 0)
+ PY_STRUCT_FLOAT_COERCE = getattr(_struct, '_PY_STRUCT_FLOAT_COERCE', 0)
def string_reverse(s):
return "".join(reversed(s))
@@ -46,33 +48,40 @@ def any_err(func, *args):
raise TestFailed, "%s%s did not raise error" % (
func.__name__, args)
+def with_warning_restore(func):
+ def _with_warning_restore(*args, **kw):
+ # The `warnings` module doesn't have an advertised way to restore
+ # its filter list. Cheat.
+ save_warnings_filters = warnings.filters[:]
+ # Grrr, we need this function to warn every time. Without removing
+ # the warningregistry, running test_tarfile then test_struct would fail
+ # on 64-bit platforms.
+ globals = func.func_globals
+ if '__warningregistry__' in globals:
+ del globals['__warningregistry__']
+ warnings.filterwarnings("error", r"""^struct.*""", DeprecationWarning)
+ warnings.filterwarnings("error", r""".*format requires.*""",
+ DeprecationWarning)
+ try:
+ return func(*args, **kw)
+ finally:
+ warnings.filters[:] = save_warnings_filters[:]
+ return _with_warning_restore
+
def deprecated_err(func, *args):
- # The `warnings` module doesn't have an advertised way to restore
- # its filter list. Cheat.
- save_warnings_filters = warnings.filters[:]
- # Grrr, we need this function to warn every time. Without removing
- # the warningregistry, running test_tarfile then test_struct would fail
- # on 64-bit platforms.
- globals = func.func_globals
- if '__warningregistry__' in globals:
- del globals['__warningregistry__']
- warnings.filterwarnings("error", r"""^struct.*""", DeprecationWarning)
- warnings.filterwarnings("error", r""".*format requires.*""",
- DeprecationWarning)
try:
- try:
- func(*args)
- except (struct.error, TypeError):
- pass
- except DeprecationWarning:
- if not PY_STRUCT_OVERFLOW_MASKING:
- raise TestFailed, "%s%s expected to raise struct.error" % (
- func.__name__, args)
- else:
- raise TestFailed, "%s%s did not raise error" % (
+ func(*args)
+ except (struct.error, TypeError):
+ pass
+ except DeprecationWarning:
+ if not PY_STRUCT_OVERFLOW_MASKING:
+ raise TestFailed, "%s%s expected to raise struct.error" % (
func.__name__, args)
- finally:
- warnings.filters[:] = save_warnings_filters[:]
+ else:
+ raise TestFailed, "%s%s did not raise error" % (
+ func.__name__, args)
+deprecated_err = with_warning_restore(deprecated_err)
+
simple_err(struct.calcsize, 'Z')
@@ -475,6 +484,9 @@ def test_705836():
test_705836()
+###########################################################################
+# SF bug 1229380. No struct.pack exception for some out of range integers
+
def test_1229380():
import sys
for endian in ('', '>', '<'):
@@ -491,6 +503,37 @@ def test_1229380():
if PY_STRUCT_RANGE_CHECKING:
test_1229380()
+###########################################################################
+# SF bug 1530559. struct.pack raises TypeError where it used to convert.
+
+def check_float_coerce(format, number):
+ if PY_STRUCT_FLOAT_COERCE == 2:
+ # Test for pre-2.5 struct module
+ packed = struct.pack(format, number)
+ floored = struct.unpack(format, packed)[0]
+ if floored != int(number):
+ raise TestFailed("did not correcly coerce float to int")
+ return
+ try:
+ func(*args)
+ except (struct.error, TypeError):
+ if PY_STRUCT_FLOAT_COERCE:
+ raise TestFailed("expected DeprecationWarning for float coerce")
+ except DeprecationWarning:
+ if not PY_STRUCT_FLOAT_COERCE:
+ raise TestFailed("expected to raise struct.error for float coerce")
+ else:
+ raise TestFailed("did not raise error for float coerce")
+
+check_float_coerce = with_warning_restore(deprecated_err)
+
+def test_1530559():
+ for endian in ('', '>', '<'):
+ for fmt in ('B', 'H', 'I', 'L', 'b', 'h', 'i', 'l'):
+ check_float_coerce(endian + fmt, 1.0)
+ check_float_coerce(endian + fmt, 1.5)
+
+test_1530559()
###########################################################################
# Packing and unpacking to/from buffers.
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index edf5bd0..8c8ac40 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -27,6 +27,18 @@ def remove_stderr_debug_decorations(stderr):
return re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr)
class ProcessTestCase(unittest.TestCase):
+ def setUp(self):
+ # Try to minimize the number of children we have so this test
+ # doesn't crash on some buildbots (Alphas in particular).
+ if hasattr(test_support, "reap_children"):
+ test_support.reap_children()
+
+ def tearDown(self):
+ # Try to minimize the number of children we have so this test
+ # doesn't crash on some buildbots (Alphas in particular).
+ if hasattr(test_support, "reap_children"):
+ test_support.reap_children()
+
def mkstemp(self):
"""wrapper for mkstemp, calling mktemp if mkstemp is not available"""
if hasattr(tempfile, "mkstemp"):
@@ -56,7 +68,7 @@ class ProcessTestCase(unittest.TestCase):
subprocess.check_call([sys.executable, "-c",
"import sys; sys.exit(47)"])
except subprocess.CalledProcessError, e:
- self.assertEqual(e.errno, 47)
+ self.assertEqual(e.returncode, 47)
else:
self.fail("Expected CalledProcessError")
@@ -384,7 +396,8 @@ class ProcessTestCase(unittest.TestCase):
def test_no_leaking(self):
# Make sure we leak no resources
- if test_support.is_resource_enabled("subprocess") and not mswindows:
+ if not hasattr(test_support, "is_resource_enabled") \
+ or test_support.is_resource_enabled("subprocess") and not mswindows:
max_handles = 1026 # too much for most UNIX systems
else:
max_handles = 65
@@ -463,10 +476,36 @@ class ProcessTestCase(unittest.TestCase):
else:
self.fail("Expected OSError")
+ def _suppress_core_files(self):
+ """Try to prevent core files from being created.
+ Returns previous ulimit if successful, else None.
+ """
+ try:
+ import resource
+ old_limit = resource.getrlimit(resource.RLIMIT_CORE)
+ resource.setrlimit(resource.RLIMIT_CORE, (0,0))
+ return old_limit
+ except (ImportError, ValueError, resource.error):
+ return None
+
+ def _unsuppress_core_files(self, old_limit):
+ """Return core file behavior to default."""
+ if old_limit is None:
+ return
+ try:
+ import resource
+ resource.setrlimit(resource.RLIMIT_CORE, old_limit)
+ except (ImportError, ValueError, resource.error):
+ return
+
def test_run_abort(self):
# returncode handles signal termination
- p = subprocess.Popen([sys.executable,
- "-c", "import os; os.abort()"])
+ old_limit = self._suppress_core_files()
+ try:
+ p = subprocess.Popen([sys.executable,
+ "-c", "import os; os.abort()"])
+ finally:
+ self._unsuppress_core_files(old_limit)
p.wait()
self.assertEqual(-p.returncode, signal.SIGABRT)
@@ -599,6 +638,8 @@ class ProcessTestCase(unittest.TestCase):
def test_main():
test_support.run_unittest(ProcessTestCase)
+ if hasattr(test_support, "reap_children"):
+ test_support.reap_children()
if __name__ == "__main__":
test_main()
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 2d08f4d..a9d5dab 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -89,6 +89,24 @@ def requires(resource, msg=None):
msg = "Use of the `%s' resource not enabled" % resource
raise ResourceDenied(msg)
+def bind_port(sock, host='', preferred_port=54321):
+ """Try to bind the sock to a port. If we are running multiple
+ tests and we don't try multiple ports, the test can fails. This
+ makes the test more robust."""
+
+ import socket, errno
+ # some random ports that hopefully no one is listening on.
+ for port in [preferred_port, 9907, 10243, 32999]:
+ try:
+ sock.bind((host, port))
+ return port
+ except socket.error, (err, msg):
+ if err != errno.EADDRINUSE:
+ raise
+ print >>sys.__stderr__, \
+ ' WARNING: failed to listen on port %d, trying another' % port
+ raise TestFailed, 'unable to find port to listen on'
+
FUZZ = 1e-6
def fcmp(x, y): # fuzzy comparison function
@@ -296,6 +314,12 @@ _1M = 1024*1024
_1G = 1024 * _1M
_2G = 2 * _1G
+# Hack to get at the maximum value an internal index can take.
+class _Dummy:
+ def __getslice__(self, i, j):
+ return j
+MAX_Py_ssize_t = _Dummy()[:]
+
def set_memlimit(limit):
import re
global max_memuse
@@ -310,7 +334,9 @@ def set_memlimit(limit):
if m is None:
raise ValueError('Invalid memory limit %r' % (limit,))
memlimit = int(float(m.group(1)) * sizes[m.group(3).lower()])
- if memlimit < 2.5*_1G:
+ if memlimit > MAX_Py_ssize_t:
+ memlimit = MAX_Py_ssize_t
+ if memlimit < _2G - 1:
raise ValueError('Memory limit %r too low to be useful' % (limit,))
max_memuse = memlimit
@@ -353,6 +379,17 @@ def bigmemtest(minsize, memuse, overhead=5*_1M):
return wrapper
return decorator
+def bigaddrspacetest(f):
+ """Decorator for tests that fill the address space."""
+ def wrapper(self):
+ if max_memuse < MAX_Py_ssize_t:
+ if verbose:
+ sys.stderr.write("Skipping %s because of memory "
+ "constraint\n" % (f.__name__,))
+ else:
+ return f(self)
+ return wrapper
+
#=======================================================================
# Preliminary PyUNIT integration.
@@ -435,3 +472,46 @@ def run_doctest(module, verbosity=None):
if verbose:
print 'doctest (%s) ... %d tests with zero failures' % (module.__name__, t)
return f, t
+
+#=======================================================================
+# Threading support to prevent reporting refleaks when running regrtest.py -R
+
+def threading_setup():
+ import threading
+ return len(threading._active), len(threading._limbo)
+
+def threading_cleanup(num_active, num_limbo):
+ import threading
+ import time
+
+ _MAX_COUNT = 10
+ count = 0
+ while len(threading._active) != num_active and count < _MAX_COUNT:
+ count += 1
+ time.sleep(0.1)
+
+ count = 0
+ while len(threading._limbo) != num_limbo and count < _MAX_COUNT:
+ count += 1
+ time.sleep(0.1)
+
+def reap_children():
+ """Use this function at the end of test_main() whenever sub-processes
+ are started. This will help ensure that no extra children (zombies)
+ stick around to hog resources and create problems when looking
+ for refleaks.
+ """
+
+ # Reap all our dead child processes so we don't leave zombies around.
+ # These hog resources and might be causing some of the buildbots to die.
+ import os
+ if hasattr(os, 'waitpid'):
+ any_process = -1
+ while True:
+ try:
+ # This will raise an exception on Windows. That's ok.
+ pid, status = os.waitpid(any_process, os.WNOHANG)
+ if pid == 0:
+ break
+ except:
+ break
diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
index ae2a1c8..f1f1524 100644
--- a/Lib/test/test_sys.py
+++ b/Lib/test/test_sys.py
@@ -237,6 +237,90 @@ class SysModuleTest(unittest.TestCase):
is sys._getframe().f_code
)
+ # sys._current_frames() is a CPython-only gimmick.
+ def test_current_frames(self):
+ have_threads = True
+ try:
+ import thread
+ except ImportError:
+ have_threads = False
+
+ if have_threads:
+ self.current_frames_with_threads()
+ else:
+ self.current_frames_without_threads()
+
+ # Test sys._current_frames() in a WITH_THREADS build.
+ def current_frames_with_threads(self):
+ import threading, thread
+ import traceback
+
+ # Spawn a thread that blocks at a known place. Then the main
+ # thread does sys._current_frames(), and verifies that the frames
+ # returned make sense.
+ entered_g = threading.Event()
+ leave_g = threading.Event()
+ thread_info = [] # the thread's id
+
+ def f123():
+ g456()
+
+ def g456():
+ thread_info.append(thread.get_ident())
+ entered_g.set()
+ leave_g.wait()
+
+ t = threading.Thread(target=f123)
+ t.start()
+ entered_g.wait()
+
+ # At this point, t has finished its entered_g.set(), although it's
+ # impossible to guess whether it's still on that line or has moved on
+ # to its leave_g.wait().
+ self.assertEqual(len(thread_info), 1)
+ thread_id = thread_info[0]
+
+ d = sys._current_frames()
+
+ main_id = thread.get_ident()
+ self.assert_(main_id in d)
+ self.assert_(thread_id in d)
+
+ # Verify that the captured main-thread frame is _this_ frame.
+ frame = d.pop(main_id)
+ self.assert_(frame is sys._getframe())
+
+ # Verify that the captured thread frame is blocked in g456, called
+ # from f123. This is a litte tricky, since various bits of
+ # threading.py are also in the thread's call stack.
+ frame = d.pop(thread_id)
+ stack = traceback.extract_stack(frame)
+ for i, (filename, lineno, funcname, sourceline) in enumerate(stack):
+ if funcname == "f123":
+ break
+ else:
+ self.fail("didn't find f123() on thread's call stack")
+
+ self.assertEqual(sourceline, "g456()")
+
+ # And the next record must be for g456().
+ filename, lineno, funcname, sourceline = stack[i+1]
+ self.assertEqual(funcname, "g456")
+ self.assert_(sourceline in ["leave_g.wait()", "entered_g.set()"])
+
+ # Reap the spawned thread.
+ leave_g.set()
+ t.join()
+
+ # Test sys._current_frames() when thread support doesn't exist.
+ def current_frames_without_threads(self):
+ # Not much happens here: there is only one thread, with artificial
+ # "thread id" 0.
+ d = sys._current_frames()
+ self.assertEqual(len(d), 1)
+ self.assert_(0 in d)
+ self.assert_(d[0] is sys._getframe())
+
def test_attributes(self):
self.assert_(isinstance(sys.api_version, int))
self.assert_(isinstance(sys.argv, list))
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
index e3fbf98..fa170ef 100644
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -130,10 +130,8 @@ class TclTest(unittest.TestCase):
import os
old_display = None
import sys
- if (sys.platform.startswith('win') or
- sys.platform.startswith('darwin') or
- sys.platform.startswith('cygwin')):
- return # no failure possible on windows?
+ if sys.platform.startswith(('win', 'darwin', 'cygwin')):
+ return # no failure possible on windows?
if 'DISPLAY' in os.environ:
old_display = os.environ['DISPLAY']
del os.environ['DISPLAY']
diff --git a/Lib/test/test_textwrap.py b/Lib/test/test_textwrap.py
index 68e4d6d..500eceb 100644
--- a/Lib/test/test_textwrap.py
+++ b/Lib/test/test_textwrap.py
@@ -460,38 +460,42 @@ some (including a hanging indent).'''
# of IndentTestCase!
class DedentTestCase(unittest.TestCase):
+ def assertUnchanged(self, text):
+ """assert that dedent() has no effect on 'text'"""
+ self.assertEquals(text, dedent(text))
+
def test_dedent_nomargin(self):
# No lines indented.
text = "Hello there.\nHow are you?\nOh good, I'm glad."
- self.assertEquals(dedent(text), text)
+ self.assertUnchanged(text)
# Similar, with a blank line.
text = "Hello there.\n\nBoo!"
- self.assertEquals(dedent(text), text)
+ self.assertUnchanged(text)
# Some lines indented, but overall margin is still zero.
text = "Hello there.\n This is indented."
- self.assertEquals(dedent(text), text)
+ self.assertUnchanged(text)
# Again, add a blank line.
text = "Hello there.\n\n Boo!\n"
- self.assertEquals(dedent(text), text)
+ self.assertUnchanged(text)
def test_dedent_even(self):
# All lines indented by two spaces.
text = " Hello there.\n How are ya?\n Oh good."
expect = "Hello there.\nHow are ya?\nOh good."
- self.assertEquals(dedent(text), expect)
+ self.assertEquals(expect, dedent(text))
# Same, with blank lines.
text = " Hello there.\n\n How are ya?\n Oh good.\n"
expect = "Hello there.\n\nHow are ya?\nOh good.\n"
- self.assertEquals(dedent(text), expect)
+ self.assertEquals(expect, dedent(text))
# Now indent one of the blank lines.
text = " Hello there.\n \n How are ya?\n Oh good.\n"
expect = "Hello there.\n\nHow are ya?\nOh good.\n"
- self.assertEquals(dedent(text), expect)
+ self.assertEquals(expect, dedent(text))
def test_dedent_uneven(self):
# Lines indented unevenly.
@@ -505,18 +509,53 @@ def foo():
while 1:
return foo
'''
- self.assertEquals(dedent(text), expect)
+ self.assertEquals(expect, dedent(text))
# Uneven indentation with a blank line.
text = " Foo\n Bar\n\n Baz\n"
expect = "Foo\n Bar\n\n Baz\n"
- self.assertEquals(dedent(text), expect)
+ self.assertEquals(expect, dedent(text))
# Uneven indentation with a whitespace-only line.
text = " Foo\n Bar\n \n Baz\n"
expect = "Foo\n Bar\n\n Baz\n"
- self.assertEquals(dedent(text), expect)
-
+ self.assertEquals(expect, dedent(text))
+
+ # dedent() should not mangle internal tabs
+ def test_dedent_preserve_internal_tabs(self):
+ text = " hello\tthere\n how are\tyou?"
+ expect = "hello\tthere\nhow are\tyou?"
+ self.assertEquals(expect, dedent(text))
+
+ # make sure that it preserves tabs when it's not making any
+ # changes at all
+ self.assertEquals(expect, dedent(expect))
+
+ # dedent() should not mangle tabs in the margin (i.e.
+ # tabs and spaces both count as margin, but are *not*
+ # considered equivalent)
+ def test_dedent_preserve_margin_tabs(self):
+ text = " hello there\n\thow are you?"
+ self.assertUnchanged(text)
+
+ # same effect even if we have 8 spaces
+ text = " hello there\n\thow are you?"
+ self.assertUnchanged(text)
+
+ # dedent() only removes whitespace that can be uniformly removed!
+ text = "\thello there\n\thow are you?"
+ expect = "hello there\nhow are you?"
+ self.assertEquals(expect, dedent(text))
+
+ text = " \thello there\n \thow are you?"
+ self.assertEquals(expect, dedent(text))
+
+ text = " \t hello there\n \t how are you?"
+ self.assertEquals(expect, dedent(text))
+
+ text = " \thello there\n \t how are you?"
+ expect = "hello there\n how are you?"
+ self.assertEquals(expect, dedent(text))
def test_main():
diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py
index ea345b6..c4c21fe 100644
--- a/Lib/test/test_thread.py
+++ b/Lib/test/test_thread.py
@@ -115,3 +115,46 @@ for i in range(numtasks):
thread.start_new_thread(task2, (i,))
done.acquire()
print 'all tasks done'
+
+# not all platforms support changing thread stack size
+print '\n*** Changing thread stack size ***'
+if thread.stack_size() != 0:
+ raise ValueError, "initial stack_size not 0"
+
+thread.stack_size(0)
+if thread.stack_size() != 0:
+ raise ValueError, "stack_size not reset to default"
+
+from os import name as os_name
+if os_name in ("nt", "os2", "posix"):
+
+ tss_supported = 1
+ try:
+ thread.stack_size(4096)
+ except ValueError:
+ print 'caught expected ValueError setting stack_size(4096)'
+ except thread.error:
+ tss_supported = 0
+ print 'platform does not support changing thread stack size'
+
+ if tss_supported:
+ failed = lambda s, e: s != e
+ fail_msg = "stack_size(%d) failed - should succeed"
+ for tss in (262144, 0x100000, 0):
+ thread.stack_size(tss)
+ if failed(thread.stack_size(), tss):
+ raise ValueError, fail_msg % tss
+ print 'successfully set stack_size(%d)' % tss
+
+ for tss in (262144, 0x100000):
+ print 'trying stack_size = %d' % tss
+ next_ident = 0
+ for i in range(numtasks):
+ newtask()
+
+ print 'waiting for all tasks to complete'
+ done.acquire()
+ print 'all tasks done'
+
+ # reset stack size to default
+ thread.stack_size(0)
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py
index 0642d25..602ad2a 100644
--- a/Lib/test/test_threaded_import.py
+++ b/Lib/test/test_threaded_import.py
@@ -30,11 +30,10 @@ def test_import_hangers():
if verbose:
print "testing import hangers ...",
- from test import threaded_import_hangers
-
+ import test.threaded_import_hangers
try:
- if threaded_import_hangers.errors:
- raise TestFailed(threaded_import_hangers.errors)
+ if test.threaded_import_hangers.errors:
+ raise TestFailed(test.threaded_import_hangers.errors)
elif verbose:
print "OK."
finally:
diff --git a/Lib/test/test_threadedtempfile.py b/Lib/test/test_threadedtempfile.py
index 459ba3a..974333b 100644
--- a/Lib/test/test_threadedtempfile.py
+++ b/Lib/test/test_threadedtempfile.py
@@ -22,7 +22,7 @@ FILES_PER_THREAD = 50 # change w/ -f option
import thread # If this fails, we can't test this module
import threading
-from test.test_support import TestFailed
+from test.test_support import TestFailed, threading_setup, threading_cleanup
import StringIO
from traceback import print_exc
import tempfile
@@ -48,6 +48,7 @@ class TempFileGreedy(threading.Thread):
def test_main():
threads = []
+ thread_info = threading_setup()
print "Creating"
for i in range(NUM_THREADS):
@@ -72,6 +73,7 @@ def test_main():
if errors:
raise TestFailed(msg)
+ threading_cleanup(*thread_info)
if __name__ == "__main__":
import sys, getopt
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 7eb9758..79335ea 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -85,6 +85,32 @@ class ThreadTests(unittest.TestCase):
print 'all tasks done'
self.assertEqual(numrunning.get(), 0)
+ # run with a small(ish) thread stack size (256kB)
+ def test_various_ops_small_stack(self):
+ if verbose:
+ print 'with 256kB thread stack size...'
+ try:
+ threading.stack_size(262144)
+ except thread.error:
+ if verbose:
+ print 'platform does not support changing thread stack size'
+ return
+ self.test_various_ops()
+ threading.stack_size(0)
+
+ # run with a large thread stack size (1MB)
+ def test_various_ops_large_stack(self):
+ if verbose:
+ print 'with 1MB thread stack size...'
+ try:
+ threading.stack_size(0x100000)
+ except thread.error:
+ if verbose:
+ print 'platform does not support changing thread stack size'
+ return
+ self.test_various_ops()
+ threading.stack_size(0)
+
def test_foreign_thread(self):
# Check that a "foreign" thread can use the threading module.
def f(mutex):
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index 768e7a0..f4be759 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -39,9 +39,9 @@ class TimeTestCase(unittest.TestCase):
def test_strftime_bounds_checking(self):
# Make sure that strftime() checks the bounds of the various parts
- #of the time tuple.
+ #of the time tuple (0 is valid for *all* values).
- # Check year
+ # Check year [1900, max(int)]
self.assertRaises(ValueError, time.strftime, '',
(1899, 1, 1, 0, 0, 0, 0, 1, -1))
if time.accept2dyear:
@@ -49,27 +49,27 @@ class TimeTestCase(unittest.TestCase):
(-1, 1, 1, 0, 0, 0, 0, 1, -1))
self.assertRaises(ValueError, time.strftime, '',
(100, 1, 1, 0, 0, 0, 0, 1, -1))
- # Check month
+ # Check month [1, 12] + zero support
self.assertRaises(ValueError, time.strftime, '',
- (1900, 0, 1, 0, 0, 0, 0, 1, -1))
+ (1900, -1, 1, 0, 0, 0, 0, 1, -1))
self.assertRaises(ValueError, time.strftime, '',
(1900, 13, 1, 0, 0, 0, 0, 1, -1))
- # Check day of month
+ # Check day of month [1, 31] + zero support
self.assertRaises(ValueError, time.strftime, '',
- (1900, 1, 0, 0, 0, 0, 0, 1, -1))
+ (1900, 1, -1, 0, 0, 0, 0, 1, -1))
self.assertRaises(ValueError, time.strftime, '',
(1900, 1, 32, 0, 0, 0, 0, 1, -1))
- # Check hour
+ # Check hour [0, 23]
self.assertRaises(ValueError, time.strftime, '',
(1900, 1, 1, -1, 0, 0, 0, 1, -1))
self.assertRaises(ValueError, time.strftime, '',
(1900, 1, 1, 24, 0, 0, 0, 1, -1))
- # Check minute
+ # Check minute [0, 59]
self.assertRaises(ValueError, time.strftime, '',
(1900, 1, 1, 0, -1, 0, 0, 1, -1))
self.assertRaises(ValueError, time.strftime, '',
(1900, 1, 1, 0, 60, 0, 0, 1, -1))
- # Check second
+ # Check second [0, 61]
self.assertRaises(ValueError, time.strftime, '',
(1900, 1, 1, 0, 0, -1, 0, 1, -1))
# C99 only requires allowing for one leap second, but Python's docs say
@@ -82,17 +82,25 @@ class TimeTestCase(unittest.TestCase):
# modulo.
self.assertRaises(ValueError, time.strftime, '',
(1900, 1, 1, 0, 0, 0, -2, 1, -1))
- # Check day of the year
+ # Check day of the year [1, 366] + zero support
self.assertRaises(ValueError, time.strftime, '',
- (1900, 1, 1, 0, 0, 0, 0, 0, -1))
+ (1900, 1, 1, 0, 0, 0, 0, -1, -1))
self.assertRaises(ValueError, time.strftime, '',
(1900, 1, 1, 0, 0, 0, 0, 367, -1))
- # Check daylight savings flag
+ # Check daylight savings flag [-1, 1]
self.assertRaises(ValueError, time.strftime, '',
(1900, 1, 1, 0, 0, 0, 0, 1, -2))
self.assertRaises(ValueError, time.strftime, '',
(1900, 1, 1, 0, 0, 0, 0, 1, 2))
+ def test_default_values_for_zero(self):
+ # Make sure that using all zeros uses the proper default values.
+ # No test for daylight savings since strftime() does not change output
+ # based on its value.
+ expected = "2000 01 01 00 00 00 1 001"
+ result = time.strftime("%Y %m %d %H %M %S %w %j", (0,)*9)
+ self.assertEquals(expected, result)
+
def test_strptime(self):
tt = time.gmtime(self.t)
for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I',
@@ -193,13 +201,17 @@ class TimeTestCase(unittest.TestCase):
time.ctime(None)
def test_gmtime_without_arg(self):
- t0 = time.mktime(time.gmtime())
- t1 = time.mktime(time.gmtime(None))
+ gt0 = time.gmtime()
+ gt1 = time.gmtime(None)
+ t0 = time.mktime(gt0)
+ t1 = time.mktime(gt1)
self.assert_(0 <= (t1-t0) < 0.2)
def test_localtime_without_arg(self):
- t0 = time.mktime(time.localtime())
- t1 = time.mktime(time.localtime(None))
+ lt0 = time.localtime()
+ lt1 = time.localtime(None)
+ t0 = time.mktime(lt0)
+ t1 = time.mktime(lt1)
self.assert_(0 <= (t1-t0) < 0.2)
def test_main():
diff --git a/Lib/test/test_timeout.py b/Lib/test/test_timeout.py
index 4309e8c..2b32b92 100644
--- a/Lib/test/test_timeout.py
+++ b/Lib/test/test_timeout.py
@@ -100,7 +100,7 @@ class TimeoutTestCase(unittest.TestCase):
def setUp(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.addr_remote = ('www.python.org', 80)
+ self.addr_remote = ('www.python.org.', 80)
self.addr_local = ('127.0.0.1', 25339)
def tearDown(self):
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py
index 4f946f7..08aec8e 100644
--- a/Lib/test/test_trace.py
+++ b/Lib/test/test_trace.py
@@ -244,8 +244,8 @@ class TraceTestCase(unittest.TestCase):
self.run_test(one_instr_line)
def test_04_no_pop_blocks(self):
self.run_test(no_pop_blocks)
-## def test_05_no_pop_tops(self):
-## self.run_test(no_pop_tops)
+ def test_05_no_pop_tops(self):
+ self.run_test(no_pop_tops)
def test_06_call(self):
self.run_test(call)
def test_07_raise(self):
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 1b59f98..b3c5a50 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -31,8 +31,9 @@ class TracebackCases(unittest.TestCase):
err = self.get_exception_format(self.syntax_error_with_caret,
SyntaxError)
self.assert_(len(err) == 4)
- self.assert_("^" in err[2]) # third line has caret
self.assert_(err[1].strip() == "return x!")
+ self.assert_("^" in err[2]) # third line has caret
+ self.assert_(err[1].find("!") == err[2].find("^")) # in the right place
def test_nocaret(self):
if is_jython:
@@ -47,8 +48,9 @@ class TracebackCases(unittest.TestCase):
err = self.get_exception_format(self.syntax_error_bad_indentation,
IndentationError)
self.assert_(len(err) == 4)
- self.assert_("^" in err[2])
self.assert_(err[1].strip() == "print 2")
+ self.assert_("^" in err[2])
+ self.assert_(err[1].find("2") == err[2].find("^"))
def test_bug737473(self):
import sys, os, tempfile, time
@@ -109,6 +111,45 @@ def test():
lst = traceback.format_exception_only(e.__class__, e)
self.assertEqual(lst, ['KeyboardInterrupt\n'])
+ # String exceptions are deprecated, but legal. The quirky form with
+ # separate "type" and "value" tends to break things, because
+ # not isinstance(value, type)
+ # and a string cannot be the first argument to issubclass.
+ #
+ # Note that sys.last_type and sys.last_value do not get set if an
+ # exception is caught, so we sort of cheat and just emulate them.
+ #
+ # test_string_exception1 is equivalent to
+ #
+ # >>> raise "String Exception"
+ #
+ # test_string_exception2 is equivalent to
+ #
+ # >>> raise "String Exception", "String Value"
+ #
+ def test_string_exception1(self):
+ str_type = "String Exception"
+ err = traceback.format_exception_only(str_type, None)
+ self.assertEqual(len(err), 1)
+ self.assertEqual(err[0], str_type + '\n')
+
+ def test_string_exception2(self):
+ str_type = "String Exception"
+ str_value = "String Value"
+ err = traceback.format_exception_only(str_type, str_value)
+ self.assertEqual(len(err), 1)
+ self.assertEqual(err[0], str_type + ': ' + str_value + '\n')
+
+ def test_format_exception_only_bad__str__(self):
+ class X(Exception):
+ def __str__(self):
+ 1/0
+ err = traceback.format_exception_only(X, X())
+ self.assertEqual(len(err), 1)
+ str_value = '<unprintable %s object>' % X.__name__
+ self.assertEqual(err[0], X.__name__ + ': ' + str_value + '\n')
+
+
def test_main():
run_unittest(TracebackCases)
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index c575c0c..2d299c3 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -233,6 +233,7 @@ print 'Buffers'
try: buffer('asdf', -1)
except ValueError: pass
else: raise TestFailed, "buffer('asdf', -1) should raise ValueError"
+cmp(buffer("abc"), buffer("def")) # used to raise a warning: tp_compare didn't return -1, 0, or 1
try: buffer(None)
except TypeError: pass
@@ -276,3 +277,10 @@ else: raise TestFailed, "buffer assignment should raise TypeError"
try: a[0:1] = 'g'
except TypeError: pass
else: raise TestFailed, "buffer slice assignment should raise TypeError"
+
+# array.array() returns an object that does not implement a char buffer,
+# something which int() uses for conversion.
+import array
+try: int(buffer(array.array('c')))
+except TypeError :pass
+else: raise TestFailed, "char buffer (at C level) not working"
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 034b9d0..67218b8 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -676,11 +676,11 @@ class HandlerTests(unittest.TestCase):
r = MockResponse(200, "OK", {}, "")
newreq = h.do_request_(req)
if data is None: # GET
- self.assert_("Content-length" not in req.unredirected_hdrs)
- self.assert_("Content-type" not in req.unredirected_hdrs)
+ self.assert_("Content-Length" not in req.unredirected_hdrs)
+ self.assert_("Content-Type" not in req.unredirected_hdrs)
else: # POST
- self.assertEqual(req.unredirected_hdrs["Content-length"], "0")
- self.assertEqual(req.unredirected_hdrs["Content-type"],
+ self.assertEqual(req.unredirected_hdrs["Content-Length"], "0")
+ self.assertEqual(req.unredirected_hdrs["Content-Type"],
"application/x-www-form-urlencoded")
# XXX the details of Host could be better tested
self.assertEqual(req.unredirected_hdrs["Host"], "example.com")
@@ -692,8 +692,8 @@ class HandlerTests(unittest.TestCase):
req.add_unredirected_header("Host", "baz")
req.add_unredirected_header("Spam", "foo")
newreq = h.do_request_(req)
- self.assertEqual(req.unredirected_hdrs["Content-length"], "foo")
- self.assertEqual(req.unredirected_hdrs["Content-type"], "bar")
+ self.assertEqual(req.unredirected_hdrs["Content-Length"], "foo")
+ self.assertEqual(req.unredirected_hdrs["Content-Type"], "bar")
self.assertEqual(req.unredirected_hdrs["Host"], "baz")
self.assertEqual(req.unredirected_hdrs["Spam"], "foo")
@@ -847,7 +847,7 @@ class HandlerTests(unittest.TestCase):
407, 'Proxy-Authenticate: Basic realm="%s"\r\n\r\n' % realm)
opener.add_handler(auth_handler)
opener.add_handler(http_handler)
- self._test_basic_auth(opener, auth_handler, "Proxy-authorization",
+ self._test_basic_auth(opener, auth_handler, "Proxy-Authorization",
realm, http_handler, password_manager,
"http://acme.example.com:3128/protected",
"proxy.example.com:3128",
diff --git a/Lib/test/test_urllib2net.py b/Lib/test/test_urllib2net.py
index dc3d36d..00cf202 100644
--- a/Lib/test/test_urllib2net.py
+++ b/Lib/test/test_urllib2net.py
@@ -123,7 +123,7 @@ class urlopenNetworkTests(unittest.TestCase):
# domain will be spared to serve its defined
# purpose.
# urllib2.urlopen, "http://www.sadflkjsasadf.com/")
- urllib2.urlopen, "http://www.python.invalid/")
+ urllib2.urlopen, "http://www.python.invalid./")
class OtherNetworkTests(unittest.TestCase):
@@ -160,8 +160,8 @@ class OtherNetworkTests(unittest.TestCase):
"urllib2$")
urls = [
# Thanks to Fred for finding these!
- 'gopher://gopher.lib.ncsu.edu/11/library/stacks/Alex',
- 'gopher://gopher.vt.edu:10010/10/33',
+ 'gopher://gopher.lib.ncsu.edu./11/library/stacks/Alex',
+ 'gopher://gopher.vt.edu.:10010/10/33',
]
self._test_urls(urls, self._extra_handlers())
@@ -176,7 +176,7 @@ class OtherNetworkTests(unittest.TestCase):
# XXX bug, should raise URLError
#('file://nonsensename/etc/passwd', None, urllib2.URLError)
- ('file://nonsensename/etc/passwd', None, (OSError, socket.error))
+ ('file://nonsensename/etc/passwd', None, (EnvironmentError, socket.error))
]
self._test_urls(urls, self._extra_handlers())
finally:
@@ -239,7 +239,9 @@ class OtherNetworkTests(unittest.TestCase):
except (IOError, socket.error, OSError), err:
debug(err)
if expected_err:
- self.assert_(isinstance(err, expected_err))
+ msg = ("Didn't get expected error(s) %s for %s %s, got %s" %
+ (expected_err, url, req, err))
+ self.assert_(isinstance(err, expected_err), msg)
else:
buf = f.read()
f.close()
@@ -259,7 +261,6 @@ class OtherNetworkTests(unittest.TestCase):
return handlers
-
def test_main():
test_support.requires("network")
test_support.run_unittest(URLTimeoutTest, urlopenNetworkTests,
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
index 80761df..9105afe 100644
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -110,7 +110,7 @@ class urlopenNetworkTests(unittest.TestCase):
# domain will be spared to serve its defined
# purpose.
# urllib.urlopen, "http://www.sadflkjsasadf.com/")
- urllib.urlopen, "http://www.python.invalid/")
+ urllib.urlopen, "http://www.python.invalid./")
class urlretrieveNetworkTests(unittest.TestCase):
"""Tests urllib.urlretrieve using the network."""
diff --git a/Lib/test/test_uuid.py b/Lib/test/test_uuid.py
new file mode 100644
index 0000000..0586cfd
--- /dev/null
+++ b/Lib/test/test_uuid.py
@@ -0,0 +1,434 @@
+from unittest import TestCase
+from test import test_support
+import uuid
+
+def importable(name):
+ try:
+ __import__(name)
+ return True
+ except:
+ return False
+
+class TestUUID(TestCase):
+ last_node = None
+ source2node = {}
+
+ def test_UUID(self):
+ equal = self.assertEqual
+ ascending = []
+ for (string, curly, hex, bytes, fields, integer, urn,
+ time, clock_seq, variant, version) in [
+ ('00000000-0000-0000-0000-000000000000',
+ '{00000000-0000-0000-0000-000000000000}',
+ '00000000000000000000000000000000',
+ '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
+ (0, 0, 0, 0, 0, 0),
+ 0,
+ 'urn:uuid:00000000-0000-0000-0000-000000000000',
+ 0, 0, uuid.RESERVED_NCS, None),
+ ('00010203-0405-0607-0809-0a0b0c0d0e0f',
+ '{00010203-0405-0607-0809-0a0b0c0d0e0f}',
+ '000102030405060708090a0b0c0d0e0f',
+ '\0\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\x0d\x0e\x0f',
+ (0x00010203L, 0x0405, 0x0607, 8, 9, 0x0a0b0c0d0e0fL),
+ 0x000102030405060708090a0b0c0d0e0fL,
+ 'urn:uuid:00010203-0405-0607-0809-0a0b0c0d0e0f',
+ 0x607040500010203L, 0x809, uuid.RESERVED_NCS, None),
+ ('02d9e6d5-9467-382e-8f9b-9300a64ac3cd',
+ '{02d9e6d5-9467-382e-8f9b-9300a64ac3cd}',
+ '02d9e6d59467382e8f9b9300a64ac3cd',
+ '\x02\xd9\xe6\xd5\x94\x67\x38\x2e\x8f\x9b\x93\x00\xa6\x4a\xc3\xcd',
+ (0x02d9e6d5L, 0x9467, 0x382e, 0x8f, 0x9b, 0x9300a64ac3cdL),
+ 0x02d9e6d59467382e8f9b9300a64ac3cdL,
+ 'urn:uuid:02d9e6d5-9467-382e-8f9b-9300a64ac3cd',
+ 0x82e946702d9e6d5L, 0xf9b, uuid.RFC_4122, 3),
+ ('12345678-1234-5678-1234-567812345678',
+ '{12345678-1234-5678-1234-567812345678}',
+ '12345678123456781234567812345678',
+ '\x12\x34\x56\x78'*4,
+ (0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678),
+ 0x12345678123456781234567812345678,
+ 'urn:uuid:12345678-1234-5678-1234-567812345678',
+ 0x678123412345678L, 0x1234, uuid.RESERVED_NCS, None),
+ ('6ba7b810-9dad-11d1-80b4-00c04fd430c8',
+ '{6ba7b810-9dad-11d1-80b4-00c04fd430c8}',
+ '6ba7b8109dad11d180b400c04fd430c8',
+ '\x6b\xa7\xb8\x10\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
+ (0x6ba7b810L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
+ 0x6ba7b8109dad11d180b400c04fd430c8L,
+ 'urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8',
+ 0x1d19dad6ba7b810L, 0xb4, uuid.RFC_4122, 1),
+ ('6ba7b811-9dad-11d1-80b4-00c04fd430c8',
+ '{6ba7b811-9dad-11d1-80b4-00c04fd430c8}',
+ '6ba7b8119dad11d180b400c04fd430c8',
+ '\x6b\xa7\xb8\x11\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
+ (0x6ba7b811L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
+ 0x6ba7b8119dad11d180b400c04fd430c8L,
+ 'urn:uuid:6ba7b811-9dad-11d1-80b4-00c04fd430c8',
+ 0x1d19dad6ba7b811L, 0xb4, uuid.RFC_4122, 1),
+ ('6ba7b812-9dad-11d1-80b4-00c04fd430c8',
+ '{6ba7b812-9dad-11d1-80b4-00c04fd430c8}',
+ '6ba7b8129dad11d180b400c04fd430c8',
+ '\x6b\xa7\xb8\x12\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
+ (0x6ba7b812L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
+ 0x6ba7b8129dad11d180b400c04fd430c8L,
+ 'urn:uuid:6ba7b812-9dad-11d1-80b4-00c04fd430c8',
+ 0x1d19dad6ba7b812L, 0xb4, uuid.RFC_4122, 1),
+ ('6ba7b814-9dad-11d1-80b4-00c04fd430c8',
+ '{6ba7b814-9dad-11d1-80b4-00c04fd430c8}',
+ '6ba7b8149dad11d180b400c04fd430c8',
+ '\x6b\xa7\xb8\x14\x9d\xad\x11\xd1\x80\xb4\x00\xc0\x4f\xd4\x30\xc8',
+ (0x6ba7b814L, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00c04fd430c8L),
+ 0x6ba7b8149dad11d180b400c04fd430c8L,
+ 'urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8',
+ 0x1d19dad6ba7b814L, 0xb4, uuid.RFC_4122, 1),
+ ('7d444840-9dc0-11d1-b245-5ffdce74fad2',
+ '{7d444840-9dc0-11d1-b245-5ffdce74fad2}',
+ '7d4448409dc011d1b2455ffdce74fad2',
+ '\x7d\x44\x48\x40\x9d\xc0\x11\xd1\xb2\x45\x5f\xfd\xce\x74\xfa\xd2',
+ (0x7d444840L, 0x9dc0, 0x11d1, 0xb2, 0x45, 0x5ffdce74fad2L),
+ 0x7d4448409dc011d1b2455ffdce74fad2L,
+ 'urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2',
+ 0x1d19dc07d444840L, 0x3245, uuid.RFC_4122, 1),
+ ('e902893a-9d22-3c7e-a7b8-d6e313b71d9f',
+ '{e902893a-9d22-3c7e-a7b8-d6e313b71d9f}',
+ 'e902893a9d223c7ea7b8d6e313b71d9f',
+ '\xe9\x02\x89\x3a\x9d\x22\x3c\x7e\xa7\xb8\xd6\xe3\x13\xb7\x1d\x9f',
+ (0xe902893aL, 0x9d22, 0x3c7e, 0xa7, 0xb8, 0xd6e313b71d9fL),
+ 0xe902893a9d223c7ea7b8d6e313b71d9fL,
+ 'urn:uuid:e902893a-9d22-3c7e-a7b8-d6e313b71d9f',
+ 0xc7e9d22e902893aL, 0x27b8, uuid.RFC_4122, 3),
+ ('eb424026-6f54-4ef8-a4d0-bb658a1fc6cf',
+ '{eb424026-6f54-4ef8-a4d0-bb658a1fc6cf}',
+ 'eb4240266f544ef8a4d0bb658a1fc6cf',
+ '\xeb\x42\x40\x26\x6f\x54\x4e\xf8\xa4\xd0\xbb\x65\x8a\x1f\xc6\xcf',
+ (0xeb424026L, 0x6f54, 0x4ef8, 0xa4, 0xd0, 0xbb658a1fc6cfL),
+ 0xeb4240266f544ef8a4d0bb658a1fc6cfL,
+ 'urn:uuid:eb424026-6f54-4ef8-a4d0-bb658a1fc6cf',
+ 0xef86f54eb424026L, 0x24d0, uuid.RFC_4122, 4),
+ ('f81d4fae-7dec-11d0-a765-00a0c91e6bf6',
+ '{f81d4fae-7dec-11d0-a765-00a0c91e6bf6}',
+ 'f81d4fae7dec11d0a76500a0c91e6bf6',
+ '\xf8\x1d\x4f\xae\x7d\xec\x11\xd0\xa7\x65\x00\xa0\xc9\x1e\x6b\xf6',
+ (0xf81d4faeL, 0x7dec, 0x11d0, 0xa7, 0x65, 0x00a0c91e6bf6L),
+ 0xf81d4fae7dec11d0a76500a0c91e6bf6L,
+ 'urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6',
+ 0x1d07decf81d4faeL, 0x2765, uuid.RFC_4122, 1),
+ ('fffefdfc-fffe-fffe-fffe-fffefdfcfbfa',
+ '{fffefdfc-fffe-fffe-fffe-fffefdfcfbfa}',
+ 'fffefdfcfffefffefffefffefdfcfbfa',
+ '\xff\xfe\xfd\xfc\xff\xfe\xff\xfe\xff\xfe\xff\xfe\xfd\xfc\xfb\xfa',
+ (0xfffefdfcL, 0xfffe, 0xfffe, 0xff, 0xfe, 0xfffefdfcfbfaL),
+ 0xfffefdfcfffefffefffefffefdfcfbfaL,
+ 'urn:uuid:fffefdfc-fffe-fffe-fffe-fffefdfcfbfa',
+ 0xffefffefffefdfcL, 0x3ffe, uuid.RESERVED_FUTURE, None),
+ ('ffffffff-ffff-ffff-ffff-ffffffffffff',
+ '{ffffffff-ffff-ffff-ffff-ffffffffffff}',
+ 'ffffffffffffffffffffffffffffffff',
+ '\xff'*16,
+ (0xffffffffL, 0xffffL, 0xffffL, 0xff, 0xff, 0xffffffffffffL),
+ 0xffffffffffffffffffffffffffffffffL,
+ 'urn:uuid:ffffffff-ffff-ffff-ffff-ffffffffffff',
+ 0xfffffffffffffffL, 0x3fff, uuid.RESERVED_FUTURE, None),
+ ]:
+ equivalents = []
+ # Construct each UUID in several different ways.
+ for u in [uuid.UUID(string), uuid.UUID(curly), uuid.UUID(hex),
+ uuid.UUID(bytes=bytes), uuid.UUID(fields=fields),
+ uuid.UUID(int=integer), uuid.UUID(urn)]:
+ # Test all conversions and properties of the UUID object.
+ equal(str(u), string)
+ equal(int(u), integer)
+ equal(u.bytes, bytes)
+ equal(u.fields, fields)
+ equal(u.time_low, fields[0])
+ equal(u.time_mid, fields[1])
+ equal(u.time_hi_version, fields[2])
+ equal(u.clock_seq_hi_variant, fields[3])
+ equal(u.clock_seq_low, fields[4])
+ equal(u.node, fields[5])
+ equal(u.hex, hex)
+ equal(u.int, integer)
+ equal(u.urn, urn)
+ equal(u.time, time)
+ equal(u.clock_seq, clock_seq)
+ equal(u.variant, variant)
+ equal(u.version, version)
+ equivalents.append(u)
+
+ # Different construction methods should give the same UUID.
+ for u in equivalents:
+ for v in equivalents:
+ equal(u, v)
+ ascending.append(u)
+
+ # Test comparison of UUIDs.
+ for i in range(len(ascending)):
+ for j in range(len(ascending)):
+ equal(cmp(i, j), cmp(ascending[i], ascending[j]))
+
+ # Test sorting of UUIDs (above list is in ascending order).
+ resorted = ascending[:]
+ resorted.reverse()
+ resorted.sort()
+ equal(ascending, resorted)
+
+ def test_exceptions(self):
+ badvalue = lambda f: self.assertRaises(ValueError, f)
+ badtype = lambda f: self.assertRaises(TypeError, f)
+
+ # Badly formed hex strings.
+ badvalue(lambda: uuid.UUID(''))
+ badvalue(lambda: uuid.UUID('abc'))
+ badvalue(lambda: uuid.UUID('1234567812345678123456781234567'))
+ badvalue(lambda: uuid.UUID('123456781234567812345678123456789'))
+ badvalue(lambda: uuid.UUID('123456781234567812345678z2345678'))
+
+ # Badly formed bytes.
+ badvalue(lambda: uuid.UUID(bytes='abc'))
+ badvalue(lambda: uuid.UUID(bytes='\0'*15))
+ badvalue(lambda: uuid.UUID(bytes='\0'*17))
+
+ # Badly formed fields.
+ badvalue(lambda: uuid.UUID(fields=(1,)))
+ badvalue(lambda: uuid.UUID(fields=(1, 2, 3, 4, 5)))
+ badvalue(lambda: uuid.UUID(fields=(1, 2, 3, 4, 5, 6, 7)))
+
+ # Field values out of range.
+ badvalue(lambda: uuid.UUID(fields=(-1, 0, 0, 0, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0x100000000L, 0, 0, 0, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, -1, 0, 0, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0x10000L, 0, 0, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, -1, 0, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0x10000L, 0, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, -1, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0x100L, 0, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, -1, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0x100L, 0)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0, -1)))
+ badvalue(lambda: uuid.UUID(fields=(0, 0, 0, 0, 0, 0x1000000000000L)))
+
+ # Version number out of range.
+ badvalue(lambda: uuid.UUID('00'*16, version=0))
+ badvalue(lambda: uuid.UUID('00'*16, version=6))
+
+ # Integer value out of range.
+ badvalue(lambda: uuid.UUID(int=-1))
+ badvalue(lambda: uuid.UUID(int=1<<128L))
+
+ # Must supply exactly one of hex, bytes, fields, int.
+ h, b, f, i = '00'*16, '\0'*16, (0, 0, 0, 0, 0, 0), 0
+ uuid.UUID(h)
+ uuid.UUID(hex=h)
+ uuid.UUID(bytes=b)
+ uuid.UUID(fields=f)
+ uuid.UUID(int=i)
+
+ # Wrong number of arguments (positional).
+ badtype(lambda: uuid.UUID())
+ badtype(lambda: uuid.UUID(h, b))
+ badtype(lambda: uuid.UUID(h, b, f))
+ badtype(lambda: uuid.UUID(h, b, f, i))
+
+ # Duplicate arguments (named).
+ badtype(lambda: uuid.UUID(hex=h, bytes=b))
+ badtype(lambda: uuid.UUID(hex=h, fields=f))
+ badtype(lambda: uuid.UUID(hex=h, int=i))
+ badtype(lambda: uuid.UUID(bytes=b, fields=f))
+ badtype(lambda: uuid.UUID(bytes=b, int=i))
+ badtype(lambda: uuid.UUID(fields=f, int=i))
+ badtype(lambda: uuid.UUID(hex=h, bytes=b, fields=f))
+ badtype(lambda: uuid.UUID(hex=h, bytes=b, int=i))
+ badtype(lambda: uuid.UUID(hex=h, fields=f, int=i))
+ badtype(lambda: uuid.UUID(bytes=b, int=i, fields=f))
+ badtype(lambda: uuid.UUID(hex=h, bytes=b, int=i, fields=f))
+
+ # Duplicate arguments (positional and named).
+ badtype(lambda: uuid.UUID(h, hex=h))
+ badtype(lambda: uuid.UUID(h, bytes=b))
+ badtype(lambda: uuid.UUID(h, fields=f))
+ badtype(lambda: uuid.UUID(h, int=i))
+ badtype(lambda: uuid.UUID(h, hex=h, bytes=b))
+ badtype(lambda: uuid.UUID(h, hex=h, fields=f))
+ badtype(lambda: uuid.UUID(h, hex=h, int=i))
+ badtype(lambda: uuid.UUID(h, bytes=b, fields=f))
+ badtype(lambda: uuid.UUID(h, bytes=b, int=i))
+ badtype(lambda: uuid.UUID(h, fields=f, int=i))
+ badtype(lambda: uuid.UUID(h, hex=h, bytes=b, fields=f))
+ badtype(lambda: uuid.UUID(h, hex=h, bytes=b, int=i))
+ badtype(lambda: uuid.UUID(h, hex=h, fields=f, int=i))
+ badtype(lambda: uuid.UUID(h, bytes=b, int=i, fields=f))
+ badtype(lambda: uuid.UUID(h, hex=h, bytes=b, int=i, fields=f))
+
+ # Immutability.
+ u = uuid.UUID(h)
+ badtype(lambda: setattr(u, 'hex', h))
+ badtype(lambda: setattr(u, 'bytes', b))
+ badtype(lambda: setattr(u, 'fields', f))
+ badtype(lambda: setattr(u, 'int', i))
+
+ def check_node(self, node, source):
+ individual_group_bit = (node >> 40L) & 1
+ universal_local_bit = (node >> 40L) & 2
+ message = "%012x doesn't look like a real MAC address" % node
+ self.assertEqual(individual_group_bit, 0, message)
+ self.assertEqual(universal_local_bit, 0, message)
+ self.assertNotEqual(node, 0, message)
+ self.assertNotEqual(node, 0xffffffffffffL, message)
+ self.assert_(0 <= node, message)
+ self.assert_(node < (1L << 48), message)
+
+ TestUUID.source2node[source] = node
+ if TestUUID.last_node:
+ if TestUUID.last_node != node:
+ msg = "different sources disagree on node:\n"
+ for s, n in TestUUID.source2node.iteritems():
+ msg += " from source %r, node was %012x\n" % (s, n)
+ # There's actually no reason to expect the MAC addresses
+ # to agree across various methods -- e.g., a box may have
+ # multiple network interfaces, and different ways of getting
+ # a MAC address may favor different HW.
+ ##self.fail(msg)
+ else:
+ TestUUID.last_node = node
+
+ def test_ifconfig_getnode(self):
+ import sys
+ print >>sys.__stdout__, \
+""" WARNING: uuid._ifconfig_getnode is unreliable on many platforms.
+ It is disabled until the code and/or test can be fixed properly."""
+ return
+
+ import os
+ if os.name == 'posix':
+ node = uuid._ifconfig_getnode()
+ if node is not None:
+ self.check_node(node, 'ifconfig')
+
+ def test_ipconfig_getnode(self):
+ import os
+ if os.name == 'nt':
+ node = uuid._ipconfig_getnode()
+ if node is not None:
+ self.check_node(node, 'ipconfig')
+
+ def test_netbios_getnode(self):
+ if importable('win32wnet') and importable('netbios'):
+ self.check_node(uuid._netbios_getnode(), 'netbios')
+
+ def test_random_getnode(self):
+ node = uuid._random_getnode()
+ self.assert_(0 <= node)
+ self.assert_(node < (1L <<48))
+
+ def test_unixdll_getnode(self):
+ import sys
+ print >>sys.__stdout__, \
+""" WARNING: uuid._unixdll_getnode is unreliable on many platforms.
+ It is disabled until the code and/or test can be fixed properly."""
+ return
+
+ import os
+ if importable('ctypes') and os.name == 'posix':
+ self.check_node(uuid._unixdll_getnode(), 'unixdll')
+
+ def test_windll_getnode(self):
+ import os
+ if importable('ctypes') and os.name == 'nt':
+ self.check_node(uuid._windll_getnode(), 'windll')
+
+ def test_getnode(self):
+ import sys
+ print >>sys.__stdout__, \
+""" WARNING: uuid.getnode is unreliable on many platforms.
+ It is disabled until the code and/or test can be fixed properly."""
+ return
+
+ node1 = uuid.getnode()
+ self.check_node(node1, "getnode1")
+
+ # Test it again to ensure consistency.
+ node2 = uuid.getnode()
+ self.check_node(node2, "getnode2")
+
+ self.assertEqual(node1, node2)
+
+ def test_uuid1(self):
+ equal = self.assertEqual
+
+ # Make sure uuid4() generates UUIDs that are actually version 1.
+ for u in [uuid.uuid1() for i in range(10)]:
+ equal(u.variant, uuid.RFC_4122)
+ equal(u.version, 1)
+
+ # Make sure the supplied node ID appears in the UUID.
+ u = uuid.uuid1(0)
+ equal(u.node, 0)
+ u = uuid.uuid1(0x123456789abc)
+ equal(u.node, 0x123456789abc)
+ u = uuid.uuid1(0xffffffffffff)
+ equal(u.node, 0xffffffffffff)
+
+ # Make sure the supplied clock sequence appears in the UUID.
+ u = uuid.uuid1(0x123456789abc, 0)
+ equal(u.node, 0x123456789abc)
+ equal(((u.clock_seq_hi_variant & 0x3f) << 8) | u.clock_seq_low, 0)
+ u = uuid.uuid1(0x123456789abc, 0x1234)
+ equal(u.node, 0x123456789abc)
+ equal(((u.clock_seq_hi_variant & 0x3f) << 8) |
+ u.clock_seq_low, 0x1234)
+ u = uuid.uuid1(0x123456789abc, 0x3fff)
+ equal(u.node, 0x123456789abc)
+ equal(((u.clock_seq_hi_variant & 0x3f) << 8) |
+ u.clock_seq_low, 0x3fff)
+
+ def test_uuid3(self):
+ equal = self.assertEqual
+
+ # Test some known version-3 UUIDs.
+ for u, v in [(uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org'),
+ '6fa459ea-ee8a-3ca4-894e-db77e160355e'),
+ (uuid.uuid3(uuid.NAMESPACE_URL, 'http://python.org/'),
+ '9fe8e8c4-aaa8-32a9-a55c-4535a88b748d'),
+ (uuid.uuid3(uuid.NAMESPACE_OID, '1.3.6.1'),
+ 'dd1a1cef-13d5-368a-ad82-eca71acd4cd1'),
+ (uuid.uuid3(uuid.NAMESPACE_X500, 'c=ca'),
+ '658d3002-db6b-3040-a1d1-8ddd7d189a4d'),
+ ]:
+ equal(u.variant, uuid.RFC_4122)
+ equal(u.version, 3)
+ equal(u, uuid.UUID(v))
+ equal(str(u), v)
+
+ def test_uuid4(self):
+ equal = self.assertEqual
+
+ # Make sure uuid4() generates UUIDs that are actually version 4.
+ for u in [uuid.uuid4() for i in range(10)]:
+ equal(u.variant, uuid.RFC_4122)
+ equal(u.version, 4)
+
+ def test_uuid5(self):
+ equal = self.assertEqual
+
+ # Test some known version-5 UUIDs.
+ for u, v in [(uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org'),
+ '886313e1-3b8a-5372-9b90-0c9aee199e5d'),
+ (uuid.uuid5(uuid.NAMESPACE_URL, 'http://python.org/'),
+ '4c565f0d-3f5a-5890-b41b-20cf47701c5e'),
+ (uuid.uuid5(uuid.NAMESPACE_OID, '1.3.6.1'),
+ '1447fa61-5277-5fef-a9b3-fbc6e44f4af3'),
+ (uuid.uuid5(uuid.NAMESPACE_X500, 'c=ca'),
+ 'cc957dd1-a972-5349-98cd-874190002798'),
+ ]:
+ equal(u.variant, uuid.RFC_4122)
+ equal(u.version, 5)
+ equal(u, uuid.UUID(v))
+ equal(str(u), v)
+
+
+def test_main():
+ test_support.run_unittest(TestUUID)
+
+if __name__ == '__main__':
+ test_main()
diff --git a/Lib/test/test_wait3.py b/Lib/test/test_wait3.py
index f6a41a6..9de64b2 100644
--- a/Lib/test/test_wait3.py
+++ b/Lib/test/test_wait3.py
@@ -2,8 +2,9 @@
"""
import os
+import time
from test.fork_wait import ForkWait
-from test.test_support import TestSkipped, run_unittest
+from test.test_support import TestSkipped, run_unittest, reap_children
try:
os.fork
@@ -17,16 +18,21 @@ except AttributeError:
class Wait3Test(ForkWait):
def wait_impl(self, cpid):
- while 1:
- spid, status, rusage = os.wait3(0)
+ for i in range(10):
+ # wait3() shouldn't hang, but some of the buildbots seem to hang
+ # in the forking tests. This is an attempt to fix the problem.
+ spid, status, rusage = os.wait3(os.WNOHANG)
if spid == cpid:
break
+ time.sleep(1.0)
+
self.assertEqual(spid, cpid)
self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
self.assertTrue(rusage)
def test_main():
run_unittest(Wait3Test)
+ reap_children()
if __name__ == "__main__":
test_main()
diff --git a/Lib/test/test_wait4.py b/Lib/test/test_wait4.py
index 027e5c3..9f7fc14 100644
--- a/Lib/test/test_wait4.py
+++ b/Lib/test/test_wait4.py
@@ -2,8 +2,9 @@
"""
import os
+import time
from test.fork_wait import ForkWait
-from test.test_support import TestSkipped, run_unittest
+from test.test_support import TestSkipped, run_unittest, reap_children
try:
os.fork
@@ -17,13 +18,20 @@ except AttributeError:
class Wait4Test(ForkWait):
def wait_impl(self, cpid):
- spid, status, rusage = os.wait4(cpid, 0)
+ for i in range(10):
+ # wait4() shouldn't hang, but some of the buildbots seem to hang
+ # in the forking tests. This is an attempt to fix the problem.
+ spid, status, rusage = os.wait4(cpid, os.WNOHANG)
+ if spid == cpid:
+ break
+ time.sleep(1.0)
self.assertEqual(spid, cpid)
self.assertEqual(status, 0, "cause = %d, exit = %d" % (status&0xff, status>>8))
self.assertTrue(rusage)
def test_main():
run_unittest(Wait4Test)
+ reap_children()
if __name__ == "__main__":
test_main()
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
index 5d051a5..a7ccb6b 100644
--- a/Lib/test/test_warnings.py
+++ b/Lib/test/test_warnings.py
@@ -81,6 +81,19 @@ class TestModule(unittest.TestCase):
self.assertEqual(msg.message, text)
self.assertEqual(msg.category, 'UserWarning')
+ def test_options(self):
+ # Uses the private _setoption() function to test the parsing
+ # of command-line warning arguments
+ self.assertRaises(warnings._OptionError,
+ warnings._setoption, '1:2:3:4:5:6')
+ self.assertRaises(warnings._OptionError,
+ warnings._setoption, 'bogus::Warning')
+ self.assertRaises(warnings._OptionError,
+ warnings._setoption, 'ignore:2::4:-5')
+ warnings._setoption('error::Warning::0')
+ self.assertRaises(UserWarning, warnings.warn, 'convert to error')
+
+
def test_main(verbose=None):
# Obscure hack so that this test passes after reloads or repeated calls
# to test_main (regrtest -R).
diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py
index a9bc962..5830fd6 100644
--- a/Lib/test/test_winreg.py
+++ b/Lib/test/test_winreg.py
@@ -151,3 +151,6 @@ if remote_name is not None:
else:
print "Remote registry calls can be tested using",
print "'test_winreg.py --remote \\\\machine_name'"
+ # perform minimal ConnectRegistry test which just invokes it
+ h = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
+ h.Close()
diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py
new file mode 100755
index 0000000..1ec271b
--- /dev/null
+++ b/Lib/test/test_wsgiref.py
@@ -0,0 +1,615 @@
+from __future__ import nested_scopes # Backward compat for 2.1
+from unittest import TestSuite, TestCase, makeSuite
+from wsgiref.util import setup_testing_defaults
+from wsgiref.headers import Headers
+from wsgiref.handlers import BaseHandler, BaseCGIHandler
+from wsgiref import util
+from wsgiref.validate import validator
+from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, demo_app
+from wsgiref.simple_server import make_server
+from StringIO import StringIO
+from SocketServer import BaseServer
+import re, sys
+
+
+class MockServer(WSGIServer):
+ """Non-socket HTTP server"""
+
+ def __init__(self, server_address, RequestHandlerClass):
+ BaseServer.__init__(self, server_address, RequestHandlerClass)
+ self.server_bind()
+
+ def server_bind(self):
+ host, port = self.server_address
+ self.server_name = host
+ self.server_port = port
+ self.setup_environ()
+
+
+class MockHandler(WSGIRequestHandler):
+ """Non-socket HTTP handler"""
+ def setup(self):
+ self.connection = self.request
+ self.rfile, self.wfile = self.connection
+
+ def finish(self):
+ pass
+
+
+
+
+
+def hello_app(environ,start_response):
+ start_response("200 OK", [
+ ('Content-Type','text/plain'),
+ ('Date','Mon, 05 Jun 2006 18:49:54 GMT')
+ ])
+ return ["Hello, world!"]
+
+def run_amock(app=hello_app, data="GET / HTTP/1.0\n\n"):
+ server = make_server("", 80, app, MockServer, MockHandler)
+ inp, out, err, olderr = StringIO(data), StringIO(), StringIO(), sys.stderr
+ sys.stderr = err
+
+ try:
+ server.finish_request((inp,out), ("127.0.0.1",8888))
+ finally:
+ sys.stderr = olderr
+
+ return out.getvalue(), err.getvalue()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+def compare_generic_iter(make_it,match):
+ """Utility to compare a generic 2.1/2.2+ iterator with an iterable
+
+ If running under Python 2.2+, this tests the iterator using iter()/next(),
+ as well as __getitem__. 'make_it' must be a function returning a fresh
+ iterator to be tested (since this may test the iterator twice)."""
+
+ it = make_it()
+ n = 0
+ for item in match:
+ if not it[n]==item: raise AssertionError
+ n+=1
+ try:
+ it[n]
+ except IndexError:
+ pass
+ else:
+ raise AssertionError("Too many items from __getitem__",it)
+
+ try:
+ iter, StopIteration
+ except NameError:
+ pass
+ else:
+ # Only test iter mode under 2.2+
+ it = make_it()
+ if not iter(it) is it: raise AssertionError
+ for item in match:
+ if not it.next()==item: raise AssertionError
+ try:
+ it.next()
+ except StopIteration:
+ pass
+ else:
+ raise AssertionError("Too many items from .next()",it)
+
+
+
+
+
+
+class IntegrationTests(TestCase):
+
+ def check_hello(self, out, has_length=True):
+ self.assertEqual(out,
+ "HTTP/1.0 200 OK\r\n"
+ "Server: WSGIServer/0.1 Python/"+sys.version.split()[0]+"\r\n"
+ "Content-Type: text/plain\r\n"
+ "Date: Mon, 05 Jun 2006 18:49:54 GMT\r\n" +
+ (has_length and "Content-Length: 13\r\n" or "") +
+ "\r\n"
+ "Hello, world!"
+ )
+
+ def test_plain_hello(self):
+ out, err = run_amock()
+ self.check_hello(out)
+
+ def test_validated_hello(self):
+ out, err = run_amock(validator(hello_app))
+ # the middleware doesn't support len(), so content-length isn't there
+ self.check_hello(out, has_length=False)
+
+ def test_simple_validation_error(self):
+ def bad_app(environ,start_response):
+ start_response("200 OK", ('Content-Type','text/plain'))
+ return ["Hello, world!"]
+ out, err = run_amock(validator(bad_app))
+ self.failUnless(out.endswith(
+ "A server error occurred. Please contact the administrator."
+ ))
+ self.assertEqual(
+ err.splitlines()[-2],
+ "AssertionError: Headers (('Content-Type', 'text/plain')) must"
+ " be of type list: <type 'tuple'>"
+ )
+
+
+
+
+
+
+class UtilityTests(TestCase):
+
+ def checkShift(self,sn_in,pi_in,part,sn_out,pi_out):
+ env = {'SCRIPT_NAME':sn_in,'PATH_INFO':pi_in}
+ util.setup_testing_defaults(env)
+ self.assertEqual(util.shift_path_info(env),part)
+ self.assertEqual(env['PATH_INFO'],pi_out)
+ self.assertEqual(env['SCRIPT_NAME'],sn_out)
+ return env
+
+ def checkDefault(self, key, value, alt=None):
+ # Check defaulting when empty
+ env = {}
+ util.setup_testing_defaults(env)
+ if isinstance(value,StringIO):
+ self.failUnless(isinstance(env[key],StringIO))
+ else:
+ self.assertEqual(env[key],value)
+
+ # Check existing value
+ env = {key:alt}
+ util.setup_testing_defaults(env)
+ self.failUnless(env[key] is alt)
+
+ def checkCrossDefault(self,key,value,**kw):
+ util.setup_testing_defaults(kw)
+ self.assertEqual(kw[key],value)
+
+ def checkAppURI(self,uri,**kw):
+ util.setup_testing_defaults(kw)
+ self.assertEqual(util.application_uri(kw),uri)
+
+ def checkReqURI(self,uri,query=1,**kw):
+ util.setup_testing_defaults(kw)
+ self.assertEqual(util.request_uri(kw,query),uri)
+
+
+
+
+
+
+ def checkFW(self,text,size,match):
+
+ def make_it(text=text,size=size):
+ return util.FileWrapper(StringIO(text),size)
+
+ compare_generic_iter(make_it,match)
+
+ it = make_it()
+ self.failIf(it.filelike.closed)
+
+ for item in it:
+ pass
+
+ self.failIf(it.filelike.closed)
+
+ it.close()
+ self.failUnless(it.filelike.closed)
+
+
+ def testSimpleShifts(self):
+ self.checkShift('','/', '', '/', '')
+ self.checkShift('','/x', 'x', '/x', '')
+ self.checkShift('/','', None, '/', '')
+ self.checkShift('/a','/x/y', 'x', '/a/x', '/y')
+ self.checkShift('/a','/x/', 'x', '/a/x', '/')
+
+
+ def testNormalizedShifts(self):
+ self.checkShift('/a/b', '/../y', '..', '/a', '/y')
+ self.checkShift('', '/../y', '..', '', '/y')
+ self.checkShift('/a/b', '//y', 'y', '/a/b/y', '')
+ self.checkShift('/a/b', '//y/', 'y', '/a/b/y', '/')
+ self.checkShift('/a/b', '/./y', 'y', '/a/b/y', '')
+ self.checkShift('/a/b', '/./y/', 'y', '/a/b/y', '/')
+ self.checkShift('/a/b', '///./..//y/.//', '..', '/a', '/y/')
+ self.checkShift('/a/b', '///', '', '/a/b/', '')
+ self.checkShift('/a/b', '/.//', '', '/a/b/', '')
+ self.checkShift('/a/b', '/x//', 'x', '/a/b/x', '/')
+ self.checkShift('/a/b', '/.', None, '/a/b', '')
+
+
+ def testDefaults(self):
+ for key, value in [
+ ('SERVER_NAME','127.0.0.1'),
+ ('SERVER_PORT', '80'),
+ ('SERVER_PROTOCOL','HTTP/1.0'),
+ ('HTTP_HOST','127.0.0.1'),
+ ('REQUEST_METHOD','GET'),
+ ('SCRIPT_NAME',''),
+ ('PATH_INFO','/'),
+ ('wsgi.version', (1,0)),
+ ('wsgi.run_once', 0),
+ ('wsgi.multithread', 0),
+ ('wsgi.multiprocess', 0),
+ ('wsgi.input', StringIO("")),
+ ('wsgi.errors', StringIO()),
+ ('wsgi.url_scheme','http'),
+ ]:
+ self.checkDefault(key,value)
+
+
+ def testCrossDefaults(self):
+ self.checkCrossDefault('HTTP_HOST',"foo.bar",SERVER_NAME="foo.bar")
+ self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="on")
+ self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="1")
+ self.checkCrossDefault('wsgi.url_scheme',"https",HTTPS="yes")
+ self.checkCrossDefault('wsgi.url_scheme',"http",HTTPS="foo")
+ self.checkCrossDefault('SERVER_PORT',"80",HTTPS="foo")
+ self.checkCrossDefault('SERVER_PORT',"443",HTTPS="on")
+
+
+ def testGuessScheme(self):
+ self.assertEqual(util.guess_scheme({}), "http")
+ self.assertEqual(util.guess_scheme({'HTTPS':"foo"}), "http")
+ self.assertEqual(util.guess_scheme({'HTTPS':"on"}), "https")
+ self.assertEqual(util.guess_scheme({'HTTPS':"yes"}), "https")
+ self.assertEqual(util.guess_scheme({'HTTPS':"1"}), "https")
+
+
+
+
+
+ def testAppURIs(self):
+ self.checkAppURI("http://127.0.0.1/")
+ self.checkAppURI("http://127.0.0.1/spam", SCRIPT_NAME="/spam")
+ self.checkAppURI("http://spam.example.com:2071/",
+ HTTP_HOST="spam.example.com:2071", SERVER_PORT="2071")
+ self.checkAppURI("http://spam.example.com/",
+ SERVER_NAME="spam.example.com")
+ self.checkAppURI("http://127.0.0.1/",
+ HTTP_HOST="127.0.0.1", SERVER_NAME="spam.example.com")
+ self.checkAppURI("https://127.0.0.1/", HTTPS="on")
+ self.checkAppURI("http://127.0.0.1:8000/", SERVER_PORT="8000",
+ HTTP_HOST=None)
+
+ def testReqURIs(self):
+ self.checkReqURI("http://127.0.0.1/")
+ self.checkReqURI("http://127.0.0.1/spam", SCRIPT_NAME="/spam")
+ self.checkReqURI("http://127.0.0.1/spammity/spam",
+ SCRIPT_NAME="/spammity", PATH_INFO="/spam")
+ self.checkReqURI("http://127.0.0.1/spammity/spam?say=ni",
+ SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni")
+ self.checkReqURI("http://127.0.0.1/spammity/spam", 0,
+ SCRIPT_NAME="/spammity", PATH_INFO="/spam",QUERY_STRING="say=ni")
+
+ def testFileWrapper(self):
+ self.checkFW("xyz"*50, 120, ["xyz"*40,"xyz"*10])
+
+ def testHopByHop(self):
+ for hop in (
+ "Connection Keep-Alive Proxy-Authenticate Proxy-Authorization "
+ "TE Trailers Transfer-Encoding Upgrade"
+ ).split():
+ for alt in hop, hop.title(), hop.upper(), hop.lower():
+ self.failUnless(util.is_hop_by_hop(alt))
+
+ # Not comprehensive, just a few random header names
+ for hop in (
+ "Accept Cache-Control Date Pragma Trailer Via Warning"
+ ).split():
+ for alt in hop, hop.title(), hop.upper(), hop.lower():
+ self.failIf(util.is_hop_by_hop(alt))
+
+class HeaderTests(TestCase):
+
+ def testMappingInterface(self):
+ test = [('x','y')]
+ self.assertEqual(len(Headers([])),0)
+ self.assertEqual(len(Headers(test[:])),1)
+ self.assertEqual(Headers(test[:]).keys(), ['x'])
+ self.assertEqual(Headers(test[:]).values(), ['y'])
+ self.assertEqual(Headers(test[:]).items(), test)
+ self.failIf(Headers(test).items() is test) # must be copy!
+
+ h=Headers([])
+ del h['foo'] # should not raise an error
+
+ h['Foo'] = 'bar'
+ for m in h.has_key, h.__contains__, h.get, h.get_all, h.__getitem__:
+ self.failUnless(m('foo'))
+ self.failUnless(m('Foo'))
+ self.failUnless(m('FOO'))
+ self.failIf(m('bar'))
+
+ self.assertEqual(h['foo'],'bar')
+ h['foo'] = 'baz'
+ self.assertEqual(h['FOO'],'baz')
+ self.assertEqual(h.get_all('foo'),['baz'])
+
+ self.assertEqual(h.get("foo","whee"), "baz")
+ self.assertEqual(h.get("zoo","whee"), "whee")
+ self.assertEqual(h.setdefault("foo","whee"), "baz")
+ self.assertEqual(h.setdefault("zoo","whee"), "whee")
+ self.assertEqual(h["foo"],"baz")
+ self.assertEqual(h["zoo"],"whee")
+
+ def testRequireList(self):
+ self.assertRaises(TypeError, Headers, "foo")
+
+
+ def testExtras(self):
+ h = Headers([])
+ self.assertEqual(str(h),'\r\n')
+
+ h.add_header('foo','bar',baz="spam")
+ self.assertEqual(h['foo'], 'bar; baz="spam"')
+ self.assertEqual(str(h),'foo: bar; baz="spam"\r\n\r\n')
+
+ h.add_header('Foo','bar',cheese=None)
+ self.assertEqual(h.get_all('foo'),
+ ['bar; baz="spam"', 'bar; cheese'])
+
+ self.assertEqual(str(h),
+ 'foo: bar; baz="spam"\r\n'
+ 'Foo: bar; cheese\r\n'
+ '\r\n'
+ )
+
+
+class ErrorHandler(BaseCGIHandler):
+ """Simple handler subclass for testing BaseHandler"""
+
+ def __init__(self,**kw):
+ setup_testing_defaults(kw)
+ BaseCGIHandler.__init__(
+ self, StringIO(''), StringIO(), StringIO(), kw,
+ multithread=True, multiprocess=True
+ )
+
+class TestHandler(ErrorHandler):
+ """Simple handler subclass for testing BaseHandler, w/error passthru"""
+
+ def handle_error(self):
+ raise # for testing, we want to see what's happening
+
+
+
+
+
+
+
+
+
+
+
+class HandlerTests(TestCase):
+
+ def checkEnvironAttrs(self, handler):
+ env = handler.environ
+ for attr in [
+ 'version','multithread','multiprocess','run_once','file_wrapper'
+ ]:
+ if attr=='file_wrapper' and handler.wsgi_file_wrapper is None:
+ continue
+ self.assertEqual(getattr(handler,'wsgi_'+attr),env['wsgi.'+attr])
+
+ def checkOSEnviron(self,handler):
+ empty = {}; setup_testing_defaults(empty)
+ env = handler.environ
+ from os import environ
+ for k,v in environ.items():
+ if not empty.has_key(k):
+ self.assertEqual(env[k],v)
+ for k,v in empty.items():
+ self.failUnless(env.has_key(k))
+
+ def testEnviron(self):
+ h = TestHandler(X="Y")
+ h.setup_environ()
+ self.checkEnvironAttrs(h)
+ self.checkOSEnviron(h)
+ self.assertEqual(h.environ["X"],"Y")
+
+ def testCGIEnviron(self):
+ h = BaseCGIHandler(None,None,None,{})
+ h.setup_environ()
+ for key in 'wsgi.url_scheme', 'wsgi.input', 'wsgi.errors':
+ self.assert_(h.environ.has_key(key))
+
+ def testScheme(self):
+ h=TestHandler(HTTPS="on"); h.setup_environ()
+ self.assertEqual(h.environ['wsgi.url_scheme'],'https')
+ h=TestHandler(); h.setup_environ()
+ self.assertEqual(h.environ['wsgi.url_scheme'],'http')
+
+
+ def testAbstractMethods(self):
+ h = BaseHandler()
+ for name in [
+ '_flush','get_stdin','get_stderr','add_cgi_vars'
+ ]:
+ self.assertRaises(NotImplementedError, getattr(h,name))
+ self.assertRaises(NotImplementedError, h._write, "test")
+
+
+ def testContentLength(self):
+ # Demo one reason iteration is better than write()... ;)
+
+ def trivial_app1(e,s):
+ s('200 OK',[])
+ return [e['wsgi.url_scheme']]
+
+ def trivial_app2(e,s):
+ s('200 OK',[])(e['wsgi.url_scheme'])
+ return []
+
+ h = TestHandler()
+ h.run(trivial_app1)
+ self.assertEqual(h.stdout.getvalue(),
+ "Status: 200 OK\r\n"
+ "Content-Length: 4\r\n"
+ "\r\n"
+ "http")
+
+ h = TestHandler()
+ h.run(trivial_app2)
+ self.assertEqual(h.stdout.getvalue(),
+ "Status: 200 OK\r\n"
+ "\r\n"
+ "http")
+
+
+
+
+
+
+
+ def testBasicErrorOutput(self):
+
+ def non_error_app(e,s):
+ s('200 OK',[])
+ return []
+
+ def error_app(e,s):
+ raise AssertionError("This should be caught by handler")
+
+ h = ErrorHandler()
+ h.run(non_error_app)
+ self.assertEqual(h.stdout.getvalue(),
+ "Status: 200 OK\r\n"
+ "Content-Length: 0\r\n"
+ "\r\n")
+ self.assertEqual(h.stderr.getvalue(),"")
+
+ h = ErrorHandler()
+ h.run(error_app)
+ self.assertEqual(h.stdout.getvalue(),
+ "Status: %s\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-Length: %d\r\n"
+ "\r\n%s" % (h.error_status,len(h.error_body),h.error_body))
+
+ self.failUnless(h.stderr.getvalue().find("AssertionError")<>-1)
+
+ def testErrorAfterOutput(self):
+ MSG = "Some output has been sent"
+ def error_app(e,s):
+ s("200 OK",[])(MSG)
+ raise AssertionError("This should be caught by handler")
+
+ h = ErrorHandler()
+ h.run(error_app)
+ self.assertEqual(h.stdout.getvalue(),
+ "Status: 200 OK\r\n"
+ "\r\n"+MSG)
+ self.failUnless(h.stderr.getvalue().find("AssertionError")<>-1)
+
+
+ def testHeaderFormats(self):
+
+ def non_error_app(e,s):
+ s('200 OK',[])
+ return []
+
+ stdpat = (
+ r"HTTP/%s 200 OK\r\n"
+ r"Date: \w{3}, [ 0123]\d \w{3} \d{4} \d\d:\d\d:\d\d GMT\r\n"
+ r"%s" r"Content-Length: 0\r\n" r"\r\n"
+ )
+ shortpat = (
+ "Status: 200 OK\r\n" "Content-Length: 0\r\n" "\r\n"
+ )
+
+ for ssw in "FooBar/1.0", None:
+ sw = ssw and "Server: %s\r\n" % ssw or ""
+
+ for version in "1.0", "1.1":
+ for proto in "HTTP/0.9", "HTTP/1.0", "HTTP/1.1":
+
+ h = TestHandler(SERVER_PROTOCOL=proto)
+ h.origin_server = False
+ h.http_version = version
+ h.server_software = ssw
+ h.run(non_error_app)
+ self.assertEqual(shortpat,h.stdout.getvalue())
+
+ h = TestHandler(SERVER_PROTOCOL=proto)
+ h.origin_server = True
+ h.http_version = version
+ h.server_software = ssw
+ h.run(non_error_app)
+ if proto=="HTTP/0.9":
+ self.assertEqual(h.stdout.getvalue(),"")
+ else:
+ self.failUnless(
+ re.match(stdpat%(version,sw), h.stdout.getvalue()),
+ (stdpat%(version,sw), h.stdout.getvalue())
+ )
+
+# This epilogue is needed for compatibility with the Python 2.5 regrtest module
+
+def test_main():
+ import unittest
+ from test.test_support import run_suite
+ run_suite(
+ unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__])
+ )
+
+if __name__ == "__main__":
+ test_main()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# the above lines intentionally left blank
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index 86052d7..78adb42 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -1,4 +1,4 @@
-# xmlcore.etree test. This file contains enough tests to make sure that
+# xml.etree test. This file contains enough tests to make sure that
# all included components work as they should. For a more extensive
# test suite, see the selftest script in the ElementTree distribution.
@@ -6,8 +6,6 @@ import doctest, sys
from test import test_support
-from xmlcore.etree import ElementTree as ET
-
SAMPLE_XML = """
<body>
<tag>text</tag>
@@ -32,9 +30,9 @@ def sanity():
"""
Import sanity.
- >>> from xmlcore.etree import ElementTree
- >>> from xmlcore.etree import ElementInclude
- >>> from xmlcore.etree import ElementPath
+ >>> from xml.etree import ElementTree
+ >>> from xml.etree import ElementInclude
+ >>> from xml.etree import ElementPath
"""
def check_method(method):
@@ -61,6 +59,8 @@ def interface():
"""
Test element tree interface.
+ >>> from xml.etree import ElementTree as ET
+
>>> element = ET.Element("tag", key="value")
>>> tree = ET.ElementTree(element)
@@ -108,6 +108,8 @@ def find():
"""
Test find methods (including xpath syntax).
+ >>> from xml.etree import ElementTree as ET
+
>>> elem = ET.XML(SAMPLE_XML)
>>> elem.find("tag").tag
'tag'
@@ -174,6 +176,8 @@ def find():
def parseliteral():
r"""
+ >>> from xml.etree import ElementTree as ET
+
>>> element = ET.XML("<html><body>text</body></html>")
>>> ET.ElementTree(element).write(sys.stdout)
<html><body>text</body></html>
@@ -195,18 +199,20 @@ def parseliteral():
'body'
"""
-def check_encoding(encoding):
+
+def check_encoding(ET, encoding):
"""
- >>> check_encoding("ascii")
- >>> check_encoding("us-ascii")
- >>> check_encoding("iso-8859-1")
- >>> check_encoding("iso-8859-15")
- >>> check_encoding("cp437")
- >>> check_encoding("mac-roman")
+ >>> from xml.etree import ElementTree as ET
+
+ >>> check_encoding(ET, "ascii")
+ >>> check_encoding(ET, "us-ascii")
+ >>> check_encoding(ET, "iso-8859-1")
+ >>> check_encoding(ET, "iso-8859-15")
+ >>> check_encoding(ET, "cp437")
+ >>> check_encoding(ET, "mac-roman")
"""
- ET.XML(
- "<?xml version='1.0' encoding='%s'?><xml />" % encoding
- )
+ ET.XML("<?xml version='1.0' encoding='%s'?><xml />" % encoding)
+
#
# xinclude tests (samples from appendix C of the xinclude specification)
@@ -282,14 +288,16 @@ def xinclude_loader(href, parse="xml", encoding=None):
except KeyError:
raise IOError("resource not found")
if parse == "xml":
- return ET.XML(data)
+ from xml.etree.ElementTree import XML
+ return XML(data)
return data
def xinclude():
r"""
Basic inclusion example (XInclude C.1)
- >>> from xmlcore.etree import ElementInclude
+ >>> from xml.etree import ElementTree as ET
+ >>> from xml.etree import ElementInclude
>>> document = xinclude_loader("C1.xml")
>>> ElementInclude.include(document, xinclude_loader)
diff --git a/Lib/test/test_xml_etree_c.py b/Lib/test/test_xml_etree_c.py
index 587ea99..56e7fed 100644
--- a/Lib/test/test_xml_etree_c.py
+++ b/Lib/test/test_xml_etree_c.py
@@ -1,10 +1,10 @@
-# xmlcore.etree test for cElementTree
+# xml.etree test for cElementTree
import doctest, sys
from test import test_support
-from xmlcore.etree import cElementTree as ET
+from xml.etree import cElementTree as ET
SAMPLE_XML = """
<body>
@@ -30,7 +30,7 @@ def sanity():
"""
Import sanity.
- >>> from xmlcore.etree import cElementTree
+ >>> from xml.etree import cElementTree
"""
def check_method(method):
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 0241348..54684f3 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -4,7 +4,7 @@ try:
except ImportError:
zlib = None
-import zipfile, os, unittest
+import zipfile, os, unittest, sys, shutil
from StringIO import StringIO
from tempfile import TemporaryFile
@@ -28,14 +28,70 @@ class TestsWithSourceFile(unittest.TestCase):
zipfp = zipfile.ZipFile(f, "w", compression)
zipfp.write(TESTFN, "another"+os.extsep+"name")
zipfp.write(TESTFN, TESTFN)
+ zipfp.writestr("strfile", self.data)
zipfp.close()
# Read the ZIP archive
zipfp = zipfile.ZipFile(f, "r", compression)
self.assertEqual(zipfp.read(TESTFN), self.data)
self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data)
+ self.assertEqual(zipfp.read("strfile"), self.data)
+
+ # Print the ZIP directory
+ fp = StringIO()
+ stdout = sys.stdout
+ try:
+ sys.stdout = fp
+
+ zipfp.printdir()
+ finally:
+ sys.stdout = stdout
+
+ directory = fp.getvalue()
+ lines = directory.splitlines()
+ self.assertEquals(len(lines), 4) # Number of files + header
+
+ self.assert_('File Name' in lines[0])
+ self.assert_('Modified' in lines[0])
+ self.assert_('Size' in lines[0])
+
+ fn, date, time, size = lines[1].split()
+ self.assertEquals(fn, 'another.name')
+ # XXX: timestamp is not tested
+ self.assertEquals(size, str(len(self.data)))
+
+ # Check the namelist
+ names = zipfp.namelist()
+ self.assertEquals(len(names), 3)
+ self.assert_(TESTFN in names)
+ self.assert_("another"+os.extsep+"name" in names)
+ self.assert_("strfile" in names)
+
+ # Check infolist
+ infos = zipfp.infolist()
+ names = [ i.filename for i in infos ]
+ self.assertEquals(len(names), 3)
+ self.assert_(TESTFN in names)
+ self.assert_("another"+os.extsep+"name" in names)
+ self.assert_("strfile" in names)
+ for i in infos:
+ self.assertEquals(i.file_size, len(self.data))
+
+ # check getinfo
+ for nm in (TESTFN, "another"+os.extsep+"name", "strfile"):
+ info = zipfp.getinfo(nm)
+ self.assertEquals(info.filename, nm)
+ self.assertEquals(info.file_size, len(self.data))
+
+ # Check that testzip doesn't raise an exception
+ zipfp.testzip()
+
+
zipfp.close()
+
+
+
def testStored(self):
for f in (TESTFN2, TemporaryFile(), StringIO()):
self.zipTest(f, zipfile.ZIP_STORED)
@@ -59,6 +115,197 @@ class TestsWithSourceFile(unittest.TestCase):
os.remove(TESTFN)
os.remove(TESTFN2)
+class TestZip64InSmallFiles(unittest.TestCase):
+ # These tests test the ZIP64 functionality without using large files,
+ # see test_zipfile64 for proper tests.
+
+ def setUp(self):
+ self._limit = zipfile.ZIP64_LIMIT
+ zipfile.ZIP64_LIMIT = 5
+
+ line_gen = ("Test of zipfile line %d." % i for i in range(0, 1000))
+ self.data = '\n'.join(line_gen)
+
+ # Make a source file with some lines
+ fp = open(TESTFN, "wb")
+ fp.write(self.data)
+ fp.close()
+
+ def largeFileExceptionTest(self, f, compression):
+ zipfp = zipfile.ZipFile(f, "w", compression)
+ self.assertRaises(zipfile.LargeZipFile,
+ zipfp.write, TESTFN, "another"+os.extsep+"name")
+ zipfp.close()
+
+ def largeFileExceptionTest2(self, f, compression):
+ zipfp = zipfile.ZipFile(f, "w", compression)
+ self.assertRaises(zipfile.LargeZipFile,
+ zipfp.writestr, "another"+os.extsep+"name", self.data)
+ zipfp.close()
+
+ def testLargeFileException(self):
+ for f in (TESTFN2, TemporaryFile(), StringIO()):
+ self.largeFileExceptionTest(f, zipfile.ZIP_STORED)
+ self.largeFileExceptionTest2(f, zipfile.ZIP_STORED)
+
+ def zipTest(self, f, compression):
+ # Create the ZIP archive
+ zipfp = zipfile.ZipFile(f, "w", compression, allowZip64=True)
+ zipfp.write(TESTFN, "another"+os.extsep+"name")
+ zipfp.write(TESTFN, TESTFN)
+ zipfp.writestr("strfile", self.data)
+ zipfp.close()
+
+ # Read the ZIP archive
+ zipfp = zipfile.ZipFile(f, "r", compression)
+ self.assertEqual(zipfp.read(TESTFN), self.data)
+ self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data)
+ self.assertEqual(zipfp.read("strfile"), self.data)
+
+ # Print the ZIP directory
+ fp = StringIO()
+ stdout = sys.stdout
+ try:
+ sys.stdout = fp
+
+ zipfp.printdir()
+ finally:
+ sys.stdout = stdout
+
+ directory = fp.getvalue()
+ lines = directory.splitlines()
+ self.assertEquals(len(lines), 4) # Number of files + header
+
+ self.assert_('File Name' in lines[0])
+ self.assert_('Modified' in lines[0])
+ self.assert_('Size' in lines[0])
+
+ fn, date, time, size = lines[1].split()
+ self.assertEquals(fn, 'another.name')
+ # XXX: timestamp is not tested
+ self.assertEquals(size, str(len(self.data)))
+
+ # Check the namelist
+ names = zipfp.namelist()
+ self.assertEquals(len(names), 3)
+ self.assert_(TESTFN in names)
+ self.assert_("another"+os.extsep+"name" in names)
+ self.assert_("strfile" in names)
+
+ # Check infolist
+ infos = zipfp.infolist()
+ names = [ i.filename for i in infos ]
+ self.assertEquals(len(names), 3)
+ self.assert_(TESTFN in names)
+ self.assert_("another"+os.extsep+"name" in names)
+ self.assert_("strfile" in names)
+ for i in infos:
+ self.assertEquals(i.file_size, len(self.data))
+
+ # check getinfo
+ for nm in (TESTFN, "another"+os.extsep+"name", "strfile"):
+ info = zipfp.getinfo(nm)
+ self.assertEquals(info.filename, nm)
+ self.assertEquals(info.file_size, len(self.data))
+
+ # Check that testzip doesn't raise an exception
+ zipfp.testzip()
+
+
+ zipfp.close()
+
+ def testStored(self):
+ for f in (TESTFN2, TemporaryFile(), StringIO()):
+ self.zipTest(f, zipfile.ZIP_STORED)
+
+
+ if zlib:
+ def testDeflated(self):
+ for f in (TESTFN2, TemporaryFile(), StringIO()):
+ self.zipTest(f, zipfile.ZIP_DEFLATED)
+
+ def testAbsoluteArcnames(self):
+ zipfp = zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED, allowZip64=True)
+ zipfp.write(TESTFN, "/absolute")
+ zipfp.close()
+
+ zipfp = zipfile.ZipFile(TESTFN2, "r", zipfile.ZIP_STORED)
+ self.assertEqual(zipfp.namelist(), ["absolute"])
+ zipfp.close()
+
+
+ def tearDown(self):
+ zipfile.ZIP64_LIMIT = self._limit
+ os.remove(TESTFN)
+ os.remove(TESTFN2)
+
+class PyZipFileTests(unittest.TestCase):
+ def testWritePyfile(self):
+ zipfp = zipfile.PyZipFile(TemporaryFile(), "w")
+ fn = __file__
+ if fn.endswith('.pyc') or fn.endswith('.pyo'):
+ fn = fn[:-1]
+
+ zipfp.writepy(fn)
+
+ bn = os.path.basename(fn)
+ self.assert_(bn not in zipfp.namelist())
+ self.assert_(bn + 'o' in zipfp.namelist() or bn + 'c' in zipfp.namelist())
+ zipfp.close()
+
+
+ zipfp = zipfile.PyZipFile(TemporaryFile(), "w")
+ fn = __file__
+ if fn.endswith('.pyc') or fn.endswith('.pyo'):
+ fn = fn[:-1]
+
+ zipfp.writepy(fn, "testpackage")
+
+ bn = "%s/%s"%("testpackage", os.path.basename(fn))
+ self.assert_(bn not in zipfp.namelist())
+ self.assert_(bn + 'o' in zipfp.namelist() or bn + 'c' in zipfp.namelist())
+ zipfp.close()
+
+ def testWritePythonPackage(self):
+ import email
+ packagedir = os.path.dirname(email.__file__)
+
+ zipfp = zipfile.PyZipFile(TemporaryFile(), "w")
+ zipfp.writepy(packagedir)
+
+ # Check for a couple of modules at different levels of the hieararchy
+ names = zipfp.namelist()
+ self.assert_('email/__init__.pyo' in names or 'email/__init__.pyc' in names)
+ self.assert_('email/mime/text.pyo' in names or 'email/mime/text.pyc' in names)
+
+ def testWritePythonDirectory(self):
+ os.mkdir(TESTFN2)
+ try:
+ fp = open(os.path.join(TESTFN2, "mod1.py"), "w")
+ fp.write("print 42\n")
+ fp.close()
+
+ fp = open(os.path.join(TESTFN2, "mod2.py"), "w")
+ fp.write("print 42 * 42\n")
+ fp.close()
+
+ fp = open(os.path.join(TESTFN2, "mod2.txt"), "w")
+ fp.write("bla bla bla\n")
+ fp.close()
+
+ zipfp = zipfile.PyZipFile(TemporaryFile(), "w")
+ zipfp.writepy(TESTFN2)
+
+ names = zipfp.namelist()
+ self.assert_('mod1.pyc' in names or 'mod1.pyo' in names)
+ self.assert_('mod2.pyc' in names or 'mod2.pyo' in names)
+ self.assert_('mod2.txt' not in names)
+
+ finally:
+ shutil.rmtree(TESTFN2)
+
+
+
class OtherTests(unittest.TestCase):
def testCloseErroneousFile(self):
# This test checks that the ZipFile constructor closes the file object
@@ -103,7 +350,8 @@ class OtherTests(unittest.TestCase):
self.assertRaises(RuntimeError, zipf.testzip)
def test_main():
- run_unittest(TestsWithSourceFile, OtherTests)
+ run_unittest(TestsWithSourceFile, TestZip64InSmallFiles, OtherTests, PyZipFileTests)
+ #run_unittest(TestZip64InSmallFiles)
if __name__ == "__main__":
test_main()
diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py
new file mode 100644
index 0000000..449cf39
--- /dev/null
+++ b/Lib/test/test_zipfile64.py
@@ -0,0 +1,101 @@
+# Tests of the full ZIP64 functionality of zipfile
+# The test_support.requires call is the only reason for keeping this separate
+# from test_zipfile
+from test import test_support
+# XXX(nnorwitz): disable this test by looking for extra largfile resource
+# which doesn't exist. This test takes over 30 minutes to run in general
+# and requires more disk space than most of the buildbots.
+test_support.requires(
+ 'extralargefile',
+ 'test requires loads of disk-space bytes and a long time to run'
+ )
+
+# We can test part of the module without zlib.
+try:
+ import zlib
+except ImportError:
+ zlib = None
+
+import zipfile, os, unittest
+import time
+import sys
+
+from StringIO import StringIO
+from tempfile import TemporaryFile
+
+from test.test_support import TESTFN, run_unittest
+
+TESTFN2 = TESTFN + "2"
+
+# How much time in seconds can pass before we print a 'Still working' message.
+_PRINT_WORKING_MSG_INTERVAL = 5 * 60
+
+class TestsWithSourceFile(unittest.TestCase):
+ def setUp(self):
+ # Create test data.
+ # xrange() is important here -- don't want to create immortal space
+ # for a million ints.
+ line_gen = ("Test of zipfile line %d." % i for i in xrange(1000000))
+ self.data = '\n'.join(line_gen)
+
+ # And write it to a file.
+ fp = open(TESTFN, "wb")
+ fp.write(self.data)
+ fp.close()
+
+ def zipTest(self, f, compression):
+ # Create the ZIP archive.
+ zipfp = zipfile.ZipFile(f, "w", compression, allowZip64=True)
+
+ # It will contain enough copies of self.data to reach about 6GB of
+ # raw data to store.
+ filecount = 6*1024**3 // len(self.data)
+
+ next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
+ for num in range(filecount):
+ zipfp.writestr("testfn%d" % num, self.data)
+ # Print still working message since this test can be really slow
+ if next_time <= time.time():
+ next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
+ print >>sys.__stdout__, (
+ ' zipTest still writing %d of %d, be patient...' %
+ (num, filecount))
+ sys.__stdout__.flush()
+ zipfp.close()
+
+ # Read the ZIP archive
+ zipfp = zipfile.ZipFile(f, "r", compression)
+ for num in range(filecount):
+ self.assertEqual(zipfp.read("testfn%d" % num), self.data)
+ # Print still working message since this test can be really slow
+ if next_time <= time.time():
+ next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
+ print >>sys.__stdout__, (
+ ' zipTest still reading %d of %d, be patient...' %
+ (num, filecount))
+ sys.__stdout__.flush()
+ zipfp.close()
+
+ def testStored(self):
+ # Try the temp file first. If we do TESTFN2 first, then it hogs
+ # gigabytes of disk space for the duration of the test.
+ for f in TemporaryFile(), TESTFN2:
+ self.zipTest(f, zipfile.ZIP_STORED)
+
+ if zlib:
+ def testDeflated(self):
+ # Try the temp file first. If we do TESTFN2 first, then it hogs
+ # gigabytes of disk space for the duration of the test.
+ for f in TemporaryFile(), TESTFN2:
+ self.zipTest(f, zipfile.ZIP_DEFLATED)
+
+ def tearDown(self):
+ for fname in TESTFN, TESTFN2:
+ if os.path.exists(fname):
+ os.remove(fname)
+
+def test_main():
+ run_unittest(TestsWithSourceFile)
+
+if __name__ == "__main__":
+ test_main()
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
index ccbc8fd..4440942 100644
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -302,63 +302,65 @@ class CompressObjectTestCase(unittest.TestCase):
dco = zlib.decompressobj()
self.assertEqual(dco.flush(), "") # Returns nothing
- def test_compresscopy(self):
- # Test copying a compression object
- data0 = HAMLET_SCENE
- data1 = HAMLET_SCENE.swapcase()
- c0 = zlib.compressobj(zlib.Z_BEST_COMPRESSION)
- bufs0 = []
- bufs0.append(c0.compress(data0))
-
- c1 = c0.copy()
- bufs1 = bufs0[:]
-
- bufs0.append(c0.compress(data0))
- bufs0.append(c0.flush())
- s0 = ''.join(bufs0)
-
- bufs1.append(c1.compress(data1))
- bufs1.append(c1.flush())
- s1 = ''.join(bufs1)
-
- self.assertEqual(zlib.decompress(s0),data0+data0)
- self.assertEqual(zlib.decompress(s1),data0+data1)
-
- def test_badcompresscopy(self):
- # Test copying a compression object in an inconsistent state
- c = zlib.compressobj()
- c.compress(HAMLET_SCENE)
- c.flush()
- self.assertRaises(ValueError, c.copy)
-
- def test_decompresscopy(self):
- # Test copying a decompression object
- data = HAMLET_SCENE
- comp = zlib.compress(data)
-
- d0 = zlib.decompressobj()
- bufs0 = []
- bufs0.append(d0.decompress(comp[:32]))
-
- d1 = d0.copy()
- bufs1 = bufs0[:]
-
- bufs0.append(d0.decompress(comp[32:]))
- s0 = ''.join(bufs0)
-
- bufs1.append(d1.decompress(comp[32:]))
- s1 = ''.join(bufs1)
-
- self.assertEqual(s0,s1)
- self.assertEqual(s0,data)
-
- def test_baddecompresscopy(self):
- # Test copying a compression object in an inconsistent state
- data = zlib.compress(HAMLET_SCENE)
- d = zlib.decompressobj()
- d.decompress(data)
- d.flush()
- self.assertRaises(ValueError, d.copy)
+ if hasattr(zlib.compressobj(), "copy"):
+ def test_compresscopy(self):
+ # Test copying a compression object
+ data0 = HAMLET_SCENE
+ data1 = HAMLET_SCENE.swapcase()
+ c0 = zlib.compressobj(zlib.Z_BEST_COMPRESSION)
+ bufs0 = []
+ bufs0.append(c0.compress(data0))
+
+ c1 = c0.copy()
+ bufs1 = bufs0[:]
+
+ bufs0.append(c0.compress(data0))
+ bufs0.append(c0.flush())
+ s0 = ''.join(bufs0)
+
+ bufs1.append(c1.compress(data1))
+ bufs1.append(c1.flush())
+ s1 = ''.join(bufs1)
+
+ self.assertEqual(zlib.decompress(s0),data0+data0)
+ self.assertEqual(zlib.decompress(s1),data0+data1)
+
+ def test_badcompresscopy(self):
+ # Test copying a compression object in an inconsistent state
+ c = zlib.compressobj()
+ c.compress(HAMLET_SCENE)
+ c.flush()
+ self.assertRaises(ValueError, c.copy)
+
+ if hasattr(zlib.decompressobj(), "copy"):
+ def test_decompresscopy(self):
+ # Test copying a decompression object
+ data = HAMLET_SCENE
+ comp = zlib.compress(data)
+
+ d0 = zlib.decompressobj()
+ bufs0 = []
+ bufs0.append(d0.decompress(comp[:32]))
+
+ d1 = d0.copy()
+ bufs1 = bufs0[:]
+
+ bufs0.append(d0.decompress(comp[32:]))
+ s0 = ''.join(bufs0)
+
+ bufs1.append(d1.decompress(comp[32:]))
+ s1 = ''.join(bufs1)
+
+ self.assertEqual(s0,s1)
+ self.assertEqual(s0,data)
+
+ def test_baddecompresscopy(self):
+ # Test copying a compression object in an inconsistent state
+ data = zlib.compress(HAMLET_SCENE)
+ d = zlib.decompressobj()
+ d.decompress(data)
+ d.flush()
+ self.assertRaises(ValueError, d.copy)
def genblock(seed, length, step=1024, generator=random):
"""length-byte stream of random data from a seed (in step-byte blocks)."""