Use macros for marking and checking endpoints in the doubly-linked list of blocks.
* Add comment explaining the endpoint checks
* Only do the checks in a debug build
* Simplify newblock() to only require a length argument
and leave the link updates to the calling code.
* Also add comment for the freelisting logic.
Victor Stinner [Sun, 7 Jul 2013 00:49:07 +0000 (02:49 +0200)]
Issue #17206: On Windows, increase the stack size from 2 MB to 4.2 MB to fix
a stack overflow in the marshal module (fix a crash in test_marshal).
Patch written by Jeremy Kloth.
* PyMem_Malloc()/PyObject_Realloc() now always call malloc()/realloc(), instead
of calling PyObject_Malloc()/PyObject_Realloc() in debug mode.
* PyObject_Malloc()/PyObject_Realloc() now falls back to
PyMem_Malloc()/PyMem_Realloc() for allocations larger than 512 bytes.
* Redesign debug checks on memory block allocators as hooks, instead of using C
macros
Issue #18364: Stop using the ImportError._not_found hack.
The private attribute was leaking out of importlib and led to at least
one person noticing it. Switch to another hack which won't leak
outside of importlib and is nearly as robust.
Ronald Oussoren [Sat, 6 Jul 2013 08:25:04 +0000 (10:25 +0200)]
(3.3->default) Issue #17860: explicitly mention that std* streams are opened in binary mode by default.
The documentation does mention that the streams are opened in text mode
when univeral_newlines is true, but not that that they are opened in
binary mode when that argument is false and that seems to confuse at
least some users.
Ronald Oussoren [Sat, 6 Jul 2013 08:23:59 +0000 (10:23 +0200)]
Issue #17860: explicitly mention that std* streams are opened in binary mode by default.
The documentation does mention that the streams are opened in text mode
when univeral_newlines is true, but not that that they are opened in
binary mode when that argument is false and that seems to confuse at
least some users.
Victor Stinner [Wed, 3 Jul 2013 20:35:39 +0000 (22:35 +0200)]
(Merge 3.3) test_faulthandler: skip test_read_null() on AIX
AIX maps the first page of memory at address zero as valid, read-only. Reading
NULL is not a fault on AIX. This is utilized by IBM compiler optimizations.
One speculatively can indirect through a pointer which may be null without
first testing if null and defer the test before using the value.
Victor Stinner [Wed, 3 Jul 2013 20:29:42 +0000 (22:29 +0200)]
test_faulthandler: skip test_read_null() on AIX
AIX maps the first page of memory at address zero as valid, read-only. Reading
NULL is not a fault on AIX. This is utilized by IBM compiler optimizations.
One speculatively can indirect through a pointer which may be null without
first testing if null and defer the test before using the value.
Victor Stinner [Mon, 1 Jul 2013 22:17:14 +0000 (00:17 +0200)]
(Merge 3.3) Issue #18343: faulthandler.register() now keeps the previous signal
handler when the function is called twice, so faulthandler.unregister()
restores correctly the original signal handler.
Victor Stinner [Mon, 1 Jul 2013 22:14:56 +0000 (00:14 +0200)]
Issue #18343: faulthandler.register() now keeps the previous signal handler
when the function is called twice, so faulthandler.unregister() restores
correctly the original signal handler.
Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now the
tstate is first removed from TLS and then deallocated.
CID 1019639 (#1 of 1): Use after free (USE_AFTER_FREE)
use_after_free: Using freed pointer tstate.
Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now the
tstate is first removed from TLS and then deallocated.
CID 1019639 (#1 of 1): Use after free (USE_AFTER_FREE)
use_after_free: Using freed pointer tstate.
Terry Jan Reedy [Sun, 30 Jun 2013 20:52:19 +0000 (16:52 -0400)]
Issue 18189: remove unused methods in idlelib.Delegator.Delegator.
Idle code already uses x.delegate instead of x.getdelegate().
The printed report must have been for testing.
Christian Heimes [Sat, 29 Jun 2013 19:37:34 +0000 (21:37 +0200)]
Fix resource leak in pickle module
CID 983309 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable unicode_str going out of scope leaks the storage it points to.
Christian Heimes [Sat, 29 Jun 2013 19:21:37 +0000 (21:21 +0200)]
Fix ref leak in error case of unicode index
CID 983319 (#1 of 2): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable substring going out of scope leaks the storage it points to.
Christian Heimes [Sat, 29 Jun 2013 19:17:34 +0000 (21:17 +0200)]
Fix ref leak in error case of unicode rindex and rfind
CID 983320: Resource leak (RESOURCE_LEAK)
CID 983321: Resource leak (RESOURCE_LEAK)
leaked_storage: Variable substring going out of scope leaks the storage it points to.
Christian Heimes [Sat, 29 Jun 2013 19:03:51 +0000 (21:03 +0200)]
Fix resource leak in parser, free node ptr
CID 1028068 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable n going out of scope leaks the storage it points to.
Christian Heimes [Sat, 29 Jun 2013 18:43:13 +0000 (20:43 +0200)]
Fix memory leak in pyexpat PyUnknownEncodingHandler
CID 1040367 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable u going out of scope leaks the storage it points to.
Christian Heimes [Sat, 29 Jun 2013 18:41:06 +0000 (20:41 +0200)]
Fix memory leak in endswith
CID 1040368 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable substring going out of scope leaks the storage it points to.