Commit Graph

2999 Commits

Author SHA1 Message Date
Christian Heimes 7d4c3177d5 Silenced compiler warning
Objects/stringlib/find.h:97: warning: 'stringlib_contains_obj' defined but not used
Reviewed by Benjamin Peterson
2008-08-22 19:47:25 +00:00
Christian Heimes fb1813cb8d Changed type of numarenas from uint to size_t to silence a GCC warning on 64bit OSes. Reviewed by Benjamin Peterson. 2008-08-22 19:34:15 +00:00
Mark Dickinson 5c2bb1a7d4 issue 3633: Solaris allows fullwidth Unicode digits in isxdigit, so
rewrite float.fromhex to only allow ASCII hex digits on all platforms.
(Tests for this are already present, but the test_float failures
on Solaris hadn't been noticed before.)

Reviewed by Antoine Pitrou.
2008-08-21 21:38:38 +00:00
Eric Smith e5bdccc77b Backport of r63826.
Optimization of str.format() for cases with str, unicode, int, long,
and float arguments.  This gives about 30% speed improvement for the
simplest (but most common) cases.  This patch skips the __format__
dispatch, and also avoids creating an object to hold the format_spec.

Unfortunately there's a complication in 2.6 with int, long, and float
because they always expect str format_specs.  So in the unicode
version of this optimization, just check for unicode objects.  int,
float, long, and str can be added later, if needed.
2008-08-18 14:27:38 +00:00
Amaury Forgeot d'Arc 313bda12e8 Fix a refleak in bytearray.split and bytearray.rsplit, detected by
regrtest.py -R:: test_bytes
2008-08-17 21:05:18 +00:00
Martin v. Löwis 64034f994c Fix memory leak: Always DECREF obj in PyBuffer_Release. 2008-08-14 20:12:06 +00:00
Martin v. Löwis 241b8345ea Make obj an owned reference in Py_buffer; this checkin
was missing from the patch for #3139.
2008-08-14 15:54:27 +00:00
Martin v. Löwis f91d46a17d Issue #3139: Make buffer-interface thread-safe wrt. PyArg_ParseTuple,
by denying s# to parse objects that have a releasebuffer procedure,
and introducing s*.

More module might need to get converted to use s*.
2008-08-12 14:49:50 +00:00
Nick Coghlan 48361f5cbf Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings. 2008-08-11 15:45:58 +00:00
Georg Brandl 1e13ea94a3 - Issue #3537: Fix an assertion failure when an empty but presized dict
object was stored in the freelist.
2008-08-11 09:07:59 +00:00
Brett Cannon 0563a8ffd1 Change the warning emitted for using the buffer() object; memoryview() in 3.0
is not an equivalent.
2008-08-08 04:15:53 +00:00
Mark Dickinson b646757e01 Issue #1481296: (again!) Make conversion of a float NaN to an int or
long raise ValueError instead of returning 0.  Also, change the error
message for conversion of an infinity to an integer, replacing 'long' by
'integer', so that it's appropriate for both long(float('inf')) and
int(float('inf')).
2008-08-04 21:30:09 +00:00
Antoine Pitrou 92a6240198 Preemptively backport the relevant parts of r65420 2008-08-02 21:58:05 +00:00
Amaury Forgeot d'Arc 06847b13ca Correct a crash when two successive unicode allocations fail with a MemoryError:
the freelist contained half-initialized objects with freed pointers.

The comment
/* XXX UNREF/NEWREF interface should be more symmetrical */
was copied from tupleobject.c, and appears in some other places.
I sign the petition.
2008-07-31 23:39:05 +00:00
Neal Norwitz e7d8be80ba Security patches from Apple: prevent int overflow when allocating memory 2008-07-31 17:17:14 +00:00
Benjamin Peterson c0bf76d3cf backport r64751 2008-07-30 17:45:10 +00:00
Antoine Pitrou 4982d5d04a #2242: utf7 decoding crashes on bogus input on some Windows/MSVC versions 2008-07-25 17:45:59 +00:00
Raymond Hettinger 7f59b5cc03 Convert from long to Py_ssize_t. 2008-07-24 07:04:55 +00:00
Gregory P. Smith 0470bab697 Issue #2620: Overflow checking when allocating or reallocating memory
was not always being done properly in some python types and extension
modules.  PyMem_MALLOC, PyMem_REALLOC, PyMem_NEW and PyMem_RESIZE have
all been updated to perform better checks and places in the code that
would previously leak memory on the error path when such an allocation
failed have been fixed.
2008-07-22 04:46:32 +00:00
Amaury Forgeot d'Arc e4921fec01 Issue2378: pdb would delete free variables when stepping into a class statement.
The problem was introduced by r53954, the correction is to restore the symmetry between
PyFrame_FastToLocals and PyFrame_LocalsToFast
2008-07-21 22:00:38 +00:00
Neal Norwitz c86b54cb03 Fix a couple of names in error messages that were wrong 2008-07-20 19:35:23 +00:00
Eric Smith d6c393ab2b Backed out r65069, pending fixing it in Windows. 2008-07-17 19:49:47 +00:00
Eric Smith 454816d8bd Issue 3382: Make '%F' and float.__format__('F') convert results to upper case. 2008-07-17 17:48:39 +00:00
Georg Brandl 3238a3e329 Backport part of r65043. 2008-07-16 23:17:46 +00:00
Georg Brandl 3e75846cf6 Use _getbytevalue() in init too. 2008-07-16 23:10:05 +00:00
Georg Brandl 3e483f643d #3156: fix consistency in what type bytearray methods accept as items.
Also rename confusing "item" parameters to "index".
2008-07-16 22:57:41 +00:00
Eric Smith 4cb965ca91 Renamed a parameter in calc_number_widths, for consistency with the same parameter in fill_non_digits. 2008-07-16 18:29:51 +00:00
Eric Smith a5fa5a218d Complete issue 3083: add alternate (#) formatting to bin, oct, hex in str.format(). 2008-07-16 00:11:49 +00:00
Mark Dickinson 7103aa42c0 Issue #3008: add instance method float.hex and class method float.fromhex
to convert floats to and from hexadecimal strings respectively.
2008-07-15 19:08:33 +00:00
Nick Coghlan 53663a695e Issue 2235: __hash__ is once again inherited by default, but inheritance can be blocked explicitly so that collections.Hashable remains meaningful 2008-07-15 14:27:37 +00:00
Eric Smith d0c841243c Added '#' formatting to integers. This adds the 0b, 0o, or 0x prefix for bin, oct, hex. There's still one failing case, and I need to finish the docs. I hope to finish those today. 2008-07-15 10:10:07 +00:00
Robert Schuppenies 9be2ec109b Added additional __sizeof__ implementations and addressed comments made in
Issue3122.
2008-07-10 15:24:04 +00:00
Nick Coghlan 524b7773cc Issue 2517: Allow unicode messages in Exceptions again by correctly bypassing the instance dictionary when looking up __unicode__ on new-style classes 2008-07-08 14:08:04 +00:00
Skip Montanaro 2c7ca9bb11 Correct grammar. 2008-07-07 11:16:14 +00:00
Gregory P. Smith 2fe77060eb - Issue #2862: Make int and float freelist management consistent with other
freelists.  Changes their CompactFreeList apis into ClearFreeList apis and
  calls them via gc.collect().
2008-07-06 03:35:58 +00:00
Mark Dickinson bf9f4d8015 Issue 3188: accept float('infinity') as well as float('inf'). This
makes the float constructor behave in the same way as specified
by various other language standards, including C99, IEEE 754r,
and the IBM Decimal standard.
2008-07-05 11:33:52 +00:00
Raymond Hettinger a27474c345 Issue 3230: Do not the set specific size macro. 2008-06-28 22:16:53 +00:00
Robert Schuppenies 161b92103c Corrected inconsistencies in sizeof tests and addressed issue pointed
out by Jean Brouwers.
2008-06-26 15:20:35 +00:00
Raymond Hettinger 9c437af4eb Revert 64424, 64438, and 64439. 2008-06-24 22:46:07 +00:00
Eric Smith 5dce7e9a83 Fixed formatting with thousands separator and padding. Resolves issue 3140. 2008-06-24 11:11:59 +00:00
Eric Smith 9ea1e36957 Typo in comment. 2008-06-24 06:05:30 +00:00
Eric Smith 65fe47b931 Modified interface to _Py_[String|Unicode]InsertThousandsGrouping, in anticipation of fixing issue 3140. 2008-06-24 00:42:10 +00:00
Andrew M. Kuchling d897264464 Docstring typo 2008-06-21 13:29:12 +00:00
Hye-Shik Chang 30fa13f3a0 Fix build on FreeBSD gcc. 2008-06-21 11:15:30 +00:00
Raymond Hettinger e0e711446b Issue 3008: hex/oct/bin can show floats exactly. 2008-06-21 06:39:53 +00:00
Mark Dickinson 1ec2fcd16e Issue #3004: Minor fix to slice.indices(). slice(-10).indices(9) now
returns (0, 0, 1) instead of (0, -1, 1), and slice(None, 10, -1).indices(10)
returns (9, 9, -1) instead of (9, 10, -1).
2008-06-20 14:53:43 +00:00
Raymond Hettinger e3ae655edf Make bin() implementation parallel oct() and hex() so that int/long subclasses can override or so that other classes can support. 2008-06-20 04:18:15 +00:00
Amaury Forgeot d'Arc a8919fe631 Issue 3110: Crash with weakref subclass,
seen after a "import multiprocessing.reduction"

An instance of a weakref subclass can have attributes.
If such a weakref holds the only strong reference to the object,
deleting the weakref will delete the object. In this case,
the callback must not be called, because the ref object is being deleted!
2008-06-16 19:12:42 +00:00
Robert Schuppenies 73e9ffc811 Fixed: sys.getsizeof does not take the actual length of the tuples into account. 2008-06-13 13:29:37 +00:00
Raymond Hettinger 4267be6478 Multi-arg form for set.difference() and set.difference_update(). 2008-06-11 10:30:54 +00:00