Skip to content

Commit e485be5

Browse files
authored
Add a clarification for the object-domain allocators regarding pointer validity (GH-24253)
1 parent 65cf1ad commit e485be5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Doc/c-api/memory.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,12 @@ The following function sets, modeled after the ANSI C standard, but specifying
304304
behavior when requesting zero bytes, are available for allocating and releasing
305305
memory from the Python heap.
306306
307+
.. note::
308+
There is no guarantee that the memory returned by these allocators can be
309+
succesfully casted to a Python object when intercepting the allocating
310+
functions in this domain by the methods described in
311+
the :ref:`Customize Memory Allocators <customize-memory-allocators>` section.
312+
307313
The :ref:`default object allocator <default-memory-allocators>` uses the
308314
:ref:`pymalloc memory allocator <pymalloc>`.
309315
@@ -385,6 +391,7 @@ Legend:
385391
* ``pymalloc``: :ref:`pymalloc memory allocator <pymalloc>`
386392
* "+ debug": with debug hooks installed by :c:func:`PyMem_SetupDebugHooks`
387393
394+
.. _customize-memory-allocators:
388395
389396
Customize Memory Allocators
390397
===========================

0 commit comments

Comments
 (0)