Andrew M. Kuchling
b15d6fb9a7
Docstring change: Specify exception raised
2008-10-04 01:03:42 +00:00
Andrew M. Kuchling
bd7c4ca569
Use correct capitalization of NaN
2008-10-04 01:02:29 +00:00
Andrew M. Kuchling
d7b7dde98e
Mention exception in docstring
2008-10-03 16:29:19 +00:00
Christian Heimes
32a66a0410
Fixed a couple more C99 comments and one occurence of inline.
2008-10-02 19:47:50 +00:00
Christian Heimes
25584b1b74
Fixed a comment to C89 style as of http://drj11.wordpress.com/2008/10/02/python-and-bragging-about-c89/
2008-10-02 18:33:41 +00:00
Amaury Forgeot d'Arc
fc5ea39289
#3967 : Correct a crash in count() and find() methods of string-like objects.
...
For example:
"".count("xxxx", sys.maxint, 0)
Reviewed by Benjamin Peterson.
Will port to 2.5 and 3.0.
2008-09-26 22:34:08 +00:00
Amaury Forgeot d'Arc
17617a07d1
#3965 : on Windows, open() crashes if the filename or the mode is invalid,
...
and if the filename is a unicode string.
Reviewed by Martin von Loewis.
2008-09-25 20:52:56 +00:00
Martin v. Löwis
e86b07cc9a
Bug #3951 : Py_USING_MEMORY_DEBUGGER should not be enabled by default.
2008-09-25 04:12:50 +00:00
Andrew MacIntyre
8c47cabbe9
should use macro'ed symbols not direct
...
Part of source_os2emx.patch in issue 3868
Reviewed by Amaury Forgeot d'Arc
2008-09-22 14:10:54 +00:00
Martin v. Löwis
9fa5a2828c
Issue #3642 : Suppress warning in obmalloc when size_t is
...
larger than uint. Reverts r65975. Reviewed by Brett Cannon.
2008-09-11 06:53:30 +00:00
Martin v. Löwis
24329ba176
Issue #3811 : The Unicode database was updated to 5.1.
...
Reviewed by Fredrik Lundh and Marc-Andre Lemburg.
2008-09-10 13:38:12 +00:00
Benjamin Peterson
97179b0f58
Fix #3634 invalid return value from _weakref.ref(Exception).__init__
...
Reviewers: Amaury, Antoine, Benjamin
2008-09-09 20:55:01 +00:00
Georg Brandl
98064078f7
Fix varname in docstring. #3822 .
2008-09-09 19:26:00 +00:00
Amaury Forgeot d'Arc
d3ffb8974f
#3777 : long(4.2) returned an int, and broke backward compatibility.
...
the __long__ slot is allowed to return either int or long, but the behaviour of
float objects should not change between 2.5 and 2.6.
Reviewed by Benjamin Peterson
2008-09-09 07:24:30 +00:00
Amaury Forgeot d'Arc
3571fbfed7
Issue #3751 : str.rpartition would perform a left-partition when called with
...
a unicode argument.
will backport.
2008-09-01 19:52:00 +00:00
Antoine Pitrou
d4ae97bc38
#3668 : When PyArg_ParseTuple correctly parses a s* format, but raises an
...
exception afterwards (for a subsequent parameter), the user code will
not call PyBuffer_Release() and memory will leak.
Reviewed by Amaury Forgeot d'Arc.
2008-08-29 18:39:48 +00:00
Antoine Pitrou
0668c62677
Issue #2534 : speed up isinstance() and issubclass() by 50-70%, so as to
...
match Python 2.5 speed despite the __instancecheck__ / __subclasscheck__
mechanism. In the process, fix a bug where isinstance() and issubclass(),
when given a tuple of classes as second argument, were looking up
__instancecheck__ / __subclasscheck__ on the tuple rather than on each
type object.
Reviewed by Benjamin Peterson and Raymond Hettinger.
2008-08-26 22:42:08 +00:00
Benjamin Peterson
712ee92309
generate py3k warnings on __getslice__, __delslice__, and __setslice__
...
Reviewer: Brett Cannon
2008-08-24 18:10:20 +00:00
Neal Norwitz
18aa388ca0
Fix:
...
* crashes on memory allocation failure found with failmalloc
* memory leaks found with valgrind
* compiler warnings in opt mode which would lead to invalid memory reads
* problem using wrong name in decimal module reported by pychecker
Update the valgrind suppressions file with new leaks that are small/one-time
leaks we don't care about (ie, they are too hard to fix).
TBR=barry
TESTED=./python -E -tt ./Lib/test/regrtest.py -uall (both debug and opt modes)
in opt mode:
valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \
./python -E -tt ./Lib/test/regrtest.py -uall,-bsddb,-compiler \
-x test_logging test_ssl test_multiprocessing
valgrind -q --leak-check=yes --suppressions=Misc/valgrind-python.supp \
./python -E -tt ./Lib/test/regrtest.py test_multiprocessing
for i in `seq 1 4000` ; do
LD_PRELOAD=~/local/lib/libfailmalloc.so FAILMALLOC_INTERVAL=$i \
./python -c pass
done
At least some of these fixes should probably be backported to 2.5.
2008-08-24 05:04:52 +00:00
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
Gregory P. Smith
9d53457e59
Merge in release25-maint r60793:
...
Added checks for integer overflows, contributed by Google. Some are
only available if asserts are left in the code, in cases where they
can't be triggered from Python code.
2008-06-11 07:41:16 +00:00
Raymond Hettinger
610a93ea26
Handle the case with zero arguments.
2008-06-11 00:44:47 +00:00
Gregory P. Smith
b7fea62cca
Rename bytesobject.c back to stringobject.c to keep with the PyString theme.
...
Part of reverting most of r63675 per the mailing list discussion.
2008-06-10 21:23:22 +00:00
Gregory P. Smith
99a3dce92d
More reverting of r63675 per the mailing list discussions. This restores
...
occurances of PyBytes_ in the code to their original PyString_ names. The
bytesobject.c file will be renamed back to stringobject.c in a future checkin.
2008-06-10 17:42:36 +00:00
Robert Schuppenies
901c997de0
Issue 3048: Fixed sys.getsizeof for unicode objects.
2008-06-10 10:10:31 +00:00
Alexandre Vassalotti
602d8db2bc
Added better pickling support to xrange objects.
...
Cleaned up the unit test.
2008-06-10 04:01:23 +00:00
Alexandre Vassalotti
1f2f61a78f
Issue 2582: Fix pickling of xrange objects.
2008-06-10 03:34:53 +00:00
Raymond Hettinger
5c4d3d0e4c
Let set.intersection() and set.intersection_update() take multiple input arguments.
2008-06-09 13:07:27 +00:00
Raymond Hettinger
ee4bcad68e
Let set.union() and set.update() accept multiple inputs.
2008-06-09 08:33:37 +00:00
Gregory P. Smith
dd96db63f6
This reverts r63675 based on the discussion in this thread:
...
http://mail.python.org/pipermail/python-dev/2008-June/079988.html
Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names
in the spirit of 3.0 are available via a #define only. See the email thread.
2008-06-09 04:58:54 +00:00
Travis E. Oliphant
0144f27602
Remove locking part of new buffer protocol.
2008-06-06 22:39:47 +00:00
Alexandre Vassalotti
80af6da748
Fixed complex.__getnewargs__() to not emit another complex object.
2008-06-04 20:41:44 +00:00
Georg Brandl
7a6de8b0f4
Some style nits. Also clarify in the docstrings what __sizeof__ does.
2008-06-01 16:42:16 +00:00
Robert Schuppenies
51df064767
Issue #2898 : Added sys.getsizeof() to retrieve size of objects in bytes.
2008-06-01 16:16:17 +00:00
Martin v. Löwis
99815892f6
New environment variable PYTHONIOENCODING.
2008-06-01 07:20:46 +00:00
Eric Smith
dc13b79a38
Refactor and clean up str.format() code (and helpers) in advance of optimizations.
2008-05-30 18:10:04 +00:00
Georg Brandl
30fadc1799
#2999 : fix name of third parameter in unicode.replace()'s docstring.
2008-05-30 07:54:16 +00:00
Raymond Hettinger
d99bee7c9f
Issue 2855: Fix obscure crasher by slowing down the entire module. Mimics what was done to dictionaries in r59223.
2008-05-30 06:49:47 +00:00
Georg Brandl
f18a707205
Revert #2990 patch; it's not necessary as Armin showed.
2008-05-29 14:35:39 +00:00
Georg Brandl
5ec330cb2f
#2990 : prevent inconsistent state while updating method cache.
2008-05-28 15:41:36 +00:00
Georg Brandl
74a1deaab3
#2989 : add PyType_Modified().
2008-05-28 11:21:39 +00:00
Christian Heimes
44720838eb
Renamed bytesobject.c to bytearrayobject.c
...
Renamed stringobject.c to bytesobject.c
Fixed Windows builds
2008-05-26 13:01:01 +00:00
Christian Heimes
593daf545b
Renamed PyString to PyBytes
2008-05-26 12:51:38 +00:00
Christian Heimes
3497f94476
First step of the C API rename:
...
renamed Include/bytesobject.h to Include/bytearrayobject.h
renamed Include/stringobject.h to Include/bytesobject.h
added Include/stringobject.h with aliases
2008-05-26 12:29:14 +00:00
Georg Brandl
88659b0ab2
#2592 : delegate nb_index and the floor/truediv slots in weakref.proxy.
2008-05-20 08:40:43 +00:00
Georg Brandl
dffbf5f542
Revert copy_reg -> copyreg rename.
2008-05-20 07:49:57 +00:00
Georg Brandl
a9916b55de
#2353 : raise Py3k warning in file.xreadlines().
2008-05-17 22:11:54 +00:00
Alexandre Vassalotti
ea0b22a167
Patch by Quentin Gallet-Gilles: Renaming leftovers for 2.6.
...
This fixes the omissions of configparser, copyreg, queue and
socketserver renaming.
2008-05-16 18:03:52 +00:00
Georg Brandl
ecf9091f59
Don't allow keyword arguments to reversed().
2008-05-16 13:24:29 +00:00
Georg Brandl
5ffad6646e
Make generator repr consistent with function and code object repr.
2008-05-16 09:34:48 +00:00
Georg Brandl
c91210c06b
#2863 : add gen.__name__ and add this name to generator repr().
2008-05-15 15:08:32 +00:00