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