Commit Graph

4695 Commits

Author SHA1 Message Date
Brett Cannon 41d4e32353 Add test.test_support.transient_internet . Returns a context manager that
nests test.test_support.TransientResource context managers that capture
exceptions raised when the Internet connection is flaky.

Initially using in test_socket_ssl but should probably be expanded to cover any
test that should not raise the captured exceptions if the Internet connection
works.
2007-03-13 02:34:09 +00:00
Tim Peters ea5962f86e Whitespace normalization. 2007-03-12 18:07:52 +00:00
Collin Winter cb637c9ea3 Patch #1670993: Refactor test_threadedtempfile.py to use unittest. 2007-03-12 17:24:07 +00:00
Collin Winter 276887b16d Bug #742342: make Python stop segfaulting on infinitely-recursive reload()s. Fixed by patch #922167.
Will backport.
2007-03-12 16:11:39 +00:00
Collin Winter f567ca3e1a Patch #1678088: convert test_operations to use unittest, fold the result into test_dict. 2007-03-12 15:57:19 +00:00
Georg Brandl 871f1bc601 Backport from Py3k branch:
Patch #1591665: implement the __dir__() special function lookup in PyObject_Dir.

Had to change a few bits of the patch because classobjs and __methods__ are still
in Py2.6.
2007-03-12 13:17:36 +00:00
Skip Montanaro 9cea8e5118 Sane humans would call these invalid tests, but Andrew McNamara pointed out
that given the inputs in these tests Excel does indeed produce the output
these tests expect.  Document that for future confused folks.
2007-03-12 03:30:50 +00:00
Vinay Sajip a5e764873a Fix resource leak reported in SF #1516995. 2007-03-11 18:32:07 +00:00
Collin Winter 3351aa7dd5 Convert an assert to a raise so it works even in the presence of -O. 2007-03-10 14:33:32 +00:00
Collin Winter 22c42ba88c Bug #1531963: Make SocketServer.TCPServer's server_address always be equal to calling getsockname() on the server's socket.
Will backport.
2007-03-10 02:51:26 +00:00
Collin Winter dbead56cb6 * Unlink test files before and after each test; hopefully this will cut down on recent buildbot failures in test_islink.
* Drop safe_remove() in favor of test_support.unlink().
* Fix the indentation of test_samefile so that it runs.
2007-03-10 02:23:40 +00:00
Collin Winter e38051db87 Patch #1491866: change the complex() constructor to allow parthensized forms. This means complex(repr(x)) now works instead of raising a ValueError. 2007-03-09 20:33:07 +00:00
Brett Cannon a30fcb4dae Introduce test.test_support.TransientResource. It's a context manager to
surround calls to resources that may or may not be available.  Specifying the
expected exception and attributes to be raised if the resource is not available
prevents overly broad catching of exceptions.

This is meant to help suppress spurious failures by raising
test.test_support.ResourceDenied if the exception matches.  It would probably
be good to go through the various network tests and surround the calls to catch
connection timeouts (as done with test_socket_ssl in this commit).
2007-03-08 23:58:11 +00:00
Collin Winter 5545314ba7 Backported r54226 from p3yk: Move test_unittest, test_doctest and test_doctest2 higher up in the testing order. 2007-03-08 19:58:14 +00:00
Guido van Rossum f1200f8255 Windows doesn't support negative timestamps. Skip the tests involving them
if os.name == "nt".
2007-03-07 15:16:29 +00:00
Georg Brandl d9e50261e8 Add some sanity checks to unittest.TestSuite's addTest(s) methods.
Fixes #878275.
2007-03-07 11:54:49 +00:00
Georg Brandl 9decc0dc8b Patch #1675471: convert test_pty to unittest. 2007-03-07 11:37:42 +00:00
Martin v. Löwis 05c075d629 Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', ''). 2007-03-07 11:04:33 +00:00
Georg Brandl 15c5ce936f Patches #1550273, #1550272: fix a few bugs in unittest and add a
comprehensive test suite for the module.
2007-03-07 09:09:40 +00:00
Georg Brandl 71ff646743 Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
2007-03-07 08:31:51 +00:00
Walter Dörwald d391f0855c Patch for bug #1633621: if curses.resizeterm() or
curses.resize_term() is called, update _curses.LINES,
_curses.COLS, curses.LINES and curses.COLS.
2007-03-06 20:38:57 +00:00
Georg Brandl 40c626159d Patch #1654417: make operator.{get,set,del}slice use the full range
of Py_ssize_t.
2007-03-06 18:59:11 +00:00
Georg Brandl 00cd818dea Patch #1638879: don't accept strings with embedded NUL bytes in long(). 2007-03-06 18:41:12 +00:00
Guido van Rossum 2054ee9b6f Patch #1646728: datetime.fromtimestamp fails with negative
fractional times.  With unittest.

Somebody please backport to 2.5.
2007-03-06 15:50:01 +00:00
Martin v. Löwis ab8a6bba25 Patch #912410: Replace HTML entity references for attribute values
in HTMLParser.
2007-03-06 14:43:00 +00:00
Georg Brandl 72363031b9 A test case for the defaultdict KeyError bug. 2007-03-06 13:35:00 +00:00
Georg Brandl 3071a1aec9 A test case for the fix in #1674228. 2007-03-06 11:51:14 +00:00
Martin v. Löwis 3eb7648986 Patch #1121142: Implement ZipFile.open. 2007-03-06 10:41:24 +00:00
Georg Brandl 0fca97a5fb Patch #1674228: when assigning a slice (old-style), check for the
sq_ass_slice instead of the sq_slice slot.
2007-03-05 22:28:08 +00:00
Georg Brandl 8905bb10e0 Fix a bug in test_dict and test_userdict, found at the PyPy sprint. 2007-03-04 17:18:54 +00:00
Raymond Hettinger 20e1199fbe Fix embarrassing typo and fix constantification of None 2007-03-02 19:20:46 +00:00
Raymond Hettinger c37e5e04eb Add collections.NamedTuple 2007-03-01 06:16:43 +00:00
Brett Cannon f8267df2ad Add a test for instantiating SyntaxError with no arguments. 2007-02-28 18:15:00 +00:00
Armin Rigo adf172339c Modify the segfaulting example to show why r53997 is not a solution to
it.
2007-02-28 09:25:29 +00:00
Jeremy Hylton fa955697fa Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.

1.  If type (or a subclass of type) appears in bases, it must appear
    before any non-type bases.  If a non-type base (like a regular
    new-style class) occurred first, it could trick type into
    allocating the new class an __dict__ which must be impossible.

2. There are several checks that are made of bases when creating a
   type.  Those checks are now repeated when assigning to __bases__.
   We also add the restriction that assignment to __bases__ may not
   change the metaclass of the type.

Add new tests for these cases and for a few other oddball errors that
were no previously tested.  Remove a crasher test that was fixed.

Also some internal refactoring:  Extract the code to find the most
derived metaclass of a type and its bases.  It is now needed in two
places.  Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
2007-02-27 18:29:45 +00:00
Jeremy Hylton 37075c5ace Fix long-standing bug in name mangling for package imports
Reported by Mike Verdone.
2007-02-27 01:01:59 +00:00
Neal Norwitz 88516a6039 When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.
2007-02-26 22:41:45 +00:00
Jeremy Hylton 759410b372 Do not copy free variables to locals in class namespaces.
Fixes bug 1569356, but at the cost of a minor incompatibility in
locals().  Add test that verifies that the class namespace is not
polluted.  Also clarify the behavior in the library docs.

Along the way, cleaned up the dict_to_map and map_to_dict
implementations and added some comments that explain what they do.
2007-02-26 18:41:18 +00:00
Thomas Wouters 110054c053 Backported r51621 from p3yk:
Don't use a fixed temporary name (gdbm).
Don't use our own temp name creation (dbm).
Should be backported to 2.5.
2007-02-25 22:12:31 +00:00
Brett Cannon 6fbb96e69a Refactor PEP 352 tests to make it easier in the future to make sure certain
things cannot be raised or caught.
2007-02-23 14:28:25 +00:00
Neal Norwitz 764cf7ed82 Fix typo in comment 2007-02-23 00:22:39 +00:00
Raymond Hettinger d36862cf78 Add itertools.izip_longest(). 2007-02-21 05:20:38 +00:00
Martin v. Löwis 382abeff0f Patch #1490190: posixmodule now includes os.chflags() and os.lchflags()
functions on platforms where the underlying system calls are available.
2007-02-19 10:55:19 +00:00
Raymond Hettinger 01b9881062 Add test for merge stability 2007-02-19 07:30:21 +00:00
Raymond Hettinger 00166c5532 Add merge() function to heapq. 2007-02-19 04:08:43 +00:00
Raymond Hettinger d6fc72a5ae Extend work on revision 52962: Eliminate redundant calls to PyObject_Hash(). 2007-02-19 02:03:19 +00:00
Lars Gustäbel d0b6040ced A missing binary mode in AppendTest caused failures in Windows
Buildbot.
2007-02-14 14:45:12 +00:00
Lars Gustäbel 5b1a785702 Patch #1647484: Renamed GzipFile's filename attribute to name. The
filename attribute is still accessible as a property that emits a
DeprecationWarning.
2007-02-13 16:09:24 +00:00
Martin v. Löwis 84f6de9d7e Patch #1517891: Make 'a' create the file if it doesn't exist.
Fixes #1514451.
2007-02-13 10:10:39 +00:00
Martin v. Löwis c6d626ed9f Patch #698833: Support file decryption in zipfile. 2007-02-13 09:49:38 +00:00
Armin Rigo b8d6d73121 Fix the line to what is my guess at the original author's meaning.
(The line has no effect anyway, but is present because it's
customary call the base class __init__).
2007-02-12 16:23:24 +00:00
Martin v. Löwis 2bad58f5a4 Patch 1463026: Support default namespace in XMLGenerator.
Fixes #847665. Will backport.
2007-02-12 12:21:10 +00:00
Martin v. Löwis 4c11a92625 Bug #1653736: Complain about keyword arguments to time.isoformat.
Will backport to 2.5.
2007-02-08 09:13:36 +00:00
Raymond Hettinger 6d121f168c Do not let overflows in enumerate() and count() pass silently. 2007-02-08 00:07:32 +00:00
Raymond Hettinger 4da5bf644a Bug #1575169: operator.isSequenceType() now returns False for subclasses of dict. 2007-02-07 22:24:07 +00:00
Raymond Hettinger 5a0217efea Check for a common user error with defaultdict(). 2007-02-07 21:42:17 +00:00
Raymond Hettinger 0922d71604 SF #1615701: make d.update(m) honor __getitem__() and keys() in dict subclasses 2007-02-07 20:08:22 +00:00
Lars Gustäbel 3f8aca1164 Patch #1652681: create nonexistent files in append mode and
allow appending to empty files.
2007-02-06 18:38:13 +00:00
Brett Cannon 129bd52146 No more raising of string exceptions!
The next step of PEP 352 (for 2.6) causes raising a string exception to trigger
a TypeError.  Trying to catch a string exception raises a DeprecationWarning.
References to string exceptions has been removed from the docs since they are
now just an error.
2007-01-30 21:34:36 +00:00
Tim Peters f733abb783 Whitespace normalization. 2007-01-30 03:03:46 +00:00
Brett Cannon e05e6b0032 Add a test for slicing an exception. 2007-01-29 04:41:44 +00:00
Georg Brandl ab49684f55 Patch #1638243: the compiler package is now able to correctly compile
a with statement; previously, executing code containing a with statement
compiled by the compiler package crashed the interpreter.
2007-01-27 17:43:02 +00:00
Brett Cannon 07e1db317d Fix time.strptime's %U support. Basically rewrote the algorithm to be more
generic so that one only has to shift certain values based on whether the week
was specified to start on Monday or Sunday.  Cut out a lot of edge case code
compared to the previous version.  Also broke algorithm out into its own
function (that is private to the module).

Fixes bug #1643943 (thanks Biran Nahas for the report).
2007-01-25 20:22:02 +00:00
Walter Dörwald 4b884a5cc2 Port test_popen.py to unittest. 2007-01-24 00:42:19 +00:00
Brett Cannon f5bee30e30 Fix crasher for when an object's __del__ creates a new weakref to itself.
Patch only fixes new-style classes; classic classes still buggy.

Closes bug #1377858.  Already backported.
2007-01-23 23:21:22 +00:00
Andrew M. Kuchling b78bb74c41 Improve pattern used for mbox 'From' lines; add a simple test 2007-01-22 20:26:40 +00:00
Georg Brandl 5a096e1b10 Use new email module names (#1637162, #1637159, #1637157). 2007-01-22 19:40:21 +00:00
Georg Brandl dd7b0525e9 Patch #1627441: close sockets properly in urllib2. 2007-01-21 10:35:10 +00:00
Georg Brandl b84c13792d Bug #1486663: don't reject keyword arguments for subclasses of builtin
types.
2007-01-21 10:28:43 +00:00
Martin v. Löwis aef4c6bc00 Patch #1610575: Add support for _Bool to struct. 2007-01-21 09:33:07 +00:00
Walter Dörwald 71cd55150b Port test_new.py to unittest. 2007-01-20 23:07:28 +00:00
Walter Dörwald d414302eec resource.RUSAGE_BOTH might not exist. 2007-01-20 19:03:17 +00:00
Walter Dörwald 66262ab064 Add argument tests an calls of resource.getrusage(). 2007-01-20 18:19:33 +00:00
Walter Dörwald 9fab9a7da8 Port test_resource.py to unittest. 2007-01-20 17:28:31 +00:00
Neal Norwitz 06a9a0ccf4 This test doesn't pass on Windows. The cause seems to be that chmod
doesn't support the same funcationality as on Unix.  I'm not sure if
this fix is the best (or if it will even work)--it's a test to see
if the buildbots start passing again.

It might be better to not even run this test if it's windows (or non-posix).
2007-01-18 06:20:55 +00:00
Neal Norwitz 7beeb2b0a5 Try reverting part of r53145 that seems to cause the Windows buildbots to fail in test_uu.UUFileTest.test_encode 2007-01-18 05:40:58 +00:00
Sjoerd Mullender 33a0a06d31 Fixed ntpath.expandvars to not replace references to non-existing
variables with nothing.  Also added tests.
This fixes bug #494589.
2007-01-16 16:42:38 +00:00
Guido van Rossum bb2cc698c1 Patch #1635058 by Mark Roberts: ensure that htonl and friends never accept or
return negative numbers, per the underlying C implementation.
2007-01-14 17:03:32 +00:00
Guido van Rossum 0567ba20f3 Remove a dependency of this test on $COLUMNS. 2007-01-14 03:46:33 +00:00
Peter Astrand 10514a70ac Fix for bug #1634343: allow specifying empty arguments on Windows 2007-01-13 22:35:35 +00:00
Brett Cannon 093b67061a Deprecate the sets module. 2007-01-13 00:29:49 +00:00
Raymond Hettinger 9fdfadb06e SF #1486663 -- Allow keyword args in subclasses of set() and frozenset(). 2007-01-11 18:22:55 +00:00
Raymond Hettinger 51c2f6cd18 Fix zero-length corner case for iterating over a mutating deque. 2007-01-08 18:09:20 +00:00
Raymond Hettinger 769a40a1d0 Fix stability of heapq's nlargest() and nsmallest(). 2007-01-04 17:53:34 +00:00
Brett Cannon 92d54d5e9c Add EnvironmentVarGuard to test.test_support. Provides a context manager to
temporarily set or unset environment variables.
2007-01-04 00:23:49 +00:00
Raymond Hettinger 5399910eba For sets with cyclical reprs, emit an ellipsis instead of infinitely recursing. 2006-12-30 04:01:17 +00:00
Lars Gustäbel a7ba6fc548 Patch #1504073: Fix tarfile.open() for mode "r" with a fileobj argument.
Will backport to 2.5.
2006-12-27 10:30:46 +00:00
Lars Gustäbel a4b2381b20 Patch #1262036: Prevent TarFiles from being added to themselves under
certain conditions.

Will backport to 2.5.
2006-12-23 17:57:23 +00:00
Lars Gustäbel 6baa502769 Patch #1230446: tarfile.py: fix ExFileObject so that read() and tell()
work correctly together with readline().

Will backport to 2.5.
2006-12-23 16:40:13 +00:00
Andrew M. Kuchling 55c54a2fa1 Frak; this test also fails 2006-12-22 21:48:19 +00:00
Andrew M. Kuchling f2881e8315 Darn; this test works when you run test_pty.py directly, but fails when regrtest runs it (the os.read() raises os.error). I can't figure out the cause, so am commenting out the test. 2006-12-22 19:21:27 +00:00
Andrew M. Kuchling ee0e6d16b3 [Patch #783050 from Patrick Lynch] The emulation of forkpty() is incorrect;
the master should close the slave fd.

Added a test to test_pty.py that reads from the master_fd after doing
a pty.fork(); without the fix it hangs forever instead of raising an
exception.  (<crossing fingers for the buildbots>)

2.5 backport candidate.
2006-12-22 18:41:42 +00:00
Andrew M. Kuchling 3fa5e6ee45 [Bug #776202] Apply Walter Doerwald's patch to use text mode for encoded files 2006-12-22 16:43:26 +00:00
Andrew M. Kuchling 9ef0ef5b72 [Bug #802128 continued] Modify mode depending on the process umask.
Is there really no other way to read the umask than to set it?

Hope this works on Windows...
2006-12-22 15:16:58 +00:00
Andrew M. Kuchling dc26758ffe [Bug #802128] Make the mode argument of dumbdbm actually work the way it's
described, and add a test for it.

2.5 bugfix candidate, maybe; arguably this patch changes the API of
dumbdbm and shouldn't be added in a point-release.
2006-12-22 15:04:45 +00:00
Georg Brandl ded1c4df0b Testcase for patch #1484695. 2006-12-20 11:55:16 +00:00
Raymond Hettinger 94547f7646 Bug #1590891: random.randrange don't return correct value for big number
Needs to be backported.
2006-12-20 06:42:06 +00:00
Brett Cannon 6d9520c4f0 Add test.test_support.guard_warnings_filter . This function returns a context
manager that protects warnings.filter from being modified once the context is
exited.
2006-12-13 23:09:53 +00:00
Brett Cannon c745df8519 Remove unneeded imports of 'warnings'. 2006-12-13 23:02:38 +00:00
Brett Cannon 905820ccba Remove an unneeded import of 'warnings'. 2006-12-13 22:31:37 +00:00
Walter Dörwald da1ad32cec Fix typo. 2006-12-12 21:55:31 +00:00
Raymond Hettinger c789f341bb Add test for SF bug 1576657 2006-12-08 17:35:25 +00:00
Georg Brandl 87fa559479 Patch #1610437: fix a tarfile bug with long filename headers. 2006-12-06 22:21:18 +00:00
Martin v. Löwis a00bcac003 Patch #1371075: Make ConfigParser accept optional dict type
for ordering, sorting, etc.
2006-12-03 12:01:53 +00:00
Walter Dörwald f008203cb4 Move xdrlib tests from the module into a separate test script,
port the tests to unittest and add a few new tests.
2006-12-01 16:59:47 +00:00
Michael W. Hudson f390442130 a test for an error condition not covered by existing tests
(noticed this when writing the equivalent code for pypy)
2006-11-23 13:54:04 +00:00
Walter Dörwald 39b8b6afb5 Change decode() so that it works with a buffer (i.e. unicode(..., 'utf-8-sig'))
SF bug #1601501.
2006-11-23 05:03:56 +00:00
Martin v. Löwis 07529354db Patch #1070046: Marshal new-style objects like InstanceType
in xmlrpclib.
2006-11-19 18:51:54 +00:00
Andrew M. Kuchling 9eec51c04f Add a test case of data w/ bytes > 127 2006-11-19 18:40:01 +00:00
Martin v. Löwis cffcc8b195 Make cStringIO.truncate raise IOError for negative
arguments (even for -1). Fixes the last bit of
#1359365.
2006-11-19 10:41:41 +00:00
Georg Brandl 283a1353a0 Patch [ 1586791 ] better error msgs for some TypeErrors 2006-11-19 08:48:30 +00:00
Andrew M. Kuchling db4f255c61 Expand checking in test_sha 2006-11-18 22:17:33 +00:00
Andrew M. Kuchling 8c456f3b57 Remove file-locking in MH.pack() method.
This change looks massive but it's mostly a re-indenting after
removing some try...finally blocks.

Also adds a test case that does a pack() while the mailbox is locked; this
test would have turned up bugs in the original code on some platforms.

In both nmh and GNU Mailutils' implementation of MH-format mailboxes,
no locking is done of individual message files when renaming them.

The original mailbox.py code did do locking, which meant that message
files had to be opened.  This code was buggy on certain platforms
(found through reading the code); there were code paths that closed
the file object and then called _unlock_file() on it.

Will backport to 25-maint once I see how the buildbots react to this patch.
2006-11-17 13:30:25 +00:00
Georg Brandl 25aabf4cbb Bug #1588217: don't parse "= " as a soft line break in binascii's
a2b_qp() function, instead leave it in the string as quopri.decode()
does.
2006-11-16 17:08:45 +00:00
Martin v. Löwis 065f0c8a06 Patch #1355023: support whence argument for GzipFile.seek. 2006-11-12 10:41:39 +00:00
Martin v. Löwis 040a927cd1 Patch #1065257: Support passing open files as body in
HTTPConnection.request().
2006-11-12 10:32:47 +00:00
Andrew M. Kuchling a3e5d3757c [Bug #1569790] mailbox.Maildir.get_folder() loses factory information
Both the Maildir and MH classes had this bug; the patch fixes both classes
and adds a test.

Will backport to 25-maint.
2006-11-09 13:27:07 +00:00
Martin v. Löwis 3a62404264 Correctly forward exception in instance_contains().
Fixes #1591996. Patch contributed by Neal Norwitz.
Will backport.
2006-11-08 06:46:37 +00:00
Neal Norwitz 85dbec6da7 Bug #1588287: fix invalid assertion for `1,2` in debug builds.
Will backport
2006-11-04 19:25:22 +00:00
Tim Peters abd8a336a3 Whitespace normalization. 2006-11-03 02:32:46 +00:00
Neal Norwitz 1ead698494 I'm assuming this is correct, it fixes the tests so they pass again 2006-10-29 23:58:36 +00:00
Walter Dörwald 98c70acf47 Add tests for incremental codecs with an errors
argument.
2006-10-29 23:02:27 +00:00
Walter Dörwald 92911bfc6a Add tests for basic argument errors. 2006-10-29 22:06:28 +00:00
Georg Brandl 7d00099021 Move the check for openpty to the beginning. 2006-10-29 21:54:18 +00:00
Georg Brandl 59ba4299d0 Remove leftover test output file. 2006-10-29 20:35:12 +00:00
Georg Brandl cd97208110 Convert test_openpty to unittest. 2006-10-29 20:31:17 +00:00
Georg Brandl e8328ba723 Convert test_MimeWriter to unittest. 2006-10-29 20:28:26 +00:00
Georg Brandl 71a2089712 Completely convert test_httplib to unittest. 2006-10-29 20:24:01 +00:00
Georg Brandl e184433654 Convert test_cgi to unittest. 2006-10-29 20:09:12 +00:00
Georg Brandl a962eb32d9 Convert test_cookie to unittest. 2006-10-29 19:51:16 +00:00
Georg Brandl bd0fb14e51 Convert test_types to unittest. 2006-10-29 19:35:03 +00:00
Georg Brandl 850b2be67e Convert test_nis to unittest. 2006-10-29 19:24:43 +00:00
Georg Brandl eecce795a3 Convert test_poll to unittest. 2006-10-29 19:20:45 +00:00
Georg Brandl 3163179f1b Convert test_mmap to unittest. 2006-10-29 19:13:40 +00:00
Georg Brandl b9f4ad3a9a Bug #1576657: when setting a KeyError for a tuple key, make sure that
the tuple isn't used as the "exception arguments tuple".
2006-10-29 18:31:42 +00:00
Georg Brandl 2c9838e30f Bug #1586613: fix zlib and bz2 codecs' incremental en/decoders. 2006-10-29 14:39:09 +00:00
Georg Brandl 5b4e1c2530 Fix the new EncodedFile test to work with big endian platforms. 2006-10-29 09:32:16 +00:00
Georg Brandl facd273198 Test assert if __debug__ is true. 2006-10-29 09:18:00 +00:00
Georg Brandl 8f99f81dfc Fix codecs.EncodedFile which did not use file_encoding in 2.5.0, and
fix all codecs file wrappers to work correctly with the "with"
statement (bug #1586513).
2006-10-29 08:39:22 +00:00
Neal Norwitz 07fdcfd6c9 Fix test_modulefinder so it doesn't fail when run after test_distutils. 2006-10-28 21:56:49 +00:00
Neal Norwitz 21997afb0c Fix bug #1565514, SystemError not raised on too many nested blocks.
It seems like this should be a different error than SystemError, but
I don't have any great ideas and SystemError was raised in 2.4 and earlier.

Will backport.
2006-10-28 21:19:07 +00:00
Georg Brandl b21e0815bf make test_grammar pass with python -O 2006-10-28 20:25:09 +00:00
Georg Brandl 0b679629c6 Convert test_opcodes to unittest. 2006-10-28 13:56:58 +00:00
Georg Brandl 2f03760a98 Convert test_math to unittest. 2006-10-28 13:51:49 +00:00
Georg Brandl 856b446793 Update outstanding bugs test file. 2006-10-28 13:11:41 +00:00
Georg Brandl c6fdec6d7e Convert test_global, test_scope and test_grammar to unittest.
I tried to enclose all tests which must be run at the toplevel
(instead of inside a method) in exec statements.
2006-10-28 13:10:17 +00:00
Walter Dörwald 3a3d8ea497 Port test_bufio to unittest. 2006-10-28 10:47:12 +00:00
Thomas Heller 112d1a64ac Modulefinder now handles absolute and relative imports, including
tests.

Will backport to release25-maint.
2006-10-27 19:05:53 +00:00
Thomas Heller df08f0b9a0 WindowsError.str should display the windows error code,
not the posix error code; with test.
Fixes #1576174.

Will backport to release25-maint.
2006-10-27 18:31:36 +00:00
Andrew M. Kuchling 0f87183cf5 [Bug #1575506] The _singlefileMailbox class was using the wrong file object in its flush() method, causing an error 2006-10-27 16:55:34 +00:00
Andrew M. Kuchling 41eb7164df [Bug #1576241] Let functools.wraps work with built-in functions 2006-10-27 16:39:10 +00:00
Martin v. Löwis b5bc537c5e Patch #1549049: Rewrite type conversion in structmember.
Fixes #1545696 and #1566140. Will backport to 2.5.
2006-10-27 06:16:31 +00:00
Georg Brandl a32e0a099b Patch [ 1583506 ] tarfile.py: 100-char filenames are truncated 2006-10-24 16:54:16 +00:00
Martin v. Löwis e97c759660 Remove passwd.adjunct.byname from list of maps
for test_nis. Will backport to 2.5.
2006-10-22 13:45:13 +00:00
Walter Dörwald d3973b578f Port test___future__ to unittest. 2006-10-22 08:59:41 +00:00
Tim Peters ef3f32f965 Whitespace normalization. 2006-10-18 05:09:12 +00:00
Martin v. Löwis a97e06d9db Round to int, because some systems support sub-second time stamps in stat, but not in utime.
Also be consistent with modifying only mtime, not atime.
2006-10-15 11:02:07 +00:00
Martin v. Löwis cfcd3a9569 Loosen the test for equal time stamps. 2006-10-15 09:35:51 +00:00
Martin v. Löwis 18aaa568fd Patch #1576166: Support os.utime for directories on Windows NT+. 2006-10-15 08:43:33 +00:00
Neal Norwitz cbeb687c68 Update the peephole optimizer to remove more dead code (jumps after returns)
and inline jumps to returns.
2006-10-14 21:33:38 +00:00
Georg Brandl 2c1375c8db Bug #1545497: when given an explicit base, int() did ignore NULs
embedded in the string to convert.
2006-10-12 11:27:59 +00:00
Georg Brandl 5597e261b2 Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode
arguments with the system default encoding just like the write()
method does, instead of converting it to a raw buffer.
2006-10-12 09:47:12 +00:00
Martin v. Löwis f43893a878 Bug #1565150: Fix subsecond processing for os.utime on Windows. 2006-10-09 20:44:25 +00:00
Hye-Shik Chang b788346573 Bug #1572832: fix a bug in ISO-2022 codecs which may cause segfault
when encoding non-BMP unicode characters.  (Submitted by Ray Chason)
2006-10-08 13:48:34 +00:00
Armin Rigo 7ccbca93a2 Forward-port of r52136,52138: a review of overflow-detecting code.
* unified the way intobject, longobject and mystrtoul handle
  values around -sys.maxint-1.

* in general, trying to entierely avoid overflows in any computation
  involving signed ints or longs is extremely involved.  Fixed a few
  simple cases where a compiler might be too clever (but that's all
  guesswork).

* more overflow checks against bad data in marshal.c.

* 2.5 specific: fixed a number of places that were still confusing int
  and Py_ssize_t.  Some of them could potentially have caused
  "real-world" breakage.

* list.pop(x): fixing overflow issues on x was messy.  I just reverted
  to PyArg_ParseTuple("n"), which does the right thing.  (An obscure
  test was trying to give a Decimal to list.pop()... doesn't make
  sense any more IMHO)

* trying to write a few tests...
2006-10-04 12:17:45 +00:00
Martin v. Löwis 820d6ac9d7 Fix integer negation and absolute value to not rely
on undefined behaviour of the C compiler anymore.
Will backport to 2.5 and 2.4.
2006-10-04 05:47:34 +00:00
Jeremy Hylton 82271f13e7 Fix for SF bug 1569998: break permitted inside try.
The compiler was checking that there was something on the fblock
stack, but not that there was a loop on the stack.  Fixed that and
added a test for the specific syntax error.

Bug fix candidate.
2006-10-04 02:24:52 +00:00
Brett Cannon 373d90b365 Convert test_imp over to unittest. 2006-10-03 23:23:14 +00:00
Georg Brandl 54c3db55a2 Convert test_import to unittest. 2006-09-30 12:16:03 +00:00
Georg Brandl 4ddfcd3b60 Bug #1556784: allow format strings longer than 127 characters in
datetime's strftime function.
2006-09-30 11:17:34 +00:00
Georg Brandl 154324a8c3 Bug #1560617: in pyclbr, return full module name not only for classes,
but also for functions.
2006-09-30 11:06:47 +00:00
Georg Brandl 3267d28f9d Bug #1566800: make sure that EnvironmentError can be called with any
number of arguments, as was the case in Python 2.4.
2006-09-30 09:03:42 +00:00
Georg Brandl 5d59c09834 Patch #1567691: super() and new.instancemethod() now don't accept
keyword arguments any more (previously they accepted them, but didn't
use them).
2006-09-30 08:43:30 +00:00
Armin Rigo c839c2f226 Another crasher. 2006-09-25 15:16:26 +00:00
Georg Brandl c7986cee76 Fix a bug in traceback.format_exception_only() that led to an error
being raised when print_exc() was called without an exception set.
In version 2.4, this printed "None", restored that behavior.
2006-09-24 12:50:24 +00:00
Georg Brandl a10d3afed2 Fix a bug in the parser's future statement handling that led to "with"
not being recognized as a keyword after, e.g., this statement:
from __future__ import division, with_statement
2006-09-24 12:35:36 +00:00
Brett Cannon e042601251 Make output on test_strptime() be more verbose in face of failure. This is in
hopes that more information will help debug the failing test on HPPA Ubuntu.
2006-09-23 19:53:20 +00:00
Neal Norwitz 3a23017bb2 Bug #1557232: fix seg fault with def f((((x)))) and def f(((x),)).
These tests should be improved.  Hopefully this fixes variations when
flipping back and forth between fpdef and fplist.

Backport candidate.
2006-09-22 08:18:10 +00:00
Jack Diederich 36234e8f66 * regression bug, count_next was coercing a Py_ssize_t to an unsigned Py_size_t
which breaks negative counts
* added test for negative numbers
will backport to 2.5.1
2006-09-21 17:50:26 +00:00
Neal Norwitz 361b46be24 Add a "crasher" taken from the sgml bug report referenced in the comment 2006-09-11 04:32:57 +00:00
Neal Norwitz bcc119a22c Forward port of 51850 from release25-maint branch.
As mentioned on python-dev, reverting patch #1504333 because it introduced
an infinite loop in rev 47154.

This patch also adds a test to prevent the regression.
2006-09-11 04:24:09 +00:00
Brett Cannon ca2ca79d23 Remove the __unicode__ method from exceptions. Allows unicode() to be called
on exception classes.  Would require introducing a tp_unicode slot to make it
work otherwise.

Fixes bug #1551432 and will be backported.
2006-09-09 07:11:46 +00:00
Nick Coghlan c495c66ea9 Fix the speed regression in inspect.py by adding another cache to speed up getmodule(). Patch #1553314 2006-09-07 10:50:34 +00:00
Gustavo Niemeyer c36bede6ff Fixed subprocess bug #1531862 again, after removing tests
offending buildbot
2006-09-07 00:48:33 +00:00
Georg Brandl 38f6237dfe Bug #1542051: Exceptions now correctly call PyObject_GC_UnTrack.
Also make sure that every exception class has __module__ set to
'exceptions'.
2006-09-06 06:50:05 +00:00
Neal Norwitz 314bef9fff Revert 51758 because it broke all the buildbots 2006-09-06 03:58:34 +00:00
Gustavo Niemeyer 8cb64eaaf3 Fixing #1531862: Do not close standard file descriptors in the
subprocess module.
2006-09-06 01:58:52 +00:00
Hye-Shik Chang 199f1db1fa Fix a few bugs on cjkcodecs found by Oren Tirosh:
- gbk and gb18030 codec now handle U+30FB KATAKANA MIDDLE DOT correctly.
- iso2022_jp_2 codec now encodes into G0 for KS X 1001, GB2312
  codepoints to conform the standard.
- iso2022_jp_3 and iso2022_jp_2004 codec can encode JIS X 2013:2
  codepoints now.
2006-09-05 12:07:09 +00:00
Neal Norwitz dac090d3e6 Bug #1520864 (again): unpacking singleton tuples in list comprehensions and
generator expressions (x for x, in ... ) works again.

Sigh, I only fixed for loops the first time, not list comps and genexprs too.
I couldn't find any more unpacking cases where there is a similar bug lurking.

This code should be refactored to eliminate the duplication.  I'm sure
the listcomp/genexpr code can be refactored.  I'm not sure if the for loop
can re-use any of the same code though.

Will backport to 2.5 (the only place it matters).
2006-09-05 03:53:08 +00:00
Neal Norwitz 4bc2c0919b Patch #1540470, for OpenBSD 4.0. Backport candidate for 2.[34]. 2006-09-05 02:57:01 +00:00
Neal Norwitz a22975fb35 Fix SF bug #1546288, crash in dict_equal. 2006-09-05 02:24:03 +00:00
Raymond Hettinger a0c95fa4d8 Fix endcase for str.rpartition() 2006-09-04 15:32:48 +00:00
Neal Norwitz c1120b4b66 Hmm, this test has failed at least twice recently on the OpenBSD and
Debian sparc buildbots.  Since this goes through a lot of tests
and hits the disk a lot it could be slow (especially if NFS is involved).
I'm not sure if that's the problem, but printing periodic msgs shouldn't hurt.
The code was stolen from test_compiler.
2006-09-02 19:40:19 +00:00
Nick Coghlan ced1218dd1 Make decimal.ContextManager a private implementation detail of decimal.localcontext() 2006-09-02 03:54:17 +00:00
Neal Norwitz 69e8897505 Bug #1550714: fix SystemError from itertools.tee on negative value for n.
Needs backport to 2.5.1 and earlier.
2006-09-02 02:58:13 +00:00
Nick Coghlan db38588a25 Remove the old decimal context management tests from test_contextlib (guess who didn't run the test suite before committing...) 2006-08-31 12:51:25 +00:00
Nick Coghlan 8b6999b4c5 Fix the wrongheaded implementation of context management in the decimal module and add unit tests. (python-dev discussion is ongoing regarding what we do about Python 2.5) 2006-08-31 12:00:43 +00:00
Jack Diederich 7b60464ceb - Move functions common to all path modules into genericpath.py and have the
OS speicifc path modules import them.
- Have os2emxpath import common functions fron ntpath instead of using copies
2006-08-26 18:42:06 +00:00
Tim Peters 4582d7d905 A new test here relied on preserving invisible trailing
whitespace in expected output.  Stop that.
2006-08-25 22:26:21 +00:00
Tim Peters 147f9ae6db Whitespace normalization. 2006-08-25 22:05:39 +00:00
Armin Rigo cd73a78b68 The regular expression engine in '_sre' can segfault when interpreting
bogus bytecode.  It is unclear whether this is a real bug or a "won't
fix" case like bogus_code_obj.py.
2006-08-25 12:44:28 +00:00
Thomas Wouters 9e398cac94 Fix SF bug #1545837: array.array borks on deepcopy.
array.__deepcopy__() needs to take an argument, even if it doesn't actually
use it. Will backport to 2.5 and 2.4 (if applicable.)
2006-08-24 18:40:20 +00:00
Alex Martelli 348dc88097 Reverting the patch that tried to fix the issue whereby x**2 raises
OverflowError while x*x succeeds and produces infinity; apparently
these inconsistencies cannot be fixed across ``all'' platforms and
there's a widespread feeling that therefore ``every'' platform
should keep suffering forevermore.  Ah well.
2006-08-23 22:17:59 +00:00
Jeremy Hylton 76467ba6d6 Bug fixes large and small for tokenize.
Small: Always generate a NL or NEWLINE token following
       a COMMENT token.  The old code did not generate an NL token if
       the comment was on a line by itself.

Large: The output of untokenize() will now match the
       input exactly if it is passed the full token sequence.  The
       old, crufty output is still generated if a limited input
       sequence is provided, where limited means that it does not
       include position information for tokens.

Remaining bug: There is no CONTINUATION token (\) so there is no way
for untokenize() to handle such code.

Also, expanded the number of doctests in hopes of eventually removing
the old-style tests that compare against a golden file.

Bug fix candidate for Python 2.5.1. (Sigh.)
2006-08-23 21:14:03 +00:00
Alex Martelli 20362a820b x**2 should about equal x*x (including for a float x such that the result is
inf) but didn't; added a test to test_float to verify that, and ignored the
ERANGE value for errno in the pow operation to make the new test pass (with
help from Marilyn Davis at the Google Python Sprint -- thanks!).
2006-08-23 20:42:02 +00:00
Jeremy Hylton 29bef0bbaa Baby steps towards better tests for tokenize 2006-08-23 18:37:43 +00:00
Jeremy Hylton 60e96f666c Expose column offset information in parse trees. 2006-08-22 20:46:00 +00:00
Neal Norwitz 17753ecbfa Patch #1541585: fix buffer overrun when performing repr() on
a unicode string in a build with wide unicode (UCS-4) support.

This code could be improved, so add an XXX comment.
2006-08-21 22:21:19 +00:00
Neal Norwitz 4f096d9487 Patch #1542451: disallow continue anywhere under a finally
I'm undecided if this should be backported to 2.5 or 2.5.1.
Armin suggested to wait (I'm of the same opinion).  Thomas W thinks
it's fine to go in 2.5.
2006-08-21 19:47:08 +00:00
Neal Norwitz 8a519392d5 Fix bug #1543303, tarfile adds padding that breaks gunzip.
Patch # 1543897.

Will backport to 2.5
2006-08-21 17:59:46 +00:00
Georg Brandl 8c036ccf93 Patch #1542948: fix urllib2 header casing issue. With new test. 2006-08-20 13:15:39 +00:00
Martin v. Löwis 2eb8c4f292 Bug #1541863: uuid.uuid1 failed to generate unique identifiers
on systems with low clock resolution.
2006-08-18 03:47:18 +00:00
Neil Schemenauer 4c6b0d5bec Fix a bug in the ``compiler`` package that caused invalid code to be
generated for generator expressions.
2006-08-16 23:38:05 +00:00
Fredrik Lundh dc075b9ddd SF#1534630
ignore data that arrives before the opening start tag
2006-08-16 16:47:07 +00:00
Ka-Ping Yee b1cb56ad17 Update code and tests to support the 'bytes_le' attribute (for
little-endian byte order on Windows), and to work around clocks
with low resolution yielding duplicate UUIDs.

Anthony Baxter has approved this change.
2006-08-16 07:02:50 +00:00
Neal Norwitz 271a8689e9 Subclasses of int/long are allowed to define an __index__. 2006-08-15 06:29:03 +00:00
Neal Norwitz b476fdf7c3 Fix the test for SocketServer so it should pass on cygwin and not fail
sporadically on other platforms.  This is really a band-aid that doesn't
fix the underlying issue in SocketServer.  It's not clear if it's worth
it to fix SocketServer, however, I opened a bug to track it:

	http://python.org/sf/1540386
2006-08-15 04:58:28 +00:00
Tim Peters c02c1c8a12 Whitespace normalization. 2006-08-15 00:25:04 +00:00
Georg Brandl 85fec59104 Add an additional test: BZ2File write methods should raise IOError
when file is read-only.
2006-08-14 21:45:32 +00:00
Georg Brandl 3335a7ad63 Patch #1535500: fix segfault in BZ2File.writelines and make sure it
raises the correct exceptions.
2006-08-14 21:42:55 +00:00
Georg Brandl 2463f8f831 Make tabnanny recognize IndentationErrors raised by tokenize.
Add a test to test_inspect to make sure indented source
is recognized correctly. (fixes #1224621)
2006-08-14 21:34:08 +00:00
Marc-André Lemburg 040f76b79c Slightly revised version of patch #1538956:
Replace UnicodeDecodeErrors raised during == and !=
compares of Unicode and other objects with a new
UnicodeWarning.

All other comparisons continue to raise exceptions.
Exceptions other than UnicodeDecodeErrors are also left
untouched.
2006-08-14 10:55:19 +00:00
Neal Norwitz 56423e5762 Fix segfault when doing string formatting on subclasses of long if
__oct__, __hex__ don't return a string.

Klocwork 308
2006-08-13 18:11:08 +00:00
Neal Norwitz 1872b1c01f Fix a couple of bugs exposed by the new __index__ code. The 64-bit buildbots
were failing due to inappropriate clipping of numbers larger than 2**31
with new-style classes. (typeobject.c)  In reviewing the code for classic
classes, there were 2 problems.  Any negative value return could be returned.
Always return -1 if there was an error.  Also make the checks similar
with the new-style classes.  I believe this is correct for 32 and 64 bit
boxes, including Windows64.

Add a test of classic classes too.
2006-08-12 18:44:06 +00:00
Neal Norwitz 8a87f5d37e Patch #1538606, Patch to fix __index__() clipping.
I modified this patch some by fixing style, some error checking, and adding
XXX comments.  This patch requires review and some changes are to be expected.
I'm checking in now to get the greatest possible review and establish a
baseline for moving forward.  I don't want this to hold up release if possible.
2006-08-12 17:03:09 +00:00
Georg Brandl f3e304297e Repair logging test spew caused by rev. 51206. 2006-08-12 08:32:02 +00:00
Tim Peters 953c1897d2 Ah, fudge. One of the prints here actually "shouldn't be"
protected by "if verbose:", which caused the test to fail on
all non-Windows boxes.

Note that I deliberately didn't convert this to unittest yet,
because I expect it would be even harder to debug this on Tru64
after conversion.
2006-08-12 05:17:41 +00:00
Tim Peters 1742f3331f test_signal: Signal handling on the Tru64 buildbot
appears to be utterly insane.  Plug some theoretical
insecurities in the test script:

- Verify that the SIGALRM handler was actually installed.

- Don't call alarm() before the handler is installed.

- Move everything that can fail inside the try/finally,
  so the test cleans up after itself more often.

- Try sending all the expected signals in
  force_test_exit(), not just SIGALRM.  Since that was
  fixed to actually send SIGALRM (instead of invisibly
  dying with an AttributeError), we've seen that sending
  SIGALRM alone does not stop this from hanging.

- Move the "kill the child" business into the finally
  clause, so the child doesn't survive test failure
  to send SIGALRM to other tests later (there are also
  baffling SIGALRM-related failures in test_socket).

- Cancel the alarm in the finally clause -- if the
  test dies early, we again don't want SIGALRM showing
  up to confuse a later test.

Alas, this still relies on timing luck wrt the spawned
script that sends the test signals, but it's hard to see
how waiting for seconds can so often be so unlucky.

test_threadedsignals:  curiously, this test never fails
on Tru64, but doesn't normally signal SIGALRM.  Anyway,
fixed an obvious (but probably inconsequential) logic
error.
2006-08-12 04:42:47 +00:00
Neal Norwitz 421c1319ad Whoops, how did that get in there. :-) Revert all the parts of 51227 that were not supposed to go it. Only Modules/_ctypes/cfields.c was supposed to be changed 2006-08-12 02:12:30 +00:00
Neal Norwitz 6b4953fd3d Check returned pointer is valid.
Klocwork #233
2006-08-12 02:06:34 +00:00
Neal Norwitz 003c9e2952 Fix the failures on cygwin (2006-08-10 fixed the actual locking issue).
The first hunk changes the colon to an ! like other Windows variants.
We need to always wait on the child so the lock gets released and
no other tests fail.  This is the try/finally in the second hunk.
2006-08-11 06:09:41 +00:00
Tim Peters 8b8c59cf1d force_test_exit(): This has been completely ineffective
at stopping test_signal from hanging forever on the Tru64
buildbot.  That could be because there's no such thing as
signal.SIGALARM.  Changed to the idiotic (but standard)
signal.SIGALRM instead, and added some more debug output.
2006-08-11 03:49:10 +00:00
Tim Peters 08574770c5 test_PyThreadState_SetAsyncExc(): This is failing on some
64-bit boxes.  I have no idea what the ctypes docs mean
by "integers", and blind-guessing here that it intended to
mean the signed C "int" type, in which case perhaps I can
repair this by feeding the thread id argument to type
ctypes.c_long().

Also made the worker thread daemonic, so it doesn't hang
Python shutdown if the test continues to fail.
2006-08-11 00:49:01 +00:00
Tim Peters b7ad1eb2c6 Whitespace normalization broke test_cgi, because a line
of quoted test data relied on preserving a single trailing
blank.  Changed the string from raw to regular, and forced
in the trailing blank via an explicit \x20 escape.
2006-08-10 23:22:13 +00:00
Tim Peters 0d9ca9fa47 Whitespace normalization. 2006-08-10 22:48:45 +00:00
Tim Peters 4643c2fda1 Followup to bug #1069160.
PyThreadState_SetAsyncExc():  internal correctness changes wrt
refcount safety and deadlock avoidance.  Also added a basic test
case (relying on ctypes) and repaired the docs.
2006-08-10 22:45:34 +00:00
Guido van Rossum 9568b738ec Chris McDonough's patch to defend against certain DoS attacks on FieldStorage.
SF bug #1112549.
2006-08-10 17:41:07 +00:00
Tim Peters b2dd1a3906 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).
2006-08-10 03:01:26 +00:00
Armin Rigo 97ff04789d Concatenation on a long string breaks (SF #1526585). 2006-08-09 15:37:26 +00:00
Armin Rigo 51fc8c456e Fix and test for an infinite C recursion. 2006-08-09 14:55:26 +00:00
Martin v. Löwis ab2f8f7bd5 __hash__ may now return long int; the final hash
value is obtained by invoking hash on the long int.
Fixes #1536021.
2006-08-09 07:57:39 +00:00
Tim Peters 8e24a9678f Whitespace normalization. 2006-08-09 00:52:26 +00:00
Thomas Heller dc68ffd003 Remove accidently committed, duplicated test. 2006-08-08 17:39:20 +00:00
Thomas Heller ab1049c046 memcmp() can return values other than -1, 0, and +1 but tp_compare
must not.
2006-08-08 17:37:00 +00:00
Andrew MacIntyre 16ee33adfc test_threading now skips testing alternate thread stack sizes on
platforms that don't support changing thread stack size.
2006-08-06 12:37:03 +00:00
Georg Brandl d336e98ed9 Don't produce output in test_builtin. 2006-08-06 09:17:16 +00:00
Georg Brandl 7e3ba2a699 Bug #1535165: fixed a segfault in input() and raw_input() when
sys.stdin is closed.
2006-08-06 08:23:54 +00:00
Georg Brandl 9908d1656c Bug #1535182: really test the xreadlines() method of bz2 objects. 2006-08-06 07:06:33 +00:00
Bob Ippolito e6c9f982a0 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.
2006-08-04 23:59:21 +00:00
Tim Peters b1ccc4d409 Whitespace normalization. 2006-08-04 22:00:35 +00:00
Georg Brandl e9462c72bd Change fix for segfaulting property(), add a NEWS entry and a test. 2006-08-04 18:03:37 +00:00
Neil Schemenauer 06ded09d40 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.
2006-08-04 16:20:30 +00:00
Neal Norwitz 0cbd805a10 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.
2006-08-04 05:09:28 +00:00
Neal Norwitz 4ffedadb10 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).
2006-08-04 04:58:47 +00:00
Neal Norwitz ff4b63b80f Bug #1531405, format_exception no longer raises an exception if
str(exception) raised an exception.
2006-08-04 04:50:21 +00:00
Neal Norwitz 9b0ca79213 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.
2006-08-02 06:46:21 +00:00
Neal Norwitz 3ee5941f68 Let us know when there was a problem and the child had to kill the parent 2006-08-02 06:19:19 +00:00
Tim Peters 4edcba69f3 Whitespace normalization. 2006-08-02 03:27:46 +00:00
Andrew M. Kuchling 86e1e38059 [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.
2006-08-01 18:16:15 +00:00
Tim Peters 6458452c8a Whitespace normalization. 2006-07-31 01:46:03 +00:00
Neal Norwitz 313f8a903c 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.
2006-07-30 19:20:42 +00:00
Neal Norwitz ec3c5e396e Verify that the signal handlers were really called 2006-07-30 19:18:38 +00:00
Martin v. Löwis 4e67838d6c Don't copy directory stat times in shutil.copytree on Windows
Fixes #1525866.
2006-07-30 13:00:31 +00:00
Neal Norwitz f71ec5a0ac Bug #1515471: string.replace() accepts character buffers again.
Pass the char* and size around rather than PyObject's.
2006-07-30 06:57:04 +00:00
Neal Norwitz 0d62a06206 Patch #1531113: Fix augmented assignment with yield expressions.
Also fix a SystemError when trying to assign to yield expressions.
2006-07-30 06:53:31 +00:00
Tim Peters da9face1fe Whitespace normalization. 2006-07-30 00:58:15 +00:00
Neal Norwitz b5a701b23f Disable test_getnode too, since this is also unreliable. 2006-07-29 20:37:08 +00:00
Neal Norwitz 2fde3bda8c 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.
2006-07-29 19:29:35 +00:00
Fred Drake 9297e16907 restore test un-intentionally removed in the xmlcore purge (revision 50941) 2006-07-29 18:19:19 +00:00
Fred Drake fbdeaad069 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
2006-07-29 16:56:15 +00:00
Georg Brandl edd9b0dfb3 Bug #1441397: The compiler module now recognizes module and function
docstrings correctly as it did in Python 2.4.
2006-07-29 09:33:26 +00:00
Georg Brandl 4793aa39a9 Patch #1529686: also run test_email_codecs with regrtest.py. 2006-07-28 18:31:39 +00:00
Tim Peters 750c4420a8 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).
2006-07-28 04:51:59 +00:00
Neal Norwitz df80af7659 Ensure the actual number matches the expected count 2006-07-28 04:22:34 +00:00
Tim Peters 6f6814706e 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.
2006-07-27 23:44:37 +00:00
Barry Warsaw 00decd7835 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.
2006-07-27 23:43:15 +00:00
Tim Peters 08310d6cb7 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.
2006-07-27 20:47:24 +00:00
Georg Brandl 75a832d4e7 Make uuid test suite pass on this box by requesting output with LC_ALL=C. 2006-07-27 16:08:15 +00:00
Tim Peters daea035bac Whitespace normalization. 2006-07-27 15:11:00 +00:00
Georg Brandl f102fc5f86 Add test_main() methods. These three tests were never run
by regrtest.py.

We really need a simpler testing framework.
2006-07-27 15:05:36 +00:00
Tim Peters 95621b25dc Whitespace normalization. 2006-07-26 23:23:15 +00:00
Georg Brandl 5f135787ec 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).
2006-07-26 08:03:10 +00:00
Georg Brandl 0619a329e8 Bug #1459963: properly capitalize HTTP header names. 2006-07-26 07:40:17 +00:00
Armin Rigo b62efad943 Document the crashers that will not go away soon as "won't fix",
and explain why.
2006-07-25 18:38:39 +00:00
Armin Rigo 5a9a2a3fe1 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).
2006-07-25 18:11:07 +00:00
Armin Rigo 4df7c0a55b Document why is and is not a good way to fix the gc_inspection crasher. 2006-07-25 18:09:57 +00:00
Brett Cannon 813669f911 Fix a bug in the messages for an assert failure where not enough arguments to a string
were being converted in the format.
2006-07-25 17:34:36 +00:00
Tim Peters 0c4a3b330d 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.
2006-07-25 04:07:22 +00:00
Greg Ward 4d16b915aa Don't use standard assert: want tests to fail even when run with -O.
Delete cruft.
2006-07-25 02:11:12 +00:00
Tim Peters 0bbfd83250 Whitespace normalization. 2006-07-24 21:02:15 +00:00
Georg Brandl c13c34c39d Patch #1515343: Fix printing of deprecated string exceptions with a
value in the traceback module.
2006-07-24 14:09:56 +00:00
Martin v. Löwis bda0dde1c4 Patch #1448199: Release GIL around ConnectRegistry. 2006-07-24 10:26:33 +00:00
Greg Ward 48fae7acd2 Resync optparse with Optik 1.5.3: minor tweaks for/to tests. 2006-07-23 16:05:51 +00:00
Andrew MacIntyre afa358fabf Get mailbox module working on OS/2 EMX port. 2006-07-23 13:04:00 +00:00
Greg Ward 7802af426e 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
2006-07-23 02:25:53 +00:00
Neal Norwitz cde0fa9c61 Don't fail if the directory already exists 2006-07-22 17:00:57 +00:00
Phillip J. Eby 1a2959cfa8 Fix SF#1516184 (again) and add a test to prevent regression.
(There was a problem with empty filenames still causing recursion)
2006-07-20 15:54:16 +00:00
Tim Peters 112aad3630 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.
2006-07-19 00:03:19 +00:00
Tim Peters 73a9eade1c Whitespace normalization. 2006-07-18 21:55:15 +00:00
Brett Cannon caebe22038 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.
2006-07-18 04:41:36 +00:00
Georg Brandl 7b71bf3872 Remove usage of sets module (patch #1500609). 2006-07-17 13:23:46 +00:00
Neal Norwitz 84be93b2db 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.
2006-07-16 01:50:38 +00:00
Peter Astrand 7d1d43630e Bug #1223937: CalledProcessError.errno -> CalledProcessError.returncode. 2006-07-14 14:04:45 +00:00
Neal Norwitz edef2be4af Bug #1520864: unpacking singleton tuples in for loop (for x, in) work again. 2006-07-12 05:26:17 +00:00
Tim Peters 722b88308d Whitespace normalization. 2006-07-10 21:11:49 +00:00
Tim Peters 32a8361f2d 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.
2006-07-10 21:08:24 +00:00
Peter Astrand 2b221ed657 Make it possible to run test_subprocess.py with Python 2.2, which lacks test_support.reap_children(). 2006-07-10 20:39:49 +00:00
Phillip J. Eby 5d86bdb3ae Fix SF#1516184 and add a test to prevent regression. 2006-07-10 19:03:29 +00:00
Neal Norwitz ed65755608 Bug #1512814, Fix incorrect lineno's when code at module scope
started after line 256.
2006-07-10 00:04:44 +00:00
Neal Norwitz 28746aba9b 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).
2006-07-09 22:14:42 +00:00
Neil Schemenauer 6ec6ab02c3 Fix SF bug 1441486: bad unary minus folding in compiler. 2006-07-09 21:19:29 +00:00
Neil Schemenauer 0e07b60a4e Fix AST compiler bug #1501934: incorrect LOAD/STORE_GLOBAL generation. 2006-07-09 16:16:34 +00:00
Georg Brandl 9575fb241e Add an additional test for bug #1519018. 2006-07-08 12:15:27 +00:00
Neal Norwitz fb48afa708 Fix SF bug #1519018: 'as' is now validated properly in import statements 2006-07-08 05:31:37 +00:00
Neal Norwitz 84bc19a453 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.
2006-07-07 06:03:15 +00:00
Hye-Shik Chang b9aa7ea660 Test using all CJK encodings for the testcases which don't require
specific encodings.
2006-07-06 15:39:24 +00:00
Hye-Shik Chang 84392bee48 Add a testcase for r47086 which fixed a bug in codec_getstreamcodec(). 2006-07-06 15:21:52 +00:00
Nick Coghlan 56829d5b4a Revert the __module_name__ changes made in rev 47142. We'll revisit this in Python 2.6 2006-07-06 12:53:04 +00:00
Armin Rigo 5953baca0a 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.
2006-07-06 07:58:18 +00:00
Thomas Wouters add191118f 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'
2006-07-05 11:03:49 +00:00
Martin v. Löwis d5cfa5491a Put method-wrappers into trashcan. Fixes #927248. 2006-07-03 13:47:40 +00:00
Martin v. Löwis fcfff0a7fa Bug #1417699: Reject locale-specific decimal point in float()
and atof().
2006-07-03 12:19:50 +00:00
Tim Peters 16a3932774 Whitespace normalization. 2006-07-03 08:23:19 +00:00
Martin v. Löwis ee1e06d497 Correct arithmetic in access on Win32. Fixes #1513646. 2006-07-02 18:44:00 +00:00
Fred Drake 6ffe499397 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.
2006-07-01 16:28:20 +00:00
Martin v. Löwis 7596e8342e Release all forwarded functions in .close. Fixes #1513223. 2006-07-01 15:33:37 +00:00
Vinay Sajip a09803329c Added duplicate call to fileConfig() to ensure that it cleans up after itself correctly. 2006-07-01 10:47:20 +00:00
Tim Peters 38ff36c4cc Whitespace normalization. 2006-06-30 06:18:39 +00:00
Neal Norwitz 877fdb01fe 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.
2006-06-29 05:48:14 +00:00
Neal Norwitz b15ac3169d 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.
2006-06-29 04:10:08 +00:00
Fred Drake a136210a9f 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)
2006-06-29 00:51:53 +00:00
Armin Rigo d77ef8fa51 A couple of crashers of the "won't fix" kind. 2006-06-28 10:49:51 +00:00
Nick Coghlan 999a336ad7 Make full module name available as __module_name__ even when __name__ is set to something else (like '__main__') 2006-06-28 10:41:47 +00:00
Tim Peters 3249d00f4d Whitespace normalization. 2006-06-27 11:52:49 +00:00
Andrew M. Kuchling 15486f78f0 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.
2006-06-26 17:00:35 +00:00
Andrew M. Kuchling ec3c368195 Windows doesn't have os.fork(). I'll just disable this test for now 2006-06-26 14:33:24 +00:00
Andrew M. Kuchling 9afbacef27 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.
2006-06-26 13:23:10 +00:00
Fred Drake 2f99da636b - 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
2006-06-23 06:03:45 +00:00
Peter Astrand d6b2430b7a Make it possible to run test_subprocess.py on Python 2.2, which lacks test_support.is_resource_enabled. 2006-06-22 20:06:46 +00:00
Brett Cannon 53ab5b761d '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.
2006-06-22 16:49:14 +00:00
Georg Brandl f57c54db03 Test for correct compilation of try-except-finally stmt.
Test for correct lineno on list, tuple, dict literals.
2006-06-22 14:46:46 +00:00
Armin Rigo 53c1692f6a 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.
2006-06-21 21:58:50 +00:00
Georg Brandl 0870687f44 Patch #1509001: expected skips for netbsd3. 2006-06-21 17:53:17 +00:00
Georg Brandl d819c13769 Make test_fcntl aware of netbsd3. 2006-06-21 17:52:36 +00:00
Brett Cannon 70a77ac23f 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.
2006-06-21 16:57:57 +00:00
Brett Cannon 115ecb9211 Fix typo of exception name. 2006-06-20 19:20:17 +00:00
Brett Cannon bb93f4bb0d Raise TestSkipped when the test socket connection is refused. 2006-06-20 17:30:26 +00:00
Tim Peters e7d7caa17a 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.
2006-06-19 09:09:44 +00:00
Tim Peters 5c298438b0 Repair KeyError when running test_threaded_import under -R,
as reported by Neal on python-dev.
2006-06-19 08:14:28 +00:00
Walter Dörwald 4994d9546c 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).
2006-06-19 08:07:50 +00:00