Message361341
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). |
|
Date |
User |
Action |
Args |
2020-02-04 10:26:35 | vstinner | set | recipients:
+ vstinner |
2020-02-04 10:26:35 | vstinner | set | messageid: <1580811995.2.0.32857559105.issue39543@roundup.psfhosted.org> |
2020-02-04 10:26:35 | vstinner | link | issue39543 messages |
2020-02-04 10:26:35 | vstinner | create | |
|