Commit Graph

4695 Commits

Author SHA1 Message Date
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
Tim Peters 43bc3788c0 Whitespace normalization. 2006-06-19 07:45:16 +00:00
Georg Brandl ccff785258 Patch #1507676: improve exception messages in abstract.c, object.c and typeobject.c. 2006-06-18 22:17:29 +00:00
Neal Norwitz 0f51cf6e04 Revert 47014 until it is more robust 2006-06-18 20:10:24 +00:00
Neal Norwitz 10b835c401 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.
2006-06-18 19:37:40 +00:00
Neal Norwitz 9602cc2aa4 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.
2006-06-18 19:35:01 +00:00
Fred Drake fab461a4b5 SF patch 1504676: Make sgmllib char and entity references pluggable
(implementation/tests contributed by Sam Ruby)
2006-06-16 23:45:06 +00:00
Neal Norwitz 13a7bef73d Add missing period in comment. 2006-06-16 04:31:28 +00:00
Neal Norwitz 217046fb9f Disable this test until we can determine what to do about it 2006-06-16 04:30:34 +00:00
Tim Peters da4b84a07a Oops -- I introduced an off-by-6436159488 error. 2006-06-15 18:38:19 +00:00
Tim Peters a608bb228c Whitespace normalization. 2006-06-15 18:06:29 +00:00
Tim Peters 84b0f581ef 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 ;-)
2006-06-15 18:04:40 +00:00
Neal Norwitz bda1418e65 Print some more info to get an idea of how much longer the test will last 2006-06-15 10:24:49 +00:00
Neal Norwitz 643ad19251 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.
2006-06-15 09:57:03 +00:00
Ronald Oussoren 143cefb846 Patch #1446489 (zipfile: support for ZIP64) 2006-06-15 08:14:18 +00:00
Neal Norwitz de7f502879 Try to narrow window of failure on slow/busy boxes (ppc64 buildbot) 2006-06-15 05:55:49 +00:00
Fred Drake a16393efb7 add tests for two cases that are handled correctly in the current code,
but that SF patch 1504676 as written mis-handles
2006-06-14 05:04:47 +00:00
Fred Drake 72c9eff59e - make some disabled tests run what they intend when enabled
- remove some over-zealous triple-quoting
2006-06-14 04:25:02 +00:00
Brett Cannon 5dc3e3f17a Missed test for rev. 46933; infinite recursion from __coerce__() returning its arguments reversed. 2006-06-13 22:26:13 +00:00
Brett Cannon ea3912b0da 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 .
2006-06-13 21:46:41 +00:00
Andrew MacIntyre 93e3ecb1f4 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.
2006-06-13 19:02:35 +00:00
Tim Peters ef7fe5f228 Whitespace normalization. 2006-06-13 18:37:07 +00:00
Andrew MacIntyre a7090dfc2c fix exception usage 2006-06-13 17:14:36 +00:00
Andrew MacIntyre 9291332de1 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).
2006-06-13 15:04:24 +00:00
Neal Norwitz 6d3d339d21 Verify the crash due to EncodingMap not initialized does not return 2006-06-13 08:41:06 +00:00
Neal Norwitz 62bc8aadd4 Don't fail if another process is listening on our port. 2006-06-13 04:08:53 +00:00
Tim Peters 2adc626bb5 Added missing svn:eol-style property to text files. 2006-06-13 00:30:50 +00:00
Tim Peters edd66fa7e9 Whitespace normalization. 2006-06-13 00:30:01 +00:00
Ka-Ping Yee f9eb82f252 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).
2006-06-12 23:47:52 +00:00
Phillip J. Eby 403019b115 Sync w/external release 0.1.2. Please see PEP 360 before making changes to external packages. 2006-06-12 04:04:32 +00:00
Neal Norwitz 6e73aaab47 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.
2006-06-12 03:33:09 +00:00
Neal Norwitz 909eb12c95 Fix the socket tests so they can be run concurrently. Backport candidate 2006-06-12 02:13:21 +00:00
Neal Norwitz 4a9ff1626a Get test to pass on S/390. Shout if you think this change is incorrect. 2006-06-11 21:38:38 +00:00
Tim Peters 06524b61d0 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).
2006-06-11 20:52:59 +00:00
Neal Norwitz 896c1ea15e 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.
2006-06-11 20:46:46 +00:00
Neal Norwitz f054aeb2a1 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.
2006-06-11 20:42:02 +00:00
Neal Norwitz a29fc29f19 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.
2006-06-11 20:25:56 +00:00
Tim Peters 4f96f1f2b5 Whitespace normalization. 2006-06-11 19:42:51 +00:00
Greg Ward 0e0c9f4740 Bug #1498146: fix optparse to handle Unicode strings in option help,
description, and epilog.
2006-06-11 16:24:11 +00:00
Neal Norwitz d3c52de557 warnings was imported at module scope, no need to import again 2006-06-11 07:26:50 +00:00
Greg Ward 7f54740c4d 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.
2006-06-11 00:40:49 +00:00
Georg Brandl 90e27d38f5 Apply perky's fix for #1503157: "/".join([u"", u""]) raising OverflowError.
Also improve error message on overflow.
2006-06-10 06:40:50 +00:00
Brett Cannon 22565aac3b 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.
2006-06-09 22:31:23 +00:00
Georg Brandl b2afe855e5 Make use of new str.startswith/endswith semantics.
Occurences in email and compiler were ignored due to backwards compat requirements.
2006-06-09 20:43:48 +00:00
Tim Peters e558486953 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.
2006-06-09 19:24:44 +00:00
Georg Brandl 242508160e RFE #1491485: str/unicode.endswith()/startswith() now accept a tuple as first argument. 2006-06-09 18:45:48 +00:00
Georg Brandl e7ec81f130 Test file.__exit__. 2006-06-09 18:29:52 +00:00
Phillip J. Eby 5cf565ddd1 Import wsgiref into the stdlib, as of the external version 0.1-r2181. 2006-06-09 16:40:18 +00:00
Andrew M. Kuchling 91c64a05d2 [Bug #1472827] Make saxutils.XMLGenerator handle \r\n\t in attribute values by escaping them properly. 2.4 bugfix candidate. 2006-06-09 13:15:57 +00:00
Neal Norwitz c9778a8951 Fix grammar and reflow 2006-06-09 05:54:18 +00:00
Tim Peters 71dc0a043b 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.
2006-06-09 05:12:40 +00:00
Tim Peters 0556e9b119 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 :-)
2006-06-09 04:02:06 +00:00
Tim Peters dbb82f623f AutoFileTests.tearDown(): Removed mysterious undocumented
try/except.  Remove TESTFN.

Throughout:  used open() instead of file(), and wrapped
long lines.
2006-06-09 03:51:41 +00:00
Tim Peters 2b6377912e 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.)
2006-06-09 03:09:42 +00:00
Tim Peters 520d8ddd97 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 ;-)
2006-06-09 02:11:02 +00:00
Brett Cannon de3b052216 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).
2006-06-08 17:00:45 +00:00
Georg Brandl 442b49e938 Convert test_file to unittest. 2006-06-08 14:50:53 +00:00
Nick Coghlan 676725db92 Add functools.update_wrapper() and functools.wraps() as described in PEP 356 2006-06-08 13:54:49 +00:00
Armin Rigo fd01d7933b (arre, arigo) SF bug #1350060
Give a consistent behavior for comparison and hashing of method objects
(both user- and built-in methods).  Now compares the 'self' recursively.
The hash was already asking for the hash of 'self'.
2006-06-08 10:56:24 +00:00
Tim Peters 80dc76e907 SF patch 1501987: Remove randomness from test_exceptions,
from ?iga Seilnacht (sorry about the name, but Firefox
on my box can't display the first character of the name --
the SF "Unix name" is zseil).

This appears to cure the oddball intermittent leaks across
runs when running test_exceptions under -R.  I'm not sure
why, but I'm too sleepy to care ;-)

The thrust of the SF patch was to remove randomness in the
pickle protocol used.  I changed the patch to use
range(pickle.HIGHEST_PROTOCOL + 1), to try both pickle and
cPickle, and randomly mucked with other test lines to put
statements on their own lines.

Not a bugfix candidate (this is fiddling new-in-2.5 code).
2006-06-07 06:57:51 +00:00
Tim Peters c27d655c00 dash_R_cleanup(): Clear filecmp._cache. This accounts for
different results across -R runs (at least on Windows) of
test_filecmp.
2006-06-07 01:04:59 +00:00
Martin Blais 215f13dd11 Normalized a few cases of whitespace in function declarations.
Found them using::

  find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done
  find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done

(I was doing this all over my own code anyway, because I'd been using spaces in
all defs, so I thought I'd make a run on the Python code as well.  If you need
to do such fixes in your own code, you can use xx-rename or parenregu.el within
emacs.)
2006-06-06 12:46:55 +00:00
Tim Peters 852eae1bc1 Access _struct attributes directly instead of mucking with getattr.
string_reverse():  Simplify.

assertRaises():  Raise TestFailed on failure.

test_unpack_from(), test_pack_into(), test_pack_into_fn():  never
use `assert` to test for an expected result (it doesn't test anything
when Python is run with -O).
2006-06-05 20:48:49 +00:00
Gregory P. Smith 372b583a6b * fix DBCursor.pget() bug with keyword argument names when no data= is
supplied [SF pybsddb bug #1477863]
2006-06-05 18:48:21 +00:00
Gregory P. Smith f0547d0d3e * add support for DBSequence objects [patch #1466734] 2006-06-05 17:38:04 +00:00
Tim Peters bf0400abe9 Remove doctest.testmod's deprecated (in 2.4) `isprivate`
argument.  A lot of hair went into supporting that!
2006-06-05 01:43:03 +00:00
Tim Peters 06c5c00819 "Flat is better than nested."
Move the long-winded, multiply-nested -R support out
of runtest() and into some module-level helper functions.
This makes runtest() and the -R code easier to follow.
That in turn allowed seeing some opportunities for code
simplification, and made it obvious that reglog.txt
never got closed.
2006-06-05 00:55:26 +00:00
Tim Peters 28eeefe566 Revert revisions:
46640 Patch #1454481:  Make thread stack size runtime tunable.
46647 Markup fix

The first is causing many buildbots to fail test runs, and there
are multiple causes with seemingly no immediate prospects for
repairing them.  See python-dev discussion.

Note that a branch can (and should) be created for resolving these
problems, like

svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH

followed by merging rev 46647 to the new branch.
2006-06-04 23:52:47 +00:00
Georg Brandl ddbaa660d3 Patch #1346214: correctly optimize away "if 0"-style stmts
(thanks to Neal for review)
2006-06-04 21:56:52 +00:00
Martin Blais af2ae72cb2 Fixes in struct and socket from merge reviews.
- Following Guido's comments, renamed

  * pack_to -> pack_into
  * recv_buf -> recv_into
  * recvfrom_buf -> recvfrom_into

- Made fixes to _struct.c according to Neal Norwitz comments on the checkins
  list.

- Converted some ints into the appropriate -- I hope -- ssize_t and size_t.
2006-06-04 13:49:49 +00:00
Andrew MacIntyre 6539d2d3c7 Patch #1454481: Make thread stack size runtime tunable. 2006-06-04 12:31:09 +00:00
Tim Peters c65a13f53b Whitespace normalization. 2006-06-04 01:22:53 +00:00
Tim Peters d609b1a20e pprint functions used to sort a dict (by key) if and only if
the output required more than one line.  "Small" dicts got
displayed in seemingly random order (the hash-induced order
produced by dict.__repr__).  None of this was documented.
Now pprint functions always sort dicts by key, and the docs
promise it.

This was proposed and agreed to during the PyCon 2006 core
sprint -- I just didn't have time for it before now.
2006-06-02 23:22:51 +00:00
Martin Blais 7f7386cfd2 Fixed struct test to not use unittest. 2006-06-02 13:03:43 +00:00
Neal Norwitz 38d4d4a35b Fix memory leak found by valgrind. 2006-06-02 04:50:49 +00:00
Neal Norwitz e152aab977 Convert docstrings to comments so regrtest -v prints method names 2006-06-02 04:45:53 +00:00
Tim Peters 80a18f0f9c Re-enable a new empty-string test added during the NFS sprint,
but disabled then because str and unicode strings gave different
results.  The implementations were repaired later during the
sprint, but the new test remained disabled.
2006-06-01 13:56:26 +00:00
Armin Rigo 35f6d36951 [ 1497053 ] Let dicts propagate the exceptions in user __eq__().
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
2006-06-01 13:19:12 +00:00
Georg Brandl e08940ef6c Some code style tweaks, and remove apply. 2006-06-01 13:00:49 +00:00
Neal Norwitz 9f16dd026c On 64-bit platforms running test_struct after test_tarfile would fail
since the deprecation warning wouldn't be raised.
2006-05-31 09:02:44 +00:00
Tim Peters dd55b0a32c Whitespace normalization. 2006-05-30 23:28:02 +00:00
Fredrik Lundh 9e9ef9fa5a changed count to return 0 for slices outside the source string 2006-05-30 17:39:58 +00:00
Bob Ippolito 4182a75571 Change wrapping terminology to overflow masking 2006-05-30 17:37:54 +00:00
Fredrik Lundh 93eff6fecd changed find/rfind to return -1 for matches outside the source string 2006-05-30 17:11:48 +00:00
Georg Brandl cdcede62c0 Convert test_exceptions to unittest. 2006-05-30 08:47:19 +00:00
Georg Brandl b0432bc032 Do the check for no keyword arguments in __init__ so that
subclasses of Exception can be supplied keyword args
2006-05-30 08:17:00 +00:00
Georg Brandl 861089fc49 Disallow keyword args for exceptions. 2006-05-30 07:34:45 +00:00
Neal Norwitz 008b861bf0 Don't fail if the (sub)pkgname already exist. 2006-05-30 07:21:10 +00:00
Georg Brandl 05f97bffac Add a test case for exception pickling. args is never NULL. 2006-05-30 07:13:29 +00:00
Tim Peters aba19bc45f deprecated_err(): Stop bizarre warning messages when the tests
are run in the order:

    test_genexps (or any other doctest-based test)
    test_struct
    test_doctest

The `warnings` module needs an advertised way to save/restore
its internal filter list.
2006-05-30 02:25:25 +00:00
Bob Ippolito 2fd3977a9d struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly) 2006-05-29 22:55:48 +00:00
Fredrik Lundh b51b470eb8 fixed "abc".count("", 100) == -96 error (hopefully, nobody's relying on
the current behaviour ;-)
2006-05-29 22:42:07 +00:00
Georg Brandl 261e251df8 Patches #1497027 and #972322: try HTTP digest auth first,
and watch out for handler name collisions.
2006-05-29 20:52:54 +00:00
Nick Coghlan c649ec5b69 Apply modified version of Collin Winter's patch #1478788
Renames functional extension module to _functools and adds a Python
functools module so that utility functions like update_wrapper can be
added easily.
2006-05-29 12:43:05 +00:00
Armin Rigo a6123abb72 A clearer error message when passing -R to regrtest.py with
release builds of Python.
2006-05-28 22:07:08 +00:00
Georg Brandl 2b33037611 Patch #1496206: urllib2 PasswordMgr ./. default ports 2006-05-28 20:23:12 +00:00
Armin Rigo a3f092751a ("Forward-port" of r46506)
Remove various dependencies on dictionary order in the standard library
tests, and one (clearly an oversight, potentially critical) in the
standard library itself - base64.py.

Remaining open issues:
 * test_extcall is an output test, messy to make robust
 * tarfile.py has a potential bug here, but I'm not familiar
   enough with this code.  Filed in as SF bug #1496501.
 * urllib2.HTTPPasswordMgr() returns a random result if there is more
   than one matching root path.  I'm asking python-dev for
   clarification...
2006-05-28 19:13:17 +00:00
George Yoshida f3c65de460 Patch #1080727: add "encoding" parameter to doctest.DocFileSuite
Contributed by Bjorn Tillenius.
2006-05-28 16:39:09 +00:00
Tim Peters 4e30617bad The cheery optimism of old age. 2006-05-27 14:13:13 +00:00
Tim Peters de41dc865a More random thrashing trying to understand spurious
Windows failures.  Who's keeping a bz2 file open?
2006-05-27 12:36:53 +00:00
Richard Jones 7b9558d37d Conversion of exceptions over from faked-up classes to new-style C types. 2006-05-27 12:29:24 +00:00