From: Pablo Galindo Date: Tue, 19 Jan 2021 13:09:06 +0000 (+0000) Subject: Add a clarification for the object-domain allocators regarding pointer validity ... X-Git-Tag: v3.10.0a5~86 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e485be5b6bd5fde97d78f09e2e4cca7f363763c3;p=thirdparty%2FPython%2Fcpython.git Add a clarification for the object-domain allocators regarding pointer validity (GH-24253) --- diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst index bd73780cc0f8..0597ef713665 100644 --- a/Doc/c-api/memory.rst +++ b/Doc/c-api/memory.rst @@ -304,6 +304,12 @@ The following function sets, modeled after the ANSI C standard, but specifying behavior when requesting zero bytes, are available for allocating and releasing memory from the Python heap. +.. note:: + There is no guarantee that the memory returned by these allocators can be + succesfully casted to a Python object when intercepting the allocating + functions in this domain by the methods described in + the :ref:`Customize Memory Allocators ` section. + The :ref:`default object allocator ` uses the :ref:`pymalloc memory allocator `. @@ -385,6 +391,7 @@ Legend: * ``pymalloc``: :ref:`pymalloc memory allocator ` * "+ debug": with debug hooks installed by :c:func:`PyMem_SetupDebugHooks` +.. _customize-memory-allocators: Customize Memory Allocators ===========================