diff --git a/peps/pep-0757.rst b/peps/pep-0757.rst index f19c91b4005..95f9ad205b0 100644 --- a/peps/pep-0757.rst +++ b/peps/pep-0757.rst @@ -100,6 +100,9 @@ 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); @@ -107,6 +110,10 @@ Export a Python integer as a digits 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() ^^^^^^^^^^^^^^^