Commit Graph

2522 Commits

Author SHA1 Message Date
Neal Norwitz 419fd49abe Issue 2321: reduce memory usage (increase the memory that is returned
to the system) by using pymalloc for the data of unicode objects.

Will backport.
2008-03-17 20:22:43 +00:00
Eric Smith 0aed07ad80 Added PEP 3127 support to tokenize (with tests); added PEP 3127 to NEWS. 2008-03-17 19:43:40 +00:00
Gregory P. Smith f48f9d38c0 Force zlib.crc32 and zlib.adler32 to return a signed integer on all platforms
regardless of the native sizeof(long) used in the integer object.

This somewhat odd behavior of returning a signed is maintained in 2.x for
compatibility reasons of always returning an integer rather than a long object.

Fixes Issue1202 for Python 2.6
2008-03-17 18:48:05 +00:00
Jeffrey Yasskin 1b4e45bab9 Allow Gnu gcc's to build python on OSX by removing -Wno-long-double,
-no-cpp-precomp, and -mno-fused-madd from configure.
 * r22183 added -no-cpp-precomp, which
   http://gcc.gnu.org/ml/gcc/2005-12/msg00368.html claims hasn't been
   needed since gcc-3.1.
 * r25607 added -Wno-long-double to avoid a warning in
   Include/objimpl.h (issue 525481). The long double is still there,
   but OSX 10.4's gcc no longer warns about it.
 * r33666 fixed issue 775892 on OSX 10.3 by adding -mno-fused-madd,
   which changed the sign of some float 0s. Tim Peters said it wasn't
   a real issue anyway, and it no longer causes test failures.
Fixes issue #1779871.
2008-03-17 14:40:53 +00:00
Neal Norwitz 400aedacc0 Add a warning for code like:
assert (0, 'message')

An empty tuple does not create a warning.  While questionable usage:
  assert (), 'message'

should not display a warning.  Tested manually.
The warning message could be improved.  Feel free to update it.
2008-03-15 22:03:18 +00:00
Skip Montanaro 32ed8c267c . 2008-03-15 16:07:11 +00:00
Mark Dickinson c23b8a7af9 Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
across platforms:  it should now raise OverflowError on all
platforms.  (Previously it raised OverflowError only on
non IEEE 754 platforms.)

Also fix the (already existing) test for this behaviour
so that it actually raises TestFailed instead of just
referencing it.
2008-03-14 14:23:37 +00:00
Martin v. Löwis bf7b0b7b81 Patch #2284: add -x64 option to rt.bat. 2008-03-14 13:56:09 +00:00
Brett Cannon 1f5182b572 Convert test_fcntl to unittest.
Closes issue #2055. Thanks Giampaolo Rodola.
2008-03-13 21:09:28 +00:00
Brett Cannon 4a6e8d669a Move test_gdbm to use unittest.
Closes issue #1960. Thanks Giampaolo Rodola.
2008-03-13 21:02:16 +00:00
Brett Cannon 2e0f9f3dd9 Convert test_contains, test_crypt, and test_select to unittest.
Patch from GHOP 294 by David Marek.
2008-03-13 20:47:41 +00:00
Brett Cannon b8d37359cd Move test_tokenize to doctest.
Done as GHOP 238 by Josip Dzolonga.
2008-03-13 20:33:10 +00:00
Brett Cannon 66865d2ebd Move test_thread over to unittest. Commits GHOP 237.
Thanks Benjamin Peterson for the patch.
2008-03-13 20:27:00 +00:00
Raymond Hettinger 53bdf09343 Issue 2274: Add heapq.heappushpop(). 2008-03-13 19:03:51 +00:00
Facundo Batista c54aec1fda Issue 1106316. post_mortem()'s parameter, traceback, is now
optional: it defaults to the traceback of the exception that is currently
being handled.
2008-03-08 16:50:27 +00:00
Nick Coghlan 7af53be66f Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files) 2008-03-07 14:13:28 +00:00
Jeffrey Yasskin e75f59a578 Progress on issue #1193577 by adding a polling .shutdown() method to
SocketServers. The core of the patch was written by Pedro Werneck, but any bugs
are mine. I've also rearranged the code for timeouts in order to avoid
interfering with the shutdown poll.
2008-03-07 06:22:15 +00:00
Georg Brandl 98aa805b10 Bug #2220: handle rlcompleter attribute match failure more gracefully. 2008-03-06 07:45:52 +00:00
Georg Brandl a7bd27f0a8 #2225: return nonzero status code from py_compile if not all files could be compiled. 2008-03-06 07:41:16 +00:00
Georg Brandl 810ea29b0e Add missing NEWS entry for r61263. 2008-03-06 07:34:52 +00:00
Martin v. Löwis d2bbe526c3 Patch #2232: os.tmpfile might fail on Windows if the user has no
permission to create files in the root directory.
Will backport to 2.5.
2008-03-06 06:55:22 +00:00
Raymond Hettinger 66f91ea966 C implementation of itertools.permutations(). 2008-03-05 20:59:58 +00:00
Thomas Heller f3c0559b5e Issue 1872: Changed the struct module typecode from 't' to '?', for
compatibility with PEP3118.
2008-03-05 15:34:29 +00:00
Thomas Heller 78b8f4458d News entry for yesterdays commit. 2008-03-05 14:53:39 +00:00
Amaury Forgeot d'Arc d21fb4c2e0 Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::

    >>> f(**g(1=2))
    XXX undetected error
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: 'int' object is not iterable

instead of the expected SyntaxError: keyword can't be an expression

Will backport.
2008-03-05 01:50:33 +00:00
Andrew M. Kuchling c6511a851e Typo fix 2008-03-04 01:48:26 +00:00
Andrew M. Kuchling 91ae0c9a70 Typo fix 2008-03-04 00:40:32 +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 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
Gerhard Häring 11ab807fff Added note about update of sqlite3 module. 2008-03-02 13:12:27 +00:00
Barry Warsaw 65475fdba7 Set things up for 2.6a2. 2008-03-01 17:11:41 +00:00
Barry Warsaw 7c07523c80 Add date to NEWS 2008-03-01 02:53:36 +00:00
Fred Drake a8ee94ba1c fix typo 2008-03-01 02:45:07 +00:00
Barry Warsaw 5297361198 Bump to version 2.6a1 2008-03-01 02:23:38 +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 93e804da9c Add itertools.combinations(). 2008-02-26 23:40:50 +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
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
Christian Heimes 4034685a58 Issue #2051 and patch from Alexander Belopolsky:
Permission for pyc and pyo files are inherited from the py file.
2008-02-23 17:52:07 +00:00
Christian Heimes f0476e8169 Patch #1957: syslogmodule: Release GIL when calling syslog(3) 2008-02-23 17:42:31 +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 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 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 c5705a823b Document itertools.product(). 2008-02-22 19:50:06 +00:00
Guido van Rossum af16ece18e Fix a few typos and layout glitches (more work is needed).
Move 2.5 news to Misc/HISTORY.
2008-02-21 19:46:35 +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
Guido van Rossum b5e2684a1a Remove news about float repr() -- issue 1580 is still in limbo. 2008-02-21 17:46:16 +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 5a3c135e17 Added PEP 3101. 2008-02-19 13:21:56 +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
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
Facundo Batista f88a077f69 Now we handle different the backup copy, because of security
issues regarding user/group and permissions. Fixes 1050828.
2008-02-17 16:21:13 +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
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
Christian Heimes 3b718a79af Implemented Martin's suggestion to clear the free lists during the garbage collection of the highest generation. 2008-02-14 12:47:33 +00:00
Thomas Heller a06a1a88ee Add pickle support to ctypes types. 2008-02-13 20:21:53 +00:00
Georg Brandl 0a40ffb1b3 #2063: correct order of utime and stime in os.times()
result on Windows.
2008-02-13 07:20:22 +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
Martin v. Löwis e0d30ef0ca Patch #1736: Fix file name handling of _msi.FCICreate. 2008-02-12 13:47:26 +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
Nick Coghlan ac094dc8a3 Add missing NEWS entry for r60695 2008-02-10 07:32:52 +00:00
Christian Heimes 95d644708e Issue #1706: Require Windows 2000+
Added Py_BUILD_CORE_MODULES macro to set WINVER and NTDDI_VERSION to Windows 2000 for core modules, too
Added -d option to build.bat (same as -c Debug) and fixed warning about /build option
Updated Windows related readme.txt files
2008-02-09 19:55:22 +00:00
Hye-Shik Chang 01612e7dec Update big5hkscs codec to conform to the HKSCS:2004 revision. 2008-02-08 17:10:20 +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
Christian Heimes f75dbef208 Deallocate content of the dict free list on interpreter shutdown 2008-02-08 00:11:31 +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
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
Christian Heimes 5b970ad483 Unified naming convention for free lists and their limits. All free lists
in Object/ are named ``free_list``, the counter ``numfree`` and the upper
limit is a macro ``PyName_MAXFREELIST`` inside an #ifndef block.

The chances should make it easier to adjust Python for platforms with
less memory, e.g. mobile phones.
2008-02-06 13:33:44 +00:00
Christian Heimes 6075a82243 Limit free list of method and builtin function objects to 256 entries each. 2008-02-06 12:44:34 +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
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 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
Amaury Forgeot d'Arc 578a8caf43 Correct quotes in NEWS file 2008-02-04 20:53:14 +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
Amaury Forgeot d'Arc cab3d98ca1 Ensure that PySet_Add() operates on a newly created frozenset, like PyTuple_SetItem does.
Add PyFrozenSet_Check(), which was not needed before; The list of Py*Set_Check* macros seems to be complete now.

Add missing NEWS entries about all this.
2008-02-03 22:51:43 +00:00
Brett Cannon 70c0c02691 Add an entry for r60537. 2008-02-03 09:59:21 +00:00
Gregory P. Smith eeed5b7c22 Merge this fix from the pybsddb tree:
r293 | jcea | 2008-01-31 01:08:19 -0800 (Thu, 31 Jan 2008) | 4 lines

Solved memory leak when using cursors with
databases without environment.
2008-02-03 07:20:53 +00:00
Christian Heimes 951cc0f474 Fixed bug #1983: Return from fork() is pid_t, not int 2008-01-31 23:08:23 +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
Christian Heimes cba36bbe65 Bug #1234: Fixed semaphore errors on AIX 5.2 2008-01-30 22:54:18 +00:00
Christian Heimes 4d4f270941 Patch #1970 by Antoine Pitrou: Speedup unicode whitespace and linebreak detection. The speedup is about 25% for split() (571 / 457 usec) and 35% (175 / 127 usec )for splitlines() 2008-01-30 11:32:37 +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
Georg Brandl 6caad7d2cb Move C API entries to the corresponding section. 2008-01-26 14:19:22 +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 29604a1b4c #1940: make it possible to use curses.filter() before curses.initscr()
as the documentation says.
2008-01-26 14:03:47 +00:00
Christian Heimes 7f39c9fcbb Backport of several functions from Python 3.0 to 2.6 including PyUnicode_FromString, PyUnicode_Format and PyLong_From/AsSsize_t. The functions are partly required for the backport of the bytearray type and _fileio module. They should also make it easier to port C to 3.0.
First chapter of the Python 3.0 io framework back port: _fileio
The next step depends on a working bytearray type which itself depends on a backport of the nwe buffer API.
2008-01-25 12:18:43 +00:00
Amaury Forgeot d'Arc 31eaafef4a News entry for r60265 (Issue 1920). 2008-01-24 22:59:25 +00:00