diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-07-31 23:11:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-31 23:11:15 (GMT) |
commit | db361a340af3970c279908c8746a6b9ed45f47b8 (patch) | |
tree | ad22a94a583e07c38191714446f0ebbde6681bdf /Doc/c-api/memory.rst | |
parent | fb344e99aa0da5bef9318684ade69978585fe060 (diff) | |
download | cpython-db361a340af3970c279908c8746a6b9ed45f47b8.zip cpython-db361a340af3970c279908c8746a6b9ed45f47b8.tar.gz cpython-db361a340af3970c279908c8746a6b9ed45f47b8.tar.bz2 |
gh-105766: Document that Custom Allocators Must Be Thread-Safe (gh-107519)
Diffstat (limited to 'Doc/c-api/memory.rst')
-rw-r--r-- | Doc/c-api/memory.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst index 8968b26..1df8c2b 100644 --- a/Doc/c-api/memory.rst +++ b/Doc/c-api/memory.rst @@ -476,6 +476,10 @@ Customize Memory Allocators thread-safe: the :term:`GIL <global interpreter lock>` is not held when the allocator is called. + For the remaining domains, the allocator must also be thread-safe: + the allocator may be called in different interpreters that do not + share a ``GIL``. + If the new allocator is not a hook (does not call the previous allocator), the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the debug hooks on top on the new allocator. @@ -500,6 +504,8 @@ Customize Memory Allocators **must** wrap the existing allocator. Substituting the current allocator for some other arbitrary one is **not supported**. + .. versionchanged:: 3.12 + All allocators must be thread-safe. .. c:function:: void PyMem_SetupDebugHooks(void) |