Commit Graph

13044 Commits

Author SHA1 Message Date
Christian Heimes 728bee897f 15 -> 16 2008-03-03 20:30:29 +00:00
Christian Heimes 608c1d8e87 Since abc._Abstract was replaces by a new type flags the regression test suite fails. I've added a new function inspect.isabstract(). Is the mmethod fine or should I check if object is a instance of type or subclass of object, too? 2008-03-03 18:28:04 +00:00
Brett Cannon 7dbd91811d Add test_main() functions to various tests where it was simple to do. Done so
that regrtest can execute the test_main() directly instead of relying on import
side-effects.
2008-03-03 04:19:29 +00:00
Brett Cannon 963c80fd45 Add a note in the main test class' docstring that the order of execution of the
tests is important.
2008-03-03 03:26:43 +00:00
Brett Cannon bfbf5b3715 Add a note in the main test class' docstring that the order of execution of the
tests is important.
2008-03-03 03:24:48 +00:00
Brett Cannon 6382ffc892 Move test_largefile over to using 'with' statements for open files.
Also rename the driver function to test_main() instead of main_test().
2008-03-03 02:41:40 +00:00
Brett Cannon 56c4debe0d Refactor test_logging to use unittest. This should finally solve the flakiness
issues.

Thanks to Antoine Pitrou for the patch.
2008-03-03 00:38:58 +00:00
Gregory P. Smith 492e2bfefa Modify import of test_support so that the code can also be used with a
stand alone distribution of bsddb that includes its own small copy of
test_support for the needed functionality on older pythons.
2008-03-02 20:00:53 +00:00
Gerhard Häring f40f6846e3 Made sqlite3 module's regression tests work with SQLite versions that don't
support "create table if not exists", yet.
2008-03-02 13:08:03 +00:00
Barry Warsaw 9d225e63be Give IDLE a release date 2008-03-01 03:00:52 +00:00
Barry Warsaw c853f5d4dc bump idle version number 2008-03-01 02:26:42 +00:00
Gerhard Häring 1cc60ed214 Updated to pysqlite 2.4.1. Documentation additions will come later. 2008-02-29 22:08:41 +00:00
Mark Dickinson f4da77765f Fix docstring typo. 2008-02-29 03:29:17 +00:00
Raymond Hettinger 08ff6822cc Handle the repeat keyword argument for itertools.product(). 2008-02-29 02:21:48 +00:00
Mark Dickinson 1ddf1d8482 Add __format__ method to Decimal, to support PEP 3101 2008-02-29 02:16:37 +00:00
Raymond Hettinger b4cbc98c39 Add alternate constructor for itertools.chain(). 2008-02-28 22:46:41 +00:00
Raymond Hettinger 05bf6338b8 Have itertools.chain() consume its inputs lazily instead of building a tuple of iterators at the outset. 2008-02-28 22:30:42 +00:00
Christian Heimes acfd8ed0cd Windows fix for signal test - skip it earlier 2008-02-28 21:00:45 +00:00
Jeffrey Yasskin 392c159ad6 Prevent SocketServer.ForkingMixIn from waiting on child processes that it
didn't create, in most cases. When there are max_children handlers running, it
will still wait for any child process, not just handler processes.
2008-02-28 18:03:15 +00:00
Andrew M. Kuchling a6298528e1 #2169: make generated HTML more valid 2008-02-28 14:03:03 +00:00
Jeffrey Yasskin 69e1309fd4 Thread.start() used sleep(0.000001) to make sure it didn't return before the
new thread had started. At least on my MacBook Pro, that wound up sleeping for
a full 10ms (probably 1 jiffy). By using an Event instead, we can be absolutely
certain that the thread has started, and return more quickly (217us).

Before:
$  ./python.exe -m timeit -s 'from threading import Thread'  't = Thread(); t.start(); t.join()'
100 loops, best of 3: 10.3 msec per loop
$  ./python.exe -m timeit -s 'from threading import Thread; t = Thread()'  't.isAlive()'
1000000 loops, best of 3: 0.47 usec per loop

After:
$  ./python.exe -m timeit -s 'from threading import Thread'  't = Thread(); t.start(); t.join()'
1000 loops, best of 3: 217 usec per loop
$  ./python.exe -m timeit -s 'from threading import Thread; t = Thread()'  't.isAlive()'
1000000 loops, best of 3: 0.86 usec per loop

To be fair, the 10ms isn't CPU time, and other threads including the spawned
one get to run during it. There are also some slightly more complicated ways to
get back the .4us in isAlive() if we want.
2008-02-28 06:09:19 +00:00
Jeffrey Yasskin 180997b2bb Speed test_socketserver up from 28.739s to 0.226s, simplify the logic, and make
sure all tests run even if some fail.
2008-02-28 05:53:18 +00:00
Jeffrey Yasskin 960b9b7a2f Move abc._Abstract into object by adding a new flag Py_TPFLAGS_IS_ABSTRACT,
which forbids constructing types that have it set. The effect is to speed

  ./python.exe -m timeit -s 'import abc' -s 'class Foo(object): __metaclass__ = abc.ABCMeta' 'Foo()'

up from 2.5us to 0.201us. This fixes issue 1762.
2008-02-28 04:45:36 +00:00
Raymond Hettinger 2ab0552b5e Larger test range 2008-02-27 01:08:30 +00:00
Raymond Hettinger 93e804da9c Add itertools.combinations(). 2008-02-26 23:40:50 +00:00
Christian Heimes ea837931cf Patch #1691070 from Roger Upole: Speed up PyArg_ParseTupleAndKeywords() and improve error msg
My tests don't show the promised speed up of 10%. The code is as fast as the old code for simple cases and slightly faster for complex cases with several of args and kwargs. But the patch simplifies the code, too.
2008-02-26 17:23:51 +00:00
Neal Norwitz ca37661a69 Add a timing flag to Trace so you can see where slowness occurs
like waiting for socket timeouts in test_smtplib :-).
2008-02-26 08:21:28 +00:00
Neal Norwitz 75992edfae Speed up this test by about 99%. Remove sleeps and replace with events.
(This may fail on some slow platforms, but we can fix those cases which
should be relatively isolated and easier to find now.)
Move two test cases that didn't require a server to be started
to a separate TestCase.  These tests were taking 3 seconds which
is what the timeout was set to.
2008-02-26 08:04:59 +00:00
Neal Norwitz b0917c14f2 Don't use a hard coded port. This test could hang/fail if the port is in use.
Speed this test up by avoiding a sleep and using the event.
2008-02-26 04:50:37 +00:00
Raymond Hettinger 39df66179f Revert part of r60927 which made invalid assumptions about the API offered by db modules. 2008-02-25 23:17:41 +00:00
Raymond Hettinger 9d63837e9b Make sure the itertools filter functions give the same performance for func=bool as func=None. 2008-02-25 22:42:32 +00:00
Facundo Batista 4219da4bd0 Issue 2117. Update compiler module to handle class decorators.
Thanks Thomas Herve
2008-02-25 18:06:00 +00:00
Andrew M. Kuchling 734451a4bc Use file descriptor for real stdout 2008-02-25 16:29:58 +00:00
Andrew M. Kuchling aa5e3cea7a Move .setupterm() output so that we don't try to call endwin() if it fails 2008-02-25 16:29:19 +00:00
Brett Cannon c6b5200931 Fix a minor typo in a docstring. 2008-02-25 05:33:33 +00:00
Neal Norwitz 6057b2e645 Create a db_home directory with a unique name so multiple users can
run the test simultaneously.  The simplest thing I found that worked
on both Windows and Unix was to use the PID.  It's unique so should be
sufficient.  This should prevent many of the spurious failures of
the automated tests since they run as different users.

Also cleanup the directory consistenly in the tearDown methods.

It would be nice if someone ensured that the directories are always
created with a consistent name.
2008-02-24 18:47:03 +00:00
Mark Dickinson 6a123cb782 Remove duplicate 'import re' in decimal.py 2008-02-24 18:12:36 +00:00
Facundo Batista c11cecf3d0 Issue 1742669. Now %d accepts very big float numbers.
Thanks Gabriel Genellina.
2008-02-24 03:17:21 +00:00
Georg Brandl 8c460d5241 #1627: httplib now ignores negative Content-Length headers. 2008-02-24 00:14:24 +00:00
Georg Brandl 2363503074 #900744: If an invalid chunked-encoding header is sent by a server,
httplib will now raise IncompleteRead and close the connection instead
of raising ValueError.
2008-02-24 00:03:22 +00:00
Georg Brandl ebcfd11c16 #1506171: added operator.methodcaller(). 2008-02-23 23:04:35 +00:00
Georg Brandl e2065c65d3 #1826: allow dotted attribute paths in operator.attrgetter. 2008-02-23 23:02:23 +00:00
Facundo Batista c12b9888f7 Added simple test case. Thanks Benjamin Peterson. 2008-02-23 22:54:12 +00:00
Georg Brandl 0bb8567e1e In test_heapq and test_bisect, test both the Python and the C implementation.
Originally written for GHOP by Josip Dzolonga, heavily patched by me.
2008-02-23 22:35:33 +00:00
Georg Brandl 8d01bb2b19 Use os.closerange() in popen2. 2008-02-23 22:09:24 +00:00
Jeffrey Yasskin a885c1521a Followup to r61011: Also avoid the reference cycle when the Thread's target
raises an exception.
2008-02-23 20:40:35 +00:00
Jeffrey Yasskin 3414ea9ed9 Prevent classes like:
class RunSelfFunction(object):
        def __init__(self):
            self.thread = threading.Thread(target=self._run)
            self.thread.start()
        def _run(self):
            pass
from creating a permanent cycle between the object and the thread by having the
Thread delete its references to the object when it completes.

As an example of the effect of this bug, paramiko.Transport inherits from
Thread to avoid it.
2008-02-23 19:40:54 +00:00
Andrew M. Kuchling 1beea27299 #1389051, #1092502: fix excessively large allocations when using read() on a socket 2008-02-23 19:28:58 +00:00
Andrew M. Kuchling 1219a80989 #1389051: IMAP module tries to read entire message in one chunk. Patch by Fredrik Lundh. 2008-02-23 19:02:33 +00:00
Christian Heimes c5f05e45cf Patch #2167 from calvin: Remove unused imports 2008-02-23 17:40:11 +00:00
Andrew M. Kuchling 19aff0c90a #1433694: minidom's .normalize() failed to set .nextSibling for last element.
Fix by Malte Helmert
2008-02-23 17:10:46 +00:00
Andrew M. Kuchling 085f75a851 #1330538: Improve comparison of xmlrpclib.DateTime and datetime instances.
Remove automatic handling of datetime.date and datetime.time.
This breaks backward compatibility, but python-dev discussion was strongly
against this automatic conversion; see the bug for a link.
2008-02-23 16:23:05 +00:00
Andrew M. Kuchling 322349e31b #1119331: ncurses will just call exit() if the terminal name isn't found.
Call setupterm() first so that we get a Python exception instead of just existing.
2008-02-23 15:49:35 +00:00
Georg Brandl ad61bc8d9b #2067: file.__exit__() now calls subclasses' close() method. 2008-02-23 15:11:18 +00:00
Facundo Batista 7e251e83d5 Issue 1089358. Adds the siginterrupt() function, that is just a
wrapper around the system call with the same name.  Also added
test cases, doc changes and NEWS entry. Thanks Jason and Ralf
Schmitt.
2008-02-23 15:07:35 +00:00
Georg Brandl 57826cf9f8 #2165: fix test_logging failure on some machines. 2008-02-23 15:06:25 +00:00
Georg Brandl 1647923bbf #1492: allow overriding BaseHTTPServer's content type for error messages. 2008-02-23 15:02:28 +00:00
Christian Heimes 5224d28d38 Patch #1759: Backport of PEP 3129 class decorators
with some help from Georg
2008-02-23 15:01:05 +00:00
Facundo Batista b12f0b581a Issue 1781. Now ConfigParser.add_section does not let you add a
DEFAULT section any more, because it duplicated sections with
the rest of the machinery. Thanks Tim Lesher and Manuel Kaufmann.
2008-02-23 12:46:10 +00:00
Facundo Batista 1660933d23 Issue 1776581. Minor corrections to smtplib, and two small tests.
Thanks Alan McIntyre.
2008-02-23 12:27:17 +00:00
Facundo Batista fc2d01032f Issue 1881. Increased the stack limit from 500 to 1500. Also added
a test for this (and because of this test you'll see in stderr a
message that parser.c sends before raising MemoryError).
Thanks Ralf Schmitt.
2008-02-23 12:01:13 +00:00
Eric Smith a73fbe791d Added future_builtins, which contains PEP 3127 compatible versions of hex() and oct(). 2008-02-23 03:09:44 +00:00
Raymond Hettinger 73d7963242 Improve the implementation of itertools.product()
* Fix-up issues pointed-out by Neal Norwitz.
* Add extensive comments.
* The lz->result variable is now a tuple instead of a list.
* Use fast macro getitem/setitem calls so most code is in-line.
* Re-use the result tuple if available (modify in-place instead of copy).
2008-02-23 02:20:41 +00:00
Eric Smith fb0742fe4f Tests for bin() builtin. These need to get merged into py3k, which has no tests for bin. 2008-02-22 17:43:17 +00:00
Nick Coghlan a14a4e8b84 Try to make command line error messages from runpy easier to understand (and suppress traceback cruft from the implicitly invoked runpy machinery) 2008-02-22 10:54:06 +00:00
Raymond Hettinger 50986cc45b First draft for itertools.product(). Docs and other updates forthcoming. 2008-02-22 03:16:42 +00:00
Eric Smith ce584d420d Moved test_format into the correct TestCase. 2008-02-21 20:17:08 +00:00
Raymond Hettinger 31ce5cb989 Update more instances of has_key(). 2008-02-21 19:24:53 +00:00
Thomas Heller 8982cf5484 Replace 'has_key()' with 'in'.
Replace 'raise Error, stuff' with 'raise Error(stuff)'.
2008-02-21 18:52:20 +00:00
Guido van Rossum 8bc0965adf Removed uses of dict.has_key() from distutils, and uses of
callable() from copy_reg.py, so the interpreter now starts up
without warnings when '-3' is given.  More work like this needs to
be done in the rest of the stdlib.
2008-02-21 18:18:37 +00:00
Andrew M. Kuchling 2d6c13e733 Close manifest file.
This change doesn't make any difference to CPython, but is a necessary fix for Jython.
2008-02-21 14:23:38 +00:00
Eric Smith 7ef40bf9c7 Trim leading zeros from a floating point exponent, per C99. See issue 1600. As far as I know, this only affects Windows. Add float type 'n' to PyOS_ascii_formatd (see PEP 3101 for 'n' description). 2008-02-20 23:34:22 +00:00
Eric Smith bc32fee029 Added code to correct combining str and unicode in ''.format(). Added test case. 2008-02-18 18:02:34 +00:00
Eric Smith d50a5f2845 Temporarily removed float tests. See issue 1600. 2008-02-18 14:25:02 +00:00
Facundo Batista d14600ec94 Issue 1224. Now we support again the double slash in the URL.
Thanks Anthony Lenton.
2008-02-18 12:48:43 +00:00
Facundo Batista 759bfc6207 Issue #1916. Added isgenerator() and isgeneratorfunction() to
inspect.py.  Thanks Javi Mansilla for patch review and
corrections.
2008-02-18 03:43:43 +00:00
Georg Brandl b169eaa917 #2133: fix HTML color spec. 2008-02-17 21:18:55 +00:00
Eric Smith a9f7d62480 Backport of PEP 3101, Advanced String Formatting, from py3k.
Highlights:
 - Adding PyObject_Format.
 - Adding string.Format class.
 - Adding __format__ for str, unicode, int, long, float, datetime.
 - Adding builtin format.
 - Adding ''.format and u''.format.
 - str/unicode fixups for formatters.

The files in Objects/stringlib that implement PEP 3101 (stringdefs.h,
unicodedefs.h, formatter.h, string_format.h) are identical in trunk
and py3k.  Any changes from here on should be made to trunk, and
changes will propogate to py3k).
2008-02-17 19:46:49 +00:00
Facundo Batista e139688d34 Issue 2112. mmap does not raises EnvironmentError no more, but
a subclass of it. Thanks John Lenton.
2008-02-17 18:59:29 +00:00
Brett Cannon f9db8a3a20 Move test_logging over to doctest.
Thanks to Christopher White from GHOP.
2008-02-17 01:59:18 +00:00
Amaury Forgeot d'Arc 632fad3933 Prevent a crash with nested scopes, again caused by calling Py_DECREF when the pointer
is still present in the containing structure.
2008-02-16 20:55:24 +00:00
Raymond Hettinger 71fa93af22 Add __all__ to logging module. 2008-02-16 01:22:54 +00:00
Amaury Forgeot d'Arc 64d6843788 mmap.PROT_READ does not exists on win32;
Skip this test created by r60830.
2008-02-16 00:16:50 +00:00
Amaury Forgeot d'Arc d8bcbf2b2e Re-enable tests, they were failing since gc.collect() clears the various freelists.
They still remain fragile.

For example, a call to assertEqual currently does not make any allocation
(which surprised me at first).
But this can change when gc.collect also deletes the numerous "zombie frames"
attached to each function.
2008-02-15 22:44:20 +00:00
Kurt B. Kaiser f05fa33a6c Configured selection highlighting colors were ignored; updating highlighting
in the config dialog would cause non-Python files to be colored as if they
were Python source; improve use of ColorDelagator.  Patch 1334. Tal Einat.
2008-02-15 22:25:09 +00:00
Kurt B. Kaiser e312cfddd3 ScriptBinding event handlers weren't returning 'break'. Patch 2050, Tal Einat. 2008-02-15 21:56:36 +00:00
Amaury Forgeot d'Arc f67abccf64 Temporarily let these tests pass 2008-02-15 21:27:44 +00:00
Amaury Forgeot d'Arc 60d6c7f0cc Issue #2115: __slot__ attributes setting was 10x slower.
Also correct a possible crash using ABCs.

This change is exactly the same as an optimisation
done 5 years ago, but on slot *access*:
http://svn.python.org/view?view=rev&rev=28297
2008-02-15 21:22:45 +00:00
Christian Heimes 7adfad850a Bug #2111: mmap segfaults when trying to write a block opened with PROT_READ
Thanks to Thomas Herve for the fix.
2008-02-15 08:20:11 +00:00
Christian Heimes 2f0da53d28 Fixed repr() and str() of complex numbers. Complex suffered from the same problem as floats but I forgot to test and fix them. 2008-02-15 06:57:08 +00:00
Raymond Hettinger 36316e37d5 No need to register subclass of ABCs. 2008-02-14 19:30:30 +00:00
Raymond Hettinger 1b5632445b Add diagnostic message to help figure-out why SocketServer tests occasionally crash
when trying to remove a pid that in not in the activechildren list.
2008-02-14 09:32:45 +00:00
Jeffrey Yasskin 339f5e3ffc Change simple instances (in Fraction) of self.numerator and self.denominator to
self._numerator and self._denominator. This speeds abs() up from 12.2us to
10.8us and trunc() from 2.07us to 1.11us. This doesn't change _add and friends
because they're more complicated.
2008-02-14 07:49:25 +00:00
Jeffrey Yasskin 1c214d6c94 Performance optimizations on Fraction's constructor.
./python.exe -m timeit -s 'from fractions import Fraction' 'Fraction(3)`
31.7 usec/loop -> 9.2 usec/loop

  ./python.exe -m timeit -s 'from fractions import Fraction' 'Fraction(3, 2)'`
27.7 usec/loop -> 9.32 usec/loop

  ./python.exe -m timeit -s 'from fractions import Fraction; f = Fraction(3, 2)' 'Fraction(f)'
31.9 usec/loop -> 14.3 usec/loop
2008-02-14 06:12:24 +00:00
Raymond Hettinger abe3237187 Fix decimal repr which should have used single quotes like other reprs. 2008-02-14 02:41:22 +00:00
Raymond Hettinger ddb164a651 Update notes on Decimal. 2008-02-14 01:08:02 +00:00
Kurt B. Kaiser ac45aff2f1 Bring NEWS.txt up to date from check-in msgs. 2008-02-14 00:08:55 +00:00
Thomas Heller 4516451aec Make the test somewhat clearer (I hope). 2008-02-13 20:36:51 +00:00
Thomas Heller a06a1a88ee Add pickle support to ctypes types. 2008-02-13 20:21:53 +00:00
Jeffrey Yasskin 57bd60b465 Working on issue #1762: Brought
./python.exe -m timeit -s 'from fractions import Fraction; f = Fraction(3, 2)' 'isinstance(3, Fraction); isinstance(f, Fraction)'
from 12.3 usec/loop to 3.44 usec/loop and
  ./python.exe -m timeit -s 'from fractions import Fraction' 'Fraction(3, 2)'
from 48.8 usec to 23.6 usec by avoiding genexps and sets in __instancecheck__
and inlining the common case from __subclasscheck__.
2008-02-13 17:58:04 +00:00
Mark Dickinson 5f8bd3729e Replace R=fractions.Fraction with F=fractions.Fraction in
test_fractions.py.  This should have been part of the name
change from Rational to Fraction.
2008-02-12 21:46:54 +00:00
Mark Dickinson 0aa52a1658 Revert change in r60712: turn alternate constructors back into
classmethods instead of staticmethods.
2008-02-12 21:40:53 +00:00
Mark Dickinson e1b824793a Implementation of Fraction.limit_denominator.
Remove Fraction.to_continued_fraction and
Fraction.from_continued_fraction
2008-02-12 21:31:59 +00:00
Martin v. Löwis dad88dc159 Patch #1966: Break infinite loop in httplib when the servers
implements the chunked encoding incorrectly.
Will backport to 2.5.
2008-02-12 18:47:34 +00:00
Kurt B. Kaiser 8d365c323f what??! Correct r60225. 2008-02-12 15:45:50 +00:00
Raymond Hettinger 116f72fa5c Bring decimal a bit closer to the spec for Reals. 2008-02-12 01:18:03 +00:00
Raymond Hettinger 19a5c29d27 Fix typo in comments 2008-02-12 00:48:20 +00:00
Raymond Hettinger 48688d8c8e Add notes on how decimal fits into the model. 2008-02-11 22:53:01 +00:00
Raymond Hettinger 21290eacf6 Add tests for pickletools.optimize(). 2008-02-11 20:05:53 +00:00
Lars Gustäbel 6bf51da9d4 Make sure that xstar headers are read correctly. 2008-02-11 19:17:10 +00:00
Raymond Hettinger 31f6bc018b No need to register classes that already inherit from ABCs. 2008-02-11 18:51:08 +00:00
Mark Dickinson cd873fc142 Put an extra space into the repr of a Fraction:
Fraction(1, 2) instead of Fraction(1,2).
2008-02-11 03:11:55 +00:00
Christian Heimes 03d3abf375 The test requires the network resource 2008-02-11 02:26:22 +00:00
Mark Dickinson d058cd2cc8 Rename rational.Rational to fractions.Fraction, to avoid name clash
with numbers.Rational.  See issue #1682 for related discussion.
2008-02-10 21:29:51 +00:00
Raymond Hettinger da614dcc4f Complete an open todo on pickletools -- add a pickle optimizer. 2008-02-10 20:35:16 +00:00
Skip Montanaro a5a9a733c8 whoops - revert 2008-02-10 15:32:16 +00:00
Skip Montanaro c376f20d76 Get the saying right. ;-) 2008-02-10 15:31:54 +00:00
Mark Dickinson 3a94ee05f7 Typos in decimal comment and documentation 2008-02-10 15:19:58 +00:00
Mark Dickinson 74d0914413 Turn classmethods into staticmethods, and avoid calling the constructor
of subclasses of Rational.  (See discussion in issue #1682.)
2008-02-10 14:58:38 +00:00
Nick Coghlan 97fac3eb0a Issue 2021: Allow NamedTemporaryFile and SpooledTemporaryFile to be used as context managers. (The NamedTemporaryFile fix should be considered for backporting to 2.5) 2008-02-09 15:28:09 +00:00
Raymond Hettinger 8c6c12ca96 Temporarily disable this test. It's been broken for a week. 2008-02-09 10:06:20 +00:00
Raymond Hettinger 2cd9bf5e7c Metaclass declaration is inherited 2008-02-09 10:04:19 +00:00
Raymond Hettinger 2e827bfdfe Merge with r60683. 2008-02-09 03:34:52 +00:00
Raymond Hettinger c2bc0d17e8 Make ABC containers inherit as documented. 2008-02-09 01:18:42 +00:00
Raymond Hettinger d53f1c4d41 Fill-in missing Set comparisons 2008-02-08 23:34:21 +00:00
Raymond Hettinger 18a1ffcda3 Speed-up __iter__() mixin method. 2008-02-08 23:02:27 +00:00
Hye-Shik Chang 01612e7dec Update big5hkscs codec to conform to the HKSCS:2004 revision. 2008-02-08 17:10:20 +00:00
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
Neal Norwitz 7070094d7f Fix the test_urllib2net failures that were caused by r58067.
I'm not sure this is the correct fix, but at least the test passes
now and should be closer to correct.
2008-01-24 07:40:51 +00:00
Neal Norwitz bf839e2efa Fix the tests by restoring __import__. I think the test is still valid. 2008-01-24 04:14:50 +00:00
Raymond Hettinger f336c8b7e9 Cleanup 2008-01-24 02:05:06 +00:00
Raymond Hettinger eb461904eb Minor clean-up and more tests. 2008-01-24 02:00:25 +00:00
Raymond Hettinger cf10926088 Add first-cut at an approximation function (still needs rounding tweaks). Add continued fraction conversions. 2008-01-24 00:54:21 +00:00
Guido van Rossum 9acc387bcf Turn three recently fixed crashers into regular tests. 2008-01-23 23:23:43 +00:00
Kurt B. Kaiser f30ba3dd66 There was an error on exit if no sys.exitfunc was defined. Issue 1647. 2008-01-23 22:55:26 +00:00
Kurt B. Kaiser b4aaa76053 Could not open files in .idlerc directory if latter was hidden on Windows.
Issue 1743, Issue 1862.
2008-01-23 22:19:23 +00:00
Guido van Rossum 1d9a9eaa89 Fix two crashers. 2008-01-23 20:19:01 +00:00
Christian Heimes 082c9b0267 Fixed bug #1915: Python compiles with --enable-unicode=no again. However several extension methods and modules do not work without unicode support. 2008-01-23 14:20:50 +00:00
Guido van Rossum 66b4ab701b I'm tired of these tests breaking at Google due to our large number of
users and groups in LDAP/NIS.  So I'm limiting the extra-heavy part of
the tests to passwd/group files with at most 1000 entries.
2008-01-23 01:18:27 +00:00
Raymond Hettinger c226c31139 Let pprint() support sets and frozensets (suggested by David Mertz). 2008-01-23 00:04:40 +00:00
Gregory P. Smith 2230bcfe24 docstring and comment updates suggested by Giampaolo Rodola' 2008-01-22 23:15:34 +00:00
Georg Brandl d02fc48f67 Fix for #1087741 patch. 2008-01-22 19:56:03 +00:00
Gregory P. Smith 95cd5c0b72 - Fix Issue #1703448: A joined thread could show up in the
threading.enumerate() list after the join() for a brief period until
  it actually exited.
2008-01-22 01:20:42 +00:00
Gregory P. Smith 64c5677de4 Replace spam.acquire() try: ... finally: spam.release() with "with spam:" 2008-01-22 01:12:02 +00:00
Gregory P. Smith c64386b595 accepts and closes issue #1221598: adds an optional callback to ftplib.FTP
storbinary() and storlines() methods.
2008-01-22 00:19:41 +00:00
Georg Brandl c09b94e063 Reformat some ugly code. 2008-01-21 21:28:32 +00:00
Georg Brandl 32a3fb5ec9 Patch #1720595: add T_BOOL to the range of structmember types.
Patch by Angelo Mottola, reviewed by MvL, tests by me.
2008-01-21 21:23:15 +00:00
Georg Brandl f00b38e08c Add the correct build dir when building with pydebug. 2008-01-21 21:19:07 +00:00
Georg Brandl f2dae0e14a #1715: include sub-extension modules in pydoc text output. 2008-01-21 21:05:49 +00:00
Walter Dörwald 4a11a06d12 Follow PEP 8 in module docstring. 2008-01-21 20:18:04 +00:00
Georg Brandl 38d1715b0d Issue #1882: when compiling code from a string, encoding cookies in the
second line of code were not always recognized correctly.
2008-01-21 18:35:49 +00:00
Georg Brandl 501601591b #1530959: change distutils build dir for --with-pydebug python builds. 2008-01-21 17:42:40 +00:00
Georg Brandl e42169124f Clarify $ behavior in re docstring. #1631394. 2008-01-21 17:29:23 +00:00
Georg Brandl 1ea8cb49ed #1726198: replace while 1: fp.readline() with file iteration. 2008-01-21 17:22:06 +00:00
Georg Brandl 0751d1ad2a Adapt pydoc to new doc URLs. 2008-01-21 17:13:03 +00:00
Vinay Sajip ae747dccab Fix: #1836: Off-by-one bug in TimedRotatingFileHandler rollover calculation. Patch thanks to Kathryn M. Kowalski. 2008-01-21 17:02:26 +00:00
Georg Brandl 864de8274c #1555501: document plistlib and move it to the general library. 2008-01-21 16:34:07 +00:00
Georg Brandl 66e7363c10 #1269: fix a bug in pstats.add_callers() and add a unit test file for pstats. 2008-01-21 10:24:59 +00:00
Georg Brandl 6f7e2d0a30 #1876: fix typos in test_operator. 2008-01-20 14:31:27 +00:00
Georg Brandl 858493251f Fix test_pyclbr after urllib change. 2008-01-20 14:20:02 +00:00
Georg Brandl 5235398323 #1669: don't allow shutil.rmtree() to be called on a symlink. 2008-01-20 14:17:42 +00:00
Georg Brandl 56112895d6 #1648: add sys.gettrace() and sys.getprofile(). 2008-01-20 13:59:46 +00:00
Georg Brandl d5e6cf2b15 #1664522: in urllib, don't read non-existing directories in ftp mode,
returning a 0-byte file -- raise an IOError instead.
Original patch from Phil Knirsch.
2008-01-20 12:18:17 +00:00
Georg Brandl 2235011d49 #856047: respect the ``no_proxy`` env var when checking for proxies
in urllib and using the other ``_proxy`` env vars.
Original patch by Donovan Baarda.
2008-01-20 12:05:43 +00:00
Georg Brandl 9b0d46db11 #1178141: add addinfourl.code to get http status code from urllib. 2008-01-20 11:43:03 +00:00
Georg Brandl dcd6b52206 #1351692: in pprint, always call format() for dict and list items to enable
custom formatting of contents via subclassing PrettyPrinter.
2008-01-20 11:13:29 +00:00
Gregory P. Smith da407232e0 Document that zipfile decryption is insanely slow and fix a typo and
blatant lie in a docstring (it is not useful for security regardless of
how you spell it).
2008-01-20 01:32:00 +00:00
Gregory P. Smith 0c63fc23c4 Fix zipfile decryption. The check for validity only worked on one
type of encrypted zip files.  Files using extended local headers
needed to compare the check byte against different values.  (according
to reading the infozip unzip crypt.c source code)

Fixes issue1003.
2008-01-20 01:21:03 +00:00
Andrew M. Kuchling 88fbcf82ab Add an interactive test script for exercising curses 2008-01-20 00:12:19 +00:00
Andrew M. Kuchling 4a2762d146 Patch #1048820 from Stefan Wehr: add insert-mode editing to Textbox.
Fix an off-by-one error I noticed.
2008-01-20 00:00:38 +00:00
Gregory P. Smith 350d03b18a Fixes/Accepts Patch for issue1189216 - Work properly with archives
that have file headers past the 2**31 byte boundary.
2008-01-19 23:10:52 +00:00
Gregory P. Smith 70eb2f91b4 Fix issue 1300: Quote command line arguments that contain a '|' character in
subprocess.list2cmdline (windows).
2008-01-19 22:49:37 +00:00
Gregory P. Smith 92ffc634e4 Undo an unnecessary else: and indentation that r60104 added.
try:
  ...
except:
  ...
  raise
else:
  ...

the else: is unecessary due to the blind except: with a raise.
2008-01-19 22:23:56 +00:00
Gregory P. Smith 87d49792b5 Fixes issue1336 - a race condition could occur when forking if the gc
kicked in during the critical section.  solution: disable gc during
that section.  Patch contributed by jpa and updated by me to cover the
race condition still existing what therve from twistedmatrix pointed
out (already seen and fixed in twisted's own subprocess code).
2008-01-19 20:57:59 +00:00
Gregory P. Smith e047e6dd09 fix comment typos, use not arg instead of arg == "", add test coverage
for inside of the final if needquotes: within subprocess.list2cmdline().
2008-01-19 20:49:02 +00:00
Georg Brandl 309501a617 #1663329: add os.closerange() to close a range of fds,
ignoring errors, and use this in subprocess to speed up
subprocess creation in close_fds mode. Patch by Mike Klaas.
2008-01-19 20:22:13 +00:00
Andrew M. Kuchling 15ce880cc8 Bug 1277: make Maildir use the user-provided factory instead of hard-wiring MaildirMessage.
2.5.2 bugfix candidate.
2008-01-19 20:12:04 +00:00
Georg Brandl c6fde7293e Fix #1146: TextWrap vs words 1-character shorter than the width.
Patch by Quentin Gallet-Gilles.
2008-01-19 19:48:19 +00:00
Georg Brandl 14404b68d8 Fix #1679: "0x" was taken as a valid integer literal.
Fixes the tokenizer, tokenize.py and int() to reject this.
Patches by Malte Helmert.
2008-01-19 19:27:05 +00:00
Facundo Batista 873c9857b7 Fix #1693149. Now you can pass several modules separated by
coma to trace.py in the same --ignore-module option.
Thanks Raghuram Devarakonda.
2008-01-19 18:38:19 +00:00
Andrew M. Kuchling 5c60bfcfbf Patch #976880: add mmap .rfind() method, and 'end' paramter to .find().
Contributed by John Lenton.
2008-01-19 18:18:41 +00:00
Christian Heimes 6c29be54a5 Disabled test_xmlrpc:test_404. It's causing lots of false alarms.
I also disabled a test in test_ssl which requires network access to svn.python.org. This fixes a bug Skip has reported a while ago.
2008-01-19 16:39:27 +00:00
Andrew M. Kuchling e45a77adbe Patch #742598 from Michael Pomraning: add .timeout attribute to SocketServer that will call
.handle_timeout() method when no requests are received within the timeout period.
2008-01-19 16:26:13 +00:00
Christian Heimes 95016e71ea Update for threading.local test. 2008-01-19 15:06:09 +00:00
Christian Heimes 71a0451f67 Added unit test to verify that threading.local doesn't cause ref leaks. It seems that the thread local storage always keeps the storage of the last stopped thread alive. Can anybody comment on it, please? 2008-01-19 13:46:06 +00:00
Facundo Batista 2b1b195d39 Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a
just-created (and empty) instance.  Added tests for this. Thanks
Jonathan Share.
2008-01-19 12:32:27 +00:00
Jeffrey Yasskin 45169fbc80 Several tweaks: add construction from strings and .from_decimal(), change
__init__ to __new__ to enforce immutability, and remove "rational." from repr
and the parens from str.
2008-01-19 09:56:06 +00:00
Guido van Rossum bf4c7c8c0d This got fixed for classic classes in r60057,
and backported to 2.5.2 in 60056.
2008-01-18 23:05:40 +00:00
Christian Heimes 288e89acfc Added bytes and b'' as aliases for str and '' 2008-01-18 18:24:07 +00:00
Vinay Sajip a26c73ed55 Added LoggerAdapter class, changed copyright dates, made check for extra parameter passed to logging methods explicitly against None rather than a truth value. 2008-01-18 15:55:57 +00:00
Raymond Hettinger 44bd6c0a4f Issue #1861: Add read-only attribute listing upcoming events in the order they will be run. 2008-01-17 19:31:38 +00:00
Gregory P. Smith bde4ae4bde Fixes (accepts patch) issue1339 - http://bugs.python.org/issue1339
- Factor out the duplication of EHLO/HELO in login() and sendmail() to
  a new function, ehlo_or_helo_if_needed().
- Use ehlo_or_helo_if_needed() in starttls()
- Check for the starttls exception in starttls() in the same way as
  login() checks for the auth extension.
Contributed by Bill Fenner.
2008-01-17 08:35:49 +00:00
Gregory P. Smith 63bfc1d19f Comply with RFC 3207.
Fixes issue 829951 - http://bugs.python.org/issue829951
2008-01-17 07:43:20 +00:00
Raymond Hettinger 473170908e Make starmap() match its pure python definition and accept any itertable input (not just tuples). 2008-01-17 03:02:14 +00:00
Raymond Hettinger 9e1bc982ff Add queues will alternative fetch orders (priority based and stack based). 2008-01-16 23:40:45 +00:00
Thomas Heller 0f75f9847a Use 'g' instead of 'D' as the ctypes typecode for c_longdouble, for
compliance with PEP 3118.
2008-01-16 20:34:37 +00:00
Thomas Heller 415c1e36a9 Raise a TypeError instead of a ValueError when too many initializers
are used in a Structure or Union constructor.
2008-01-16 19:45:51 +00:00
Thomas Heller 02ec289f3e Raise a TypeError if conflicting positional and named arguments are
passed to a Structure or Union constructor.
2008-01-16 19:37:33 +00:00
Thomas Heller 902d30752f Convert the internal ctypes array type cache to a WeakValueDict so
that array types do not live longer than needed.
2008-01-16 19:16:27 +00:00
Andrew M. Kuchling c8acc882a9 Docstring typos 2008-01-16 00:32:03 +00:00
Amaury Forgeot d'Arc ff0f2670ff test_doctest fails since r59984.
Not sure if these are the correct values, but save_stdout has to be set before its usage...
2008-01-15 21:25:11 +00:00
Raymond Hettinger f59e962b49 Refactor if/elif chain for clarity and speed. Remove dependency on subclasses having to implement _empty and _full. 2008-01-15 20:52:42 +00:00
Guido van Rossum cad3724352 Issue #1786 (by myself): pdb should use its own stdin/stdout around an
exec call and when creating a recursive instance.
2008-01-15 17:59:29 +00:00
Jeffrey Yasskin d7b00334f3 Add rational.Rational as an implementation of numbers.Rational with infinite
precision. This has been discussed at http://bugs.python.org/issue1682. It's
useful primarily for teaching, but it also demonstrates how to implement a
member of the numeric tower, including fallbacks for mixed-mode arithmetic.

I expect to write a couple more patches in this area:
 * Rational.from_decimal()
 * Rational.trim/approximate() (maybe with different names)
 * Maybe remove the parentheses from Rational.__str__()
 * Maybe rename one of the Rational classes
 * Maybe make Rational('3/2') work.
2008-01-15 07:46:24 +00:00
Raymond Hettinger cbf8f6cffb Temporarily revert 59967 until GC can be added. 2008-01-15 05:39:59 +00:00
Raymond Hettinger c216df9288 Issue 1820: structseq objects did not work with the % formatting operator or isinstance(t, tuple).
Orignal patch (without tests) by Leif Walsh.
2008-01-15 03:02:37 +00:00
Andrew M. Kuchling 7ce9b18460 Typo fixes 2008-01-15 01:29:16 +00:00
Raymond Hettinger 351e1a3e88 Fix 1698398: Zipfile.printdir() crashed because the format string expected a tuple object of length six instead of a time.struct_time object. 2008-01-14 22:58:05 +00:00
Christian Heimes c94e2b5c12 Now that I've learnt about structseq objects I felt like converting sys.float_info to a structseq. It's
readonly and help(sys.float_info) explains the attributes nicely.
2008-01-14 04:13:37 +00:00
Christian Heimes f31b69f9db Applied patch #1816: sys.flags patch 2008-01-14 03:42:48 +00:00
Christian Heimes 9c2019632b Added new an better structseq representation. E.g. repr(time.gmtime(0)) now returns 'time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)' instead of '(1970, 1, 1, 0, 0, 0, 3, 1, 0)'. The feature is part of #1816: sys.flags 2008-01-14 03:33:52 +00:00
Ka-Ping Yee 9e0f116fac Check in the patch proposed by Ben Hayden (benjhayden) for issue
#1550: help('modules') broken by several 3rd party libraries.

Tested with Python build: trunk:54235:59936M -- the reported error
occurs with Django installed (or with any __init__.py present on
the path that raises an exception), and such errors indeed go away
when this change is applied.
2008-01-13 11:25:13 +00:00
Mark Dickinson 59bc20bb27 Issue 1780: Allow leading and trailing whitespace in Decimal constructor,
when constructing from a string. Disallow trailing newlines in
Context.create_decimal.
2008-01-12 01:56:00 +00:00
Thomas Heller c682614df0 Raise an error instead of crashing with a segfault when a NULL
function pointer is called.

Will backport to release25-maint.
2008-01-11 19:34:06 +00:00
Raymond Hettinger 0f6a656ec1 Speed-up and simplify code urlparse's result objects. 2008-01-11 18:04:55 +00:00
Raymond Hettinger 0ff4dafee0 Improve usability of the SequenceMatcher by returning named tuples describing match ranges. 2008-01-11 03:20:54 +00:00
Raymond Hettinger e896acc98c Let most inspect functions return named tuples 2008-01-11 03:04:50 +00:00
Raymond Hettinger 097a190303 Have Decimal.as_tuple return a named tuple. 2008-01-11 02:24:13 +00:00
Raymond Hettinger fff4e6e171 Doctest results return a named tuple for readability 2008-01-11 01:25:54 +00:00
Raymond Hettinger d1ef85420f Run doctests on the collections module 2008-01-11 00:23:13 +00:00
Raymond Hettinger 15b5e55b48 Neaten-up the named tuple docs 2008-01-10 23:00:01 +00:00
Amaury Forgeot d'Arc d08a8ebf2a Closing issue1761.
Surprising behaviour of the "$" regexp: it matches the
end of the string, AND just before the newline at the end
of the string::

    re.sub('$', '#', 'foo\n') == 'foo#\n#'

Python is consistent with Perl and the pcre library, so
we just document it.
Guido prefers "\Z" to match only the end of the string.
2008-01-10 21:59:42 +00:00
Raymond Hettinger e850c466c7 Clarify how to add a field to a named tuple. 2008-01-10 20:37:12 +00:00
Raymond Hettinger e1655088ca Examples for named tuple subclassing should include __slots__ 2008-01-10 19:15:10 +00:00
Christian Heimes 3403f1589d Fixed #1776. __import__() no longer imports modules by file name 2008-01-09 19:56:33 +00:00
Christian Heimes b39a756afd Added __enter__ and __exit__ functions to HKEY object
Added ExpandEnvironmentStrings to the _winreg module.
2008-01-08 15:46:10 +00:00
Andrew M. Kuchling e0a49b6e05 Patch 1137: allow assigning to .buffer_size attribute of PyExpat.parser objects 2008-01-08 14:30:55 +00:00
Facundo Batista 52b25795c0 Issue #1757: The hash of a Decimal instance is no longer affected
by the current context.  Thanks Mark Dickinson.
2008-01-08 12:25:20 +00:00
Christian Heimes f66f95d419 It's verbose, not debug 2008-01-08 03:40:04 +00:00
Raymond Hettinger 581671419f Expand comment. 2008-01-08 02:02:05 +00:00
Raymond Hettinger f5e8af1bb7 Use get() instead of pop() for the optimized version of _replace(). 2008-01-07 20:56:05 +00:00
Raymond Hettinger 9a359210aa Cleanup named tuple subclassing example. 2008-01-07 20:07:38 +00:00
Christian Heimes 4d7e6702e9 Fixed indention problem that caused the second TIPC test to run on systems without TIPC 2008-01-07 19:58:41 +00:00
Georg Brandl 62416bcf5a #467924, patch by Alan McIntyre: Add ZipFile.extract and ZipFile.extractall. 2008-01-07 18:47:44 +00:00
Christian Heimes fb2d25a154 Issue #1646: Make socket support TIPC. The socket module now has support
for TIPC under Linux, see http://tipc.sf.net/ for more information.
Thanks to Alberto Bertogli for the patch
2008-01-07 16:12:44 +00:00
Raymond Hettinger dc55f35f38 Add another named tuple subclassing example. 2008-01-07 09:03:49 +00:00
Jeffrey Yasskin fd1c24518b Fix issue 1747: allow classic classes to be checked for being subclasses of
ABCs.
2008-01-07 06:09:40 +00:00
Raymond Hettinger 1db6f80cd5 Cleanup subclassing example to more clearly show fixed-width print format. 2008-01-07 05:50:35 +00:00
Raymond Hettinger b8e0072fec Add subclassing example to docs for named tuples. 2008-01-07 04:24:49 +00:00
Raymond Hettinger 844f71b7e4 Speed-up named tuple's _make() constructor. 2008-01-06 22:11:54 +00:00
Georg Brandl e260ba2d33 #1325: Add docs and tests for zipimporter.archive and zipimporter.prefix. 2008-01-06 16:49:50 +00:00
Georg Brandl c45346f57a #1591: Clarify docstring of Popen3. 2008-01-06 14:33:52 +00:00
Georg Brandl 183a084da3 #1742: don't raise exception on os.path.relpath("a", "a"), but return os.curdir.
Reported by Jesse Towner.
2008-01-06 14:27:15 +00:00
Georg Brandl e2a902c669 #1696393: don't check for '.' and '..' in ntpath.walk since
they aren't returned from os.listdir anymore.
Reported by Michael Haggerty.
2008-01-06 14:17:36 +00:00
Raymond Hettinger 1166872006 Small code simplification. Forgot that classmethods can be called from intances. 2008-01-06 09:02:24 +00:00
Guido van Rossum c6a04c2629 Patch #1637: fix urlparse for URLs like 'http://x.com?arg=/foo'.
Fix by John Nagle.
2008-01-05 22:19:06 +00:00
Georg Brandl f725b9587c Doc patch #1730 from Robin Stocker; minor corrections mostly to os.rst. 2008-01-05 19:44:22 +00:00
Andrew M. Kuchling 0589914e60 Fix comment typo 2008-01-05 15:13:49 +00:00
Jeffrey Yasskin 9871d8fe22 Continue rolling back pep-3141 changes that changed behavior from 2.5. This
round included:
 * Revert round to its 2.6 behavior (half away from 0).
 * Because round, floor, and ceil always return float again, it's no
   longer necessary to have them delegate to __xxx___, so I've ripped
   that out of their implementations and the Real ABC. This also helps
   in implementing types that work in both 2.6 and 3.0: you return int
   from the __xxx__ methods, and let it get enabled by the version
   upgrade.
 * Make pow(-1, .5) raise a ValueError again.
2008-01-05 08:47:13 +00:00
Fred Drake f7476c4d46 clean up a comment 2008-01-05 04:38:38 +00:00
Raymond Hettinger 1b50fd7cb3 Add error-checking to namedtuple's _replace() method. 2008-01-05 02:17:24 +00:00