Commit Graph

79625 Commits

Author SHA1 Message Date
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
Ezio Melotti e0a39de647 #18380: merge with 3.3. 2013-07-06 17:17:45 +02:00
Ezio Melotti 2a99d5df63 #18380: pass regex flags to the right argument. Patch by Valentina Mukhamedzhanova. 2013-07-06 17:16:04 +02:00
Florent Xicluna c2464bf5c6 test_ftplib: silence a BytesWarning when checking TypeError 2013-07-06 15:08:29 +02:00
Florent Xicluna 5f3fef37f6 test_ftplib: silence a BytesWarning when checking TypeError 2013-07-06 15:08:21 +02:00
Ronald Oussoren 361b28dbd4 (3.3->default) Issue #12990: The "Python Launcher" on OSX could not launch python scripts that have paths that include wide characters. 2013-07-06 13:25:44 +02:00
Ronald Oussoren fd1c69e2a4 Issue #12990: The "Python Launcher" on OSX could not launch python scripts that have paths that include wide characters. 2013-07-06 13:20:57 +02:00
Florent Xicluna 8624ed502f Issue #18375: merge with 3.3 2013-07-06 12:27:50 +02:00
Florent Xicluna d9e7c86d7e Issue #18375: Assume --randomize when --randseed is used for running the testsuite. 2013-07-06 12:25:52 +02:00
Ronald Oussoren c17d0c2218 (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.
2013-07-06 10:25:04 +02:00
Ronald Oussoren a68650553d 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.
2013-07-06 10:23:59 +02:00
Raymond Hettinger de68e0cf0e Speed-up deque indexing by changing the deque block length to a power of two.
The division and modulo calculation in deque_item() can be compiled
to fast bitwise operations when the BLOCKLEN is a power of two.

Timing before:

 ~/cpython $ py -m timeit -r7 -s 'from collections import deque' -s 'd=deque(range(10))' 'd[5]'
10000000 loops, best of 7: 0.0627 usec per loop

Timing after:

~/cpython $ py -m timeit -r7 -s 'from collections import deque' -s 'd=deque(range(10))' 'd[5]'
10000000 loops, best of 7: 0.0581 usec per loop
2013-07-05 18:05:29 -10:00
Christian Heimes 6597aa16b6 Issue #18347: ElementTree's html serializer now preserves the case of closing tags. 2013-07-05 01:40:52 +02:00
Christian Heimes 54ad7e39df Issue #18347: ElementTree's html serializer now preserves the case of closing tags. 2013-07-05 01:39:49 +02:00
Brett Cannon 260fbe80c5 Issue #15767: Excise the remaining instances of ModuleNotFoundError 2013-07-04 18:16:15 -04:00
Brett Cannon 3dfd23245b Remove dead code in test_exceptions. 2013-07-04 18:04:20 -04:00
Brett Cannon fc4b5b9a42 Move test_import over to unittest.main(). 2013-07-04 18:03:57 -04:00
Brett Cannon 679ecb565b Issue #15767: back out 8a0ed9f63c6e, finishing the removal of
ModuleNotFoundError.
2013-07-04 17:51:50 -04:00
Brett Cannon 82da8886cc Issue #15767: Revert 3a50025f1900 for ModuleNotFoundError 2013-07-04 17:48:16 -04:00
Brett Cannon 45091c0a0c Issue #15767: Back out 8d28d44f3a9a related to ModuleNotFoundError. 2013-07-04 17:44:08 -04:00
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
Antoine Pitrou fff59155d4 Consolidate tests section. 2013-07-04 21:06:12 +02:00
Antoine Pitrou 0cb1e9ab97 Issue #11185: Fix test_wait4 under AIX. Patch by Sébastien Sablé. 2013-07-04 21:05:30 +02:00
Antoine Pitrou be9c841494 Issue #11185: Fix test_wait4 under AIX. Patch by Sébastien Sablé. 2013-07-04 21:03:10 +02:00
Victor Stinner 7e71c5672c (Merge 3.3) test_time.test_monotonic(): use a longer sleep to try to make the test more reliable 2013-07-03 23:07:59 +02:00