mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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.
This commit is contained in:
parent
8a1be61849
commit
c4aec3628b
6 changed files with 119 additions and 34 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue