Gregory P. Smith
a6be61ec71
Keep y a Py_hash_t instead of Py_uhash_t as it is compared with == -1 and the
compiler logic will do the right thing with just x as a Py_uhash_t. This
matches what was already done in the 3.3 version.
cleanup only - no functionality or hash values change.
13 years ago
Gregory P. Smith
27cbcd6241
Fix the internals of our hash functions to used unsigned values during hash
computation as the overflow behavior of signed integers is undefined.
In practice we require compiling everything with -fwrapv which forces overflow
to be defined as twos compliment but this keeps the code cleaner for checkers
or in the case where someone has compiled it without -fwrapv or their
compiler's equivalent.
Found by Clang trunk's Undefined Behavior Sanitizer (UBSan).
Cleanup only - no functionality or hash values change.
13 years ago
Antoine Pitrou
62a0d6ea40
Issue #16602 : When a weakref's target was part of a long deallocation chain, the object could remain reachable through its weakref even though its refcount had dropped to zero.
Thanks to Eugene Toder for diagnosing and reporting the issue.
13 years ago
Victor Stinner
27b1ca29cc
Issue #16416 : On Mac OS X, operating system data are now always
encoded/decoded to/from UTF-8/surrogateescape, instead of the locale encoding
(which may be ASCII if no locale environment variable is set), to avoid
inconsistencies with os.fsencode() and os.fsdecode() functions which are
already using UTF-8/surrogateescape.
13 years ago
Antoine Pitrou
e11fecb5a9
Issue #16453 : Fix equality testing of dead weakref objects.
Also add tests for ordering and hashing.
13 years ago
Mark Dickinson
8cd1c7681d
Issue #16402 : In range slicing, fix shadowing of exceptions from __index__ method.
13 years ago
Christian Heimes
6d26ade920
Fix compilation on Windows
13 years ago
Ezio Melotti
c64bcbec4b
#8401 : assigning an int to a bytearray slice (e.g. b[3:4] = 5) now raises an error.
13 years ago
Benjamin Peterson
9892f52145
avoid a function call with redundant checks for dict size
13 years ago
Benjamin Peterson
d1f2cb37a2
only fast-path fromkeys() when the constructor returns a empty dict ( closes #16345 )
13 years ago
Benjamin Peterson
c43112823b
initialize more global type objects ( closes #16369 )
13 years ago
Mark Dickinson
fb90c0934c
Issue #14700 : Fix buggy overflow checks for large precision and width in new-style and old-style formatting.
13 years ago
Mark Dickinson
91044799f7
Issue #16277 : in PyLong_FromVoidPtr, add missing branch for sizeof(void*) <= sizeof(long).
13 years ago
Chris Jerdonek
83fe2e1c22
Issue #14783 : Improve int() docstring and also str(), range(), and slice().
This commit rewrites the docstring for int() to incorporate the documentation
changes made in issue #16036 . It also switches the docstrings for int(),
str(), range(), and slice() to use multi-line signatures.
13 years ago
Antoine Pitrou
6f80f5d444
Issue #15379 : Fix passing of non-BMP characters as integers for the charmap decoder (already working as unicode strings).
Patch by Serhiy Storchaka.
14 years ago
Mark Dickinson
c286e58044
Issue 15959: Fix type mismatch for quick{_neg}_int_allocs. Thanks Serhiy Storchaka.
14 years ago
Trent Nelson
ab02db23b1
Silence compiler warnings on Solaris 10 via explicit (void *) casts.
(Compiler: Solaris Studio 12.3)
14 years ago
Christian Heimes
79b97ee2ab
Fix out of bounds read in long_new() for empty bytes with an explicit base. int(b'', somebase) calls PyLong_FromString() with char* of length 1 but the function accesses the first argument at offset 1. CID 715359
14 years ago
Christian Heimes
e81dc296f2
Fixed memory leak in error branch of object_repr which may leak a reference to mod when type_name returns NULL. CID 715371
14 years ago
Christian Heimes
a0e7e41cba
Fixed possible reference leak to mod when type_name() returns NULL
14 years ago
Christian Heimes
d5a88044a3
PyTuple_Pack() was missing va_end() in its error branch which lead to a resource leak.
14 years ago
Christian Heimes
949f331731
Py_TYPE() has already dereferenced self before the NULL check. Moved Py_TYPE() after the check for self == NULL
14 years ago
Antoine Pitrou
56cd62c04a
Issue #13992 : The trashcan mechanism is now thread-safe. This eliminates
sporadic crashes in multi-thread programs when several long deallocator
chains ran concurrently and involved subclasses of built-in container
types.
Because of this change, a couple extension modules compiled for 3.2.4
(those which use the trashcan mechanism, despite it being undocumented)
will not be loadable by 3.2.3 and earlier. However, extension modules
compiled for 3.2.3 and earlier will be loadable by 3.2.4.
14 years ago
Alexander Belopolsky
397e5c98bc
Issue #15855 : added docstrings for memoryview methods and data descriptors.
14 years ago
Benjamin Peterson
28a6cfaefc
use the stricter PyMapping_Check ( closes #15801 )
14 years ago
Stefan Krah
7cacd2eb92
Issue #15736 : Fix overflow in _PySequence_BytesToCharpArray().
14 years ago
Stefan Krah
fd24f9e51e
Issue #15732 : Fix (constructed) crash in _PySequence_BytesToCharpArray().
Found by Coverity.
14 years ago
Stefan Krah
6b962860e2
Check for NULL return value in PyStructSequence_NewType(). Found by Coverity.
14 years ago
Nick Coghlan
573b1fd779
Fix str docstring
14 years ago
Antoine Pitrou
6f430e4963
Issue #15604 : Update uses of PyObject_IsTrue() to check for and handle errors correctly.
Patch by Serhiy Storchaka.
14 years ago
Antoine Pitrou
b4bbee25b1
Issue #14579 : Fix CVE-2012-2135: vulnerability in the utf-16 decoder after error handling.
Patch by Serhiy Storchaka.
14 years ago
Andrew Svetlov
ddcb6206bf
Issue #15404 : Refleak in PyMethodObject repr.
14 years ago
Meador Inge
29e49d6394
Issue #15394 : Fix ref leaks in PyModule_Create.
Patch by Julia Lawall.
14 years ago
Antoine Pitrou
99cc629969
Issue #15142 : Fix reference leak when deallocating instances of types created using PyType_FromSpec().
14 years ago
Antoine Pitrou
a103b96a80
Issue #14829 : Fix bisect and range() indexing with large indices (>= 2 ** 32) under 64-bit Windows.
14 years ago
Antoine Pitrou
a1433fed8e
Remove tab characters
14 years ago
Antoine Pitrou
682d94c11a
Use size_t, not ssize_t (issue #14801 ).
14 years ago
Benjamin Peterson
89a6e9a27b
fix possible refleak ( closes #14752 )
14 years ago
Benjamin Peterson
ab3da290fe
close() doesn't take any args ( closes #14717 )
14 years ago
Benjamin Peterson
7295c6a871
fix calling the classmethod descriptor directly ( closes #14699 )
14 years ago
Benjamin Peterson
7b1668735a
don't use a slot wrapper from a different special method ( closes #14658 )
This also alters the fix to #11603 . Specifically, setting __repr__ to
object.__str__ now raises a recursion RuntimeError when str() or repr() is
called instead of silently bypassing the recursion. I believe this behavior is
more correct.
14 years ago
Mark Dickinson
bcc17eefd2
Issue #14630 : Fix an incorrect access of ob_digit[0] for a zero instance of an int subclass.
14 years ago
Benjamin Peterson
e42fb307ed
SETUP_WITH acts like SETUP_FINALLY for the purposes of setting f_lineno ( closes #14612 )
14 years ago
Benjamin Peterson
f6622c8a3e
fix build without Py_DEBUG and DNDEBUG ( closes #14509 )
14 years ago
Benjamin Peterson
b6af60c2a9
adjust formatting
14 years ago
Benjamin Peterson
3471bb67e7
remove extraneous condition
14 years ago
Benjamin Peterson
ab3c1c1994
be consistent with rest of function
14 years ago
Antoine Pitrou
58bb82e7b4
Issue #13019 : Fix potential reference leaks in bytearray.extend().
Patch by Suman Saha.
14 years ago
Benjamin Peterson
a8755c586e
kill this terribly outdated comment
14 years ago
Antoine Pitrou
0197ff97d0
Issue #14387 : Do not include accu.h from Python.h.
14 years ago