[issue44881] Consider integration of GC_UNTRACK with TRASHCAN
Neil Schemenauer
report at bugs.python.org
Tue Aug 10 18:02:12 EDT 2021
Neil Schemenauer <nas-python at arctrix.com> added the comment:
Extensions that call PyObject_GC_UnTrack before calling Py_TRASHCAN_BEGIN will still work, they will just take a very minor performance hit. I don't think it is worth the trouble to introduce new macros for that reason. Extensions that really care about performance can wrap the call in a Python version ifdef.
There is an issue if someone writes and tests their extension with the new API, i.e. without having the explicit PyObject_GC_UnTrack() call in their dealloc method. If they compile with an older Python, they likely get a crash. If they compile with asserts enable, they would get an assert fail in _PyTrash_thread_deposit_object, i.e.:
_PyObject_ASSERT(op, !_PyObject_GC_IS_TRACKED(op));
I guess that's an argument for new macros.
----------
stage: patch review -> needs patch
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44881>
_______________________________________
More information about the Python-bugs-list
mailing list