From 9af03013a619a9a480c898e82673bd6fa8f94370 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Mon, 18 Jan 2021 22:04:23 +0000 Subject: [PATCH] Add a clarification for the object-domain allocators regarding pointer validity --- 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 87425bcf1e71f2..74bcfda67b4463 100644 --- a/Doc/c-api/memory.rst +++ b/Doc/c-api/memory.rst @@ -272,6 +272,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 `. @@ -353,6 +359,7 @@ Legend: * ``pymalloc``: :ref:`pymalloc memory allocator ` * "+ debug": with debug hooks installed by :c:func:`PyMem_SetupDebugHooks` +.. _customize-memory-allocators: Customize Memory Allocators ===========================