Commit Graph

12667 Commits

Author SHA1 Message Date
Jeffrey Yasskin 27d339446a Oops! 2.6's Rational.__ne__ didn't work. 2008-02-08 06:45:40 +00:00
Amaury Forgeot d'Arc b01aa430d5 issue 2045: Infinite recursion when printing a subclass of defaultdict,
if default_factory is set to a bound method.

Will backport.
2008-02-08 00:56:02 +00:00
Walter Dörwald d0e5b766f1 Fix typo in docstring for Calendar.itermonthdays(). 2008-02-07 19:57:32 +00:00
Facundo Batista 86371d61b7 Fixes Issue 1401. When redirected, a possible POST get converted
to GET, so it loses its payload. So, it also must lose the
headers related to the payload (if it has no content any more,
it shouldn't indicate content length and type).
2008-02-07 19:06:52 +00:00
Facundo Batista 9521f08b98 Fixes issue 2026. Tests converted to unittest. Thanks
Giampaolo Rodola.
2008-02-07 16:16:29 +00:00
Andrew M. Kuchling 8d119301a1 Update URL 2008-02-07 11:43:47 +00:00
Raymond Hettinger 882a416900 Merge r60628, r60631, and r60633. Register UserList and UserString will the appropriate ABCs. 2008-02-07 03:25:46 +00:00
Raymond Hettinger 017b6a3ad2 Merge 60627. 2008-02-07 03:10:33 +00:00
Raymond Hettinger 5b07ebce86 Issue 2025: Add tuple.count() and tuple.index() to follow the ABC in collections.Sequence. 2008-02-07 00:54:20 +00:00
Georg Brandl 3c3d9ac46c Revert accidental changes to test_queue in r60605. 2008-02-06 23:45:51 +00:00
Mark Dickinson 2fc9263df5 Issue 1979: Make Decimal comparisons (other than !=, ==) involving NaN
raise InvalidOperation (and return False if InvalidOperation is trapped).
2008-02-06 22:10:50 +00:00
Facundo Batista 5af2f7454d Fixes issue 1959. Converted tests to unittest.
Thanks Giampaolo Rodola.
2008-02-06 19:28:49 +00:00
Raymond Hettinger 45eda64691 Sync-up with Py3k work. 2008-02-06 01:49:00 +00:00
Georg Brandl b70907796a * Use the same code to profile for test_profile and test_cprofile.
* Convert both to unittest.
* Use the same unit testing code.
* Include the expected output in both test files.
* Make it possible to regenerate the expected output by running
  the file as a script with an '-r' argument.
2008-02-05 19:58:17 +00:00
Georg Brandl d86c7e5d93 Actually run the test. 2008-02-05 19:07:10 +00:00
Facundo Batista c2879c70e4 Issue 1951. Converts wave test cases to unittest. 2008-02-05 19:03:32 +00:00
Georg Brandl 8ada17742b Fix unittest conversion breakage. 2008-02-05 18:32:47 +00:00
Guido van Rossum 212861c54f In the experimental 'Scanner' feature, the group count was set wrong. 2008-02-05 17:32:15 +00:00
Andrew M. Kuchling 727a59070d Update PEP URL.
(This code is duplicated between pydoc and DocXMLRPCServer; maybe it
should be refactored as a GHOP project.)

2.5.2 backport candidate.
2008-02-05 16:06:57 +00:00
Marc-André Lemburg 2db7cd3ae2 Keep distutils Python 2.1 compatible (or even Python 2.4 in this case). 2008-02-05 14:50:40 +00:00
Lars Gustäbel 0192e43d64 Issue #2004: Use mode 0700 for temporary directories and default
permissions for missing directories.

(will backport to 2.5)
2008-02-05 11:51:40 +00:00
Amaury Forgeot d'Arc 99af7dbc07 Change r60575 broke test_compile:
there is no need to emit co_lnotab item when both offsets are zeros.
2008-02-05 00:26:21 +00:00
Amaury Forgeot d'Arc 6fd03bb607 #1750076: Debugger did not step on every iteration of a while statement.
The mapping between bytecode offsets and source lines (lnotab) did not contain
an entry for the beginning of the loop.

Now it does, and the lnotab can be a bit larger:
in particular, several statements on the same line generate several entries.
However, this does not bother the settrace function, which will trigger only
one 'line' event.

The lnotab seems to be exactly the same as with python2.4.
2008-02-04 21:45:05 +00:00
Christian Heimes f5806ab6e3 Small adjustments for test compact freelist test. It's no passing on Windows as well. 2008-02-04 19:30:05 +00:00
Christian Heimes f4033ab245 Increase debugging to investige failing tests on some build bots 2008-02-04 18:48:38 +00:00
Christian Heimes 422051a367 Patch #1953
I implemented the function sys._compact_freelists() and C API functions PyInt_/PyFloat_CompactFreeList() to compact the pre-allocated blocks of ints and floats. They allow the user to reduce the memory usage of a Python process that deals with lots of numbers.
The patch also renames sys._cleartypecache to sys._clear_type_cache
2008-02-04 18:00:12 +00:00
Jeffrey Yasskin a26cf9b760 Make int() and long() fall back to __trunc__(). See issue 2002. 2008-02-04 01:04:35 +00:00
Amaury Forgeot d'Arc 72a6576279 Let test_socketserver pass on win32, which does not have AF_UNIX sockets. 2008-02-03 23:57:24 +00:00
Amaury Forgeot d'Arc 07974d7a93 Correct test_mailbox on win32: since the test sets a custom 'colon' attribute
to the main mailbox, copy it to secondary mailbox instances.
2008-02-03 23:15:32 +00:00
Christian Heimes 3af3ecca92 Fixed paths to Windows build directories in build_ext.py
Use vsbuild instead of devenv in build.bat and _bsddb.vcproj
2008-02-03 14:34:18 +00:00
Brett Cannon 4b7deed9a5 Use context manager for a lock. 2008-02-03 02:43:01 +00:00
Georg Brandl 461ed872e2 Wait for a delay before reaping children -- this should fix the
test_socketserver failures on several platforms.
2008-02-03 00:04:50 +00:00
Georg Brandl cafb710711 Fix a conversion mistake that caused test_queue to fail intermittently. 2008-02-02 23:59:21 +00:00
Mark Dickinson 1dabdb25f8 Make the Rational constructor accept '3.' and '.2' as well as '3.2'. 2008-02-02 17:16:13 +00:00
Georg Brandl 5a6cfee632 Rewrite test_cprofile as unittest (and rename the file to be consistent
with all other test files). Written for GHOP by Benjamin Peterson.
2008-02-02 11:46:07 +00:00
Georg Brandl d22b4661fd Rewrite test_queue as unittest. Written for GHOP by Ian Seyer. 2008-02-02 11:39:29 +00:00
Georg Brandl 61fdd71ad4 Rewrite test_socketserver as unittest, written for GHOP by Benjamin Petersen. 2008-02-02 11:05:00 +00:00
Georg Brandl c8088df363 Rewrite test_funcattrs as unittest, written for GHOP by Jeff Wheeler. 2008-02-02 10:18:15 +00:00
Georg Brandl 4854552f02 Rewrite test_descr as unittest, written for GHOP by Jeff Wheeler. 2008-02-02 10:12:36 +00:00
Marc-André Lemburg 1aa8a696f5 Bump distutils version number to match Python version. 2008-02-01 22:58:17 +00:00
Raymond Hettinger 4cab8ece0a Test round-trip on float.as_integer_ratio() and float.__truediv__(). 2008-02-01 22:42:59 +00:00
Raymond Hettinger 04c96d52a4 Issue #1996: float.as_integer_ratio() should return fraction in lowest terms. 2008-02-01 21:30:23 +00:00
Jeffrey Yasskin dc2964b0d8 Roll back r60248. It's useful to encourage users not to change Rational
instances.
2008-02-01 07:05:46 +00:00
Jeffrey Yasskin ca2b69f765 Move __builtins__.trunc() to math.trunc() per
http://mail.python.org/pipermail/python-dev/2008-January/076626.html and issue
1965.
2008-02-01 06:22:46 +00:00
Mark Dickinson 105be7725b Issue #1678380. Fix a bug that identifies 0j and -0j when they appear
in the same code unit. The fix is essentially the same as the fix for a
previous bug identifying 0. and -0.
2008-01-31 22:17:37 +00:00
Raymond Hettinger 2df20a3e08 Minor wordsmithing on docstring 2008-01-31 22:07:16 +00:00
Jeffrey Yasskin 38db364076 Remove unused to-be-magic methods from Rational per issue 1968. Do not port
this patch to py3k.
2008-01-31 17:45:59 +00:00
Jeffrey Yasskin b23dea6adb Added more documentation on how mixed-mode arithmetic should be implemented. I
also noticed and fixed a bug in Rational's forward operators (they were
claiming all instances of numbers.Rational instead of just the concrete types).
2008-01-31 07:44:11 +00:00
Raymond Hettinger e973c61238 Missing return 2008-01-31 01:42:11 +00:00
Raymond Hettinger e67420d72e Fix defect in __ixor__ which would get the wrong
answer if the input iterable had a duplicate element
(two calls to toggle() reverse each other).  Borrow
the correct code from sets.py.
2008-01-31 01:38:15 +00:00
Raymond Hettinger 7d518f418b MutableSets support a remove() method. 2008-01-30 00:08:31 +00:00
Raymond Hettinger abf3fcf39f Add isdisjoint() to the Set/MutableSet ABCs. 2008-01-30 00:01:07 +00:00
Thomas Heller 99120c4f7e Revert rev. 59925, it breaks comtypes (I need to further examine this). 2008-01-28 08:44:13 +00:00
Christian Heimes 908caac52e Added clear cache methods to clear the internal type lookup cache for ref leak test runs. 2008-01-27 23:34:59 +00:00
Jeffrey Yasskin 3ea7b41b58 Moved Rational._binary_float_to_ratio() to float.as_integer_ratio() because
it's useful outside of rational numbers.

This is my first C code that had to do anything significant. Please be more
careful when looking over it.
2008-01-27 23:08:46 +00:00
Neal Norwitz cf25eb14af socket.error doesn't have a headers attribute like ProtocolError.
Handle that situation where we catch socket.errors.
2008-01-27 20:03:13 +00:00
Christian Heimes 5b25bc0598 Change isbasestring function as discussed on the cvs list a while ago 2008-01-27 19:01:45 +00:00
Neal Norwitz ed444e52da Try to handle socket.errors properly in is_unavailable 2008-01-27 18:19:04 +00:00
Georg Brandl ce8fd9d2bc Remove effectless expression statement. 2008-01-27 18:14:43 +00:00
Neal Norwitz c5198090f3 Update the comment and remove the close. If we close we can't flush anymore.
We might still need to close after the for loop if flushing 6! times still
doesn't cause the signal/exception.
2008-01-27 18:09:48 +00:00
Neal Norwitz 41ada16cb7 Print periodic "still working" messages since this suite is slow. 2008-01-27 17:13:07 +00:00
Neal Norwitz 183c5346fe Catch socket errors that are often the cause of transient failures.
Many of these exceptions are due to resource unavailable, so the
existing code should be able to handle many more spurious errors.
2008-01-27 17:11:11 +00:00
Neal Norwitz 9846de1dfb Retry connection in case it fails to reduce flakiness 2008-01-27 17:10:58 +00:00
Neal Norwitz 041ee5d373 Add a tiny sleep and additional flush to force the file to really be synced. 2008-01-27 17:10:50 +00:00
Raymond Hettinger 63c77b6175 Docstring nit 2008-01-27 10:13:57 +00:00
Jeffrey Yasskin 3e1a373616 Make rational.gcd() public and allow Rational to take decimal strings, per
Raymond's advice.
2008-01-27 05:40:35 +00:00
Neal Norwitz 46c61b2c1d Try to prevent this test from being flaky. We might need a sleep in here
which isn't as bad as it sounds.  The close() *should* raise an exception,
so if it didn't we should give more time to sync and really raise it.

Will backport.
2008-01-27 05:02:34 +00:00
Neal Norwitz 6e070814b2 Eliminate the sleeps that assume the server will start in .5 seconds.
This should make the test less flaky.  It also speeds up the test
by about 75% on my box (20+ seconds -> ~4 seconds).
2008-01-27 01:44:05 +00:00
Neal Norwitz 3d785e2c6a Consistently use tempfile.tempdir for the db_home directory. 2008-01-26 23:14:17 +00:00
Neal Norwitz 7f47d93f52 On some systems (e.g., Ubuntu on hppa) the flush()
doesn't cause the exception, but the close() does.

Will backport.
2008-01-26 23:13:46 +00:00
Neal Norwitz 37184295dc Reduce the race condition by signalling when the server is ready
and not trying to connect before.
2008-01-26 21:21:59 +00:00
Neal Norwitz a121508fac Always try to remove the test file even if close raises an exception 2008-01-26 21:02:45 +00:00
Christian Heimes a2af21262a Unit test fix from Giampaolo Rodola, #1938 2008-01-26 16:43:35 +00:00
Georg Brandl 0cdf9a36ec #1473257: add generator.gi_code attribute that refers to
the original code object backing the generator. Patch by Collin Winter.
2008-01-26 14:14:20 +00:00
Georg Brandl 422319937e Add missing things in re docstring. 2008-01-26 11:00:18 +00:00
Neal Norwitz 08b50eb3d3 The OS X buildbot had errors with the unavailable exceptions disabled. Restore it. 2008-01-26 08:26:00 +00:00
Neal Norwitz 960efe9c2d Fix exception in tearDown on ppc buildbot. If there's no directory,
that shouldn't cause the test to fail.  Just like it setUp.
2008-01-26 07:38:03 +00:00
Neal Norwitz 653272f0cf Use a condition variable (threading.Event) rather than sleeps and checking a
global to determine when the server is ready to be used.  This slows the test
down, but should make it correct.  There was a race condition before where the
server could have assigned a port, yet it wasn't ready to serve requests.  If
the client sent a request before the server was completely ready, it would get
an exception.  There was machinery to try to handle this condition.  All of
that should be unnecessary and removed if this change works.  A NOTE was
added as a comment about what needs to be fixed.

The buildbots will tell us if there are more errors or
if this test is now stable.
2008-01-26 07:26:12 +00:00
Neal Norwitz 5be3067742 Prevent this test from failing if there are transient network problems
by retrying the host for up to 3 times.
2008-01-26 05:54:48 +00:00
Raymond Hettinger 3dbd4c536d Changes 54857 and 54840 broke code and were reverted in Py2.5 just before
it was released, but that reversion never made it to the Py2.6 head.
2008-01-25 19:24:46 +00:00
Neal Norwitz 769d0eefd7 Make the test more robust by trying to reconnect up to 3 times
in case there were transient failures.  This will hopefully silence
the buildbots for this test.  As we find other tests that have a problem,
we can fix with a similar strategy assuming it is successful.  It worked
on my box in a loop for 10+ runs where it would have an exception otherwise.
2008-01-25 06:37:23 +00:00
Raymond Hettinger 9ec7bc36fe More design notes 2008-01-25 01:46:33 +00:00
Raymond Hettinger 9c6d81f5dd Fix-up signature for approximation. 2008-01-25 01:23:38 +00:00
Raymond Hettinger 7ea82253ea Add one other review comment. 2008-01-25 01:13:12 +00:00
Raymond Hettinger 921cb5d3a3 Mark todos and review comments. 2008-01-25 00:33:45 +00:00
Raymond Hettinger a6216749fb Add support for copy, deepcopy, and pickle. 2008-01-25 00:21:54 +00:00
Raymond Hettinger 909e334e8a More code cleanup. Remove unnecessary indirection to useless class methods. 2008-01-24 23:50:26 +00:00
Amaury Forgeot d'Arc 16570f59ca #1920: when considering a block starting by "while 0", the compiler optimized the
whole construct away, even when an 'else' clause is present::

    while 0:
        print("no")
    else:
        print("yes")

did not generate any code at all.

Now the compiler emits the 'else' block, like it already does for 'if' statements.

Will backport.
2008-01-24 22:51:18 +00:00
Raymond Hettinger 5310b69419 Shorter pprint's for empty sets and frozensets. Fix indentation of frozensets. Add tests including two complex data structures. 2008-01-24 21:47:56 +00:00
Raymond Hettinger 6170874f9c Expand tests to include nested graph structures. 2008-01-24 21:23:58 +00:00
Raymond Hettinger 5b0e27e50d Add support for int(r) just like the other numeric classes. 2008-01-24 19:30:19 +00:00
Thomas Heller 5ca924038d Invert the checks in get_[u]long and get_[u]longlong. The intent was
to not accept float types; the result was that integer-like objects
were not accepted.

Ported from release25-maint.
2008-01-24 19:15:02 +00:00
Raymond Hettinger 5a05364049 Add support for trunc(). 2008-01-24 19:05:29 +00:00
Raymond Hettinger 70ec29d0f4 Revert 60189 and restore performance. 2008-01-24 18:12:23 +00:00
Raymond Hettinger 7a6eacd2ca Clean-up and speed-up code by accessing numerator/denominator directly. There's no reason to enforce readonliness 2008-01-24 18:05:54 +00:00
Guido van Rossum 37edeab778 Fix test67.py from issue #1303614. 2008-01-24 17:58:05 +00:00
Guido van Rossum 4e3f12486f Fi debug turd -- a call accidentally left out. 2008-01-24 15:53:22 +00:00
Vinay Sajip 92aa2f8d6b Added optional delay argument to FileHandler and subclasses. 2008-01-24 12:37:33 +00:00
Vinay Sajip 97ef165a1d Added optional delay argument to FileHandler and subclasses. 2008-01-24 12:37:08 +00:00
Gregory P. Smith 7b7ce7854c Fix issue1789: The tutorial contained a misuse of the struct module.
(also remove an unneeded import struct from test_largefile)
2008-01-24 09:38:26 +00:00