This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2020-02-04.10:26:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580811995.2.0.32857559105.issue39543@roundup.psfhosted.org>
In-reply-to
Content
There are different problems.

_Py_Dealloc() calls _Py_ForgetReference() and requires access to PyTypeObjects structure fields to call Py_TYPE(op)->tp_dealloc().

_Py_ForgetReference() is a function and so has no issuse with the limited API (it's not a macro nor an inline function).

_Py_NewReference():

* _Py_NewReference() access _Py_tracemalloc_config, _Py_RefTotal and calls _Py_AddToAllObjects()
* PyObject_INIT() and PyObject_INIT_VAR() inline functions call _Py_NewReference()

I'm not sure that it's really more efficient than _Py_NewReference() and _Py_Dealloc() are macros/inline functions. Moreover, it causes issues with the limited API and it leaks many implementation details in the API.

I may be better to convert PyObject_INIT() and PyObject_INIT_VAR() to aliases to public opaque PyObject_Init() and PyObject_InitVar(), and convert _Py_NewReference() and _Py_Dealloc() to opaque functions (from the API point of view).
History
Date User Action Args
2020-02-04 10:26:35vstinnersetrecipients: + vstinner
2020-02-04 10:26:35vstinnersetmessageid: <1580811995.2.0.32857559105.issue39543@roundup.psfhosted.org>
2020-02-04 10:26:35vstinnerlinkissue39543 messages
2020-02-04 10:26:35vstinnercreate