From e485be5b6bd5fde97d78f09e2e4cca7f363763c3 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Tue, 19 Jan 2021 13:09:06 +0000 Subject: [PATCH] Add a clarification for the object-domain allocators regarding pointer validity (GH-24253) --- Doc/c-api/memory.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/c-api/memory.rst b/Doc/c-api/memory.rst index bd73780cc0f8e8..0597ef71366571 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 ===========================