Skip to content

Commit

Permalink
XXX _reserved
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Sep 17, 2024
1 parent 78ab083 commit 4cded54
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions peps/pep-0757.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,20 @@ Export a Python integer as a digits array::

// Read-only array of unsigned digits.
const void *digits;

// Member used internally, must not be used for other purpose.
Py_uintptr_t _reserved;
} PyLong_DigitArray;

PyAPI_FUNC(int) PyLong_Export(PyObject *obj, PyLong_DigitArray *array);

On CPython 3.14, no memory copy is needed, it's just a thin wrapper to
expose Python int internal digits array.

``PyLong_DigitArray._reserved`` stores a strong reference to the Python
:class:`int` object to make sure that that structure remains valid until
``PyLong_FreeExport()`` is called.


PyLong_Export()
^^^^^^^^^^^^^^^
Expand Down

0 comments on commit 4cded54

Please sign in to comment.