diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-14 21:26:53 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-14 21:26:53 (GMT) |
commit | c4aec3628b6effcf205d70ce7d80f69847954b66 (patch) | |
tree | 4de61828675acb7bb697f2607672b4de7c23c0f6 /Doc | |
parent | 8a1be61849341528c866924cf69d378ce7790889 (diff) | |
download | cpython-c4aec3628b6effcf205d70ce7d80f69847954b66.zip cpython-c4aec3628b6effcf205d70ce7d80f69847954b66.tar.gz cpython-c4aec3628b6effcf205d70ce7d80f69847954b66.tar.bz2 |
Check the GIL in PyObject_Malloc()
Issue #26558: The debug hook of PyObject_Malloc() now checks that the GIL is
held when the function is called.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/memory.rst | 9 | ||||
-rw-r--r-- | Doc/whatsnew/3.6.rst | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst index fe1cd5f..25867d9 100644 --- a/Doc/c-api/memory.rst +++ b/Doc/c-api/memory.rst @@ -341,10 +341,13 @@ Customize Memory Allocators Newly allocated memory is filled with the byte ``0xCB``, freed memory is filled with the byte ``0xDB``. Additional checks: - - detect API violations, ex: :c:func:`PyObject_Free` called on a buffer + - Detect API violations, ex: :c:func:`PyObject_Free` called on a buffer allocated by :c:func:`PyMem_Malloc` - - detect write before the start of the buffer (buffer underflow) - - detect write after the end of the buffer (buffer overflow) + - Detect write before the start of the buffer (buffer underflow) + - Detect write after the end of the buffer (buffer overflow) + - Check that the :term:`GIL <global interpreter lock>` is held when + allocator functions of the :c:data:`PYMEM_DOMAIN_OBJ` domain (ex: + :c:func:`PyObject_Malloc`) are called These hooks are installed by default if Python is compiled in debug mode. The :envvar:`PYTHONMALLOC` environment variable can be used to install diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst index 588826b..b644a5c 100644 --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -117,6 +117,9 @@ compiled in release mode using ``PYTHONMALLOC=debug``. Effects of debug hooks: :c:func:`PyMem_Malloc`. * Detect write before the start of the buffer (buffer underflow) * Detect write after the end of the buffer (buffer overflow) +* Check that the :term:`GIL <global interpreter lock>` is held when allocator + functions of the :c:data:`PYMEM_DOMAIN_OBJ` domain (ex: + :c:func:`PyObject_Malloc`) are called See the :c:func:`PyMem_SetupDebugHooks` function for debug hooks on Python memory allocators. |