Commit Graph

79649 Commits

Author SHA1 Message Date
Victor Stinner 064bbdc79b fix indentation 2013-07-08 22:28:27 +02:00
Victor Stinner 0ff0f54dd4 Issue #18408: Fix call_function() of ceval.c to handle PyTuple_New() failure
(in load_args()), ex: MemoryError.
2013-07-08 22:27:42 +02:00
Victor Stinner 9812af8e72 Issue #18408: Fix PyType_Ready() and type.__bases__ setter to handle
PyWeakref_NewRef() failure (ex: MemoryError).
2013-07-08 22:25:48 +02:00
Victor Stinner 3a8b79d4d2 Issue #18408: Fix marshal reader for Unicode strings: handle
PyUnicode_DecodeUTF8() failure (ex: MemoryError).
2013-07-08 22:23:32 +02:00
Victor Stinner b27cd3e5ad Issue #18408: Fix list.pop() to handle list_resize() failure (MemoryError). 2013-07-08 22:20:44 +02:00
Victor Stinner c9b7f51ec2 Issue #18408: Fix PyDict_New() to handle correctly new_keys_object() failure
(MemoryError).
2013-07-08 22:19:20 +02:00
Victor Stinner 5d1866c78a Issue #18408: PyObject_GC_NewVar() now raises SystemError exception if nitems
is negative
2013-07-08 22:17:52 +02:00
Victor Stinner c1eb26cd2f gcmodule.c: strip trailing spaces 2013-07-08 22:15:05 +02:00
Ezio Melotti d95bb3f981 #18403: merge with 3.3. 2013-07-08 17:53:32 +02:00
Ezio Melotti 93dd6934ff #18403: fix an off-by-one typo noticed by Xue Fuqiao. 2013-07-08 17:52:54 +02:00
Ezio Melotti bf5af5d5bc Merge str.center tests from 3.3. 2013-07-08 17:49:59 +02:00
Ezio Melotti f84e01df31 Add a couple of tests for str.center with non-ASCII chars. 2013-07-08 17:48:29 +02:00
Victor Stinner 49fc8ece81 Issue #18203: Add _PyMem_RawStrdup() and _PyMem_Strdup()
Replace strdup() with _PyMem_RawStrdup() or _PyMem_Strdup(), depending if the
GIL is held or not.
2013-07-07 23:30:24 +02:00
Victor Stinner 6f8eeee7b9 Issue #18203: Fix _Py_DecodeUTF8_surrogateescape(), use PyMem_RawMalloc() as _Py_char2wchar() 2013-07-07 22:57:45 +02:00
Christian Heimes fa535f5220 Issue #18227: pyexpat now uses a static XML_Memory_Handling_Suite. cElementTree uses the same approach since at least Python 2.6 2013-07-07 17:35:11 +02:00
Victor Stinner 0e2d3cf2cb Issue #18203: Replace malloc() with PyMem_Malloc() in _PySequence_BytesToCharpArray() 2013-07-07 17:22:41 +02:00
Victor Stinner c6632e7eb4 Issue #18203: Replace malloc() with PyMem_Malloc() to allocate arena objects 2013-07-07 17:18:53 +02:00
Victor Stinner 80aa565fb4 Issue #18203: Replace malloc() with PyMem_RawMalloc() to allocate thread locks 2013-07-07 17:17:59 +02:00
Victor Stinner b7f1f65f1c Issue #18227: "Free" function of bz2, lzma and zlib modules has no return value (void) 2013-07-07 17:10:34 +02:00
Victor Stinner 11ebff2757 Issue #18203: Replace malloc() with PyMem_Malloc() in _ssl for the password 2013-07-07 17:07:52 +02:00
Victor Stinner 5064a52bcb Issue #18227: Use PyMem_RawAlloc() in bz2, lzma and zlib modules 2013-07-07 16:50:27 +02:00
Victor Stinner 65bf9cf26f Issue #18203: Fix decode_ascii_surrogateescape(), use PyMem_RawMalloc() as _Py_char2wchar() 2013-07-07 16:35:54 +02:00
Victor Stinner 6ce0dbf460 Fix a compiler warning in posix_sendfile() on FreeBSD:
Modules/posixmodule.c: In function 'posix_sendfile':
Modules/posixmodule.c:7700: warning: ISO C90 forbids mixed declarations and code
2013-07-07 16:32:36 +02:00
Victor Stinner b64049183c Issue #18203: Replace malloc() with PyMem_Malloc() in Python modules
Replace malloc() with PyMem_Malloc() when the GIL is held, or with
PyMem_RawMalloc() otherwise.
2013-07-07 16:21:41 +02:00
Victor Stinner 1a7425f67a Issue #18203: Replace malloc() with PyMem_RawMalloc() at Python initialization
* Replace malloc() with PyMem_RawMalloc()
* Replace PyMem_Malloc() with PyMem_RawMalloc() where the GIL is not held.
* _Py_char2wchar() now returns a buffer allocated by PyMem_RawMalloc(), instead
  of PyMem_Malloc()
2013-07-07 16:25:15 +02:00
Victor Stinner 51fa458d0a Issue #18203: Fix Py_Finalize(): destroy the GIL after the last call to
PyMem_Malloc() or PyObject_Malloc().

For example, PyCFunction_Fini() calls PyObject_GC_Del() which calls
PyObject_FREE().
2013-07-07 15:50:49 +02:00
Raymond Hettinger b385529ddf Fix #ifdef 2013-07-07 02:07:23 -10:00
Raymond Hettinger 82df925451 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.
2013-07-07 01:43:42 -10:00
Ezio Melotti 0cb2aafb36 #18106: refactor tests to use subtests and proper assert methods. Patch by Vajrasky Kok. 2013-07-07 13:37:20 +02:00
Ezio Melotti 9f96789cdc #17198: merge with 3.3. 2013-07-07 13:16:05 +02:00
Ezio Melotti b08495bbcf #17198: Fix a NameError in the dbm module. Patch by Valentina Mukhamedzhanova. 2013-07-07 13:15:08 +02:00
Florent Xicluna 74a146d3ac Merge #18013: Fix cgi.FieldStorage to parse the W3C sample form. 2013-07-07 12:46:28 +02:00
Florent Xicluna 331c3fd874 Issue #18013: Fix cgi.FieldStorage to parse the W3C sample form. 2013-07-07 12:44:28 +02:00
Ezio Melotti 4603487dc9 #18020: improve html.escape speed by an order of magnitude. Patch by Matt Bryant. 2013-07-07 11:11:24 +02:00
Ronald Oussoren 071029fac6 (3.3->default) Issue #18377: Code cleanup in Python Launcher
This changeset fixes a number of compiler warnings in the Python Launcher
binary for OSX. It also cleans up whitespace usage in those sources.
2013-07-07 09:54:08 +02:00
Ronald Oussoren 4e327c9d1c Issue #18377: Code cleanup in Python Launcher
This changeset fixes a number of compiler warnings in the Python Launcher
binary for OSX. It also cleans up whitespace usage in those sources.
2013-07-07 09:53:08 +02:00
Ronald Oussoren 5f8e78545c (3.3->default) Cleanup of documentation change from #17860
Reformulated the textual change, and applied it to the docstring as well.
2013-07-07 09:28:01 +02:00
Ronald Oussoren 385521c90e Cleanup of documentation change from #17860
Reformulated the textual change, and applied it to the docstring as well.
2013-07-07 09:26:45 +02:00
Raymond Hettinger ef9b47f0b8 merge 2013-07-06 17:50:01 -10:00
Raymond Hettinger f3a67b7e57 Improve variable names in deque_count() 2013-07-06 17:49:06 -10:00
Victor Stinner 725e668ac8 Issue #3329: Fix _PyObject_ArenaVirtualFree()
According to VirtualFree() documentation, the size must be zero if the "free
type" is MEM_RELEASE.
2013-07-07 03:06:16 +02:00
Victor Stinner 24e33acf8c 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.
2013-07-07 02:49:07 +02:00
Victor Stinner 0507bf56f0 Issue #3329: Implement the PEP 445
Add new enum:

* PyMemAllocatorDomain

Add new structures:

* PyMemAllocator
* PyObjectArenaAllocator

Add new functions:

* PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree()
* PyMem_GetAllocator(), PyMem_SetAllocator()
* PyObject_GetArenaAllocator(), PyObject_SetArenaAllocator()
* PyMem_SetupDebugHooks()

Changes:

* 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
2013-07-07 02:05:46 +02:00
Raymond Hettinger df715ba54d Apply the PyObject_VAR_HEAD and Py_SIZE macros
to be consistent with practices in other modules.
2013-07-06 13:01:13 -10:00
Brett Cannon b1f7632c1c merge 2013-07-06 18:05:02 -04:00
Brett Cannon 7e5d55705c merge for issue #18351. 2013-07-06 18:04:41 -04:00
Raymond Hettinger 5bfa8671bc Refactor deque_traverse().
Hoist conditional expression out of the loop.
Use rightblock as the guard instead of checking for NULL.
2013-07-06 11:58:09 -10:00
Brett Cannon a53cca3fea Issue #18351: Fix various issues with
importlib._bootstrap._get_sourcefile().

Thanks to its only use by the C API, it was never properly tested
until now.

Thanks to Neal Norwitz for discovering the bug and Madison May for the patch.
2013-07-06 17:56:43 -04:00
Raymond Hettinger 98054b4c1b Remove unnecessary branches from count() and reverse(). 2013-07-06 09:07:06 -10:00
Brett Cannon 0075110ab2 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.
2013-07-06 14:48:18 -04:00