[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

STINNER Victor report at bugs.python.org
Sat Dec 26 05:52:39 EST 2020


STINNER Victor <vstinner at python.org> added the comment:

I checked for ^.*tp_new.*=.*NULL regex in "git log -p" command output. I checked all commits up to May 8 2016, the commit which added:

+    ((PyTypeObject *)v)->tp_new = NULL;

I met "FlagsType.tp_new = NULL;" multiple times since the code moved multiple times.

Apart of the issue in _curses_panel.panel, I didn't see any other removal by mistake. In this issue, the work started in 2019, so I consider that it's ok. No other tp_new=NULL was removed by mistake.

Again, if tp_new=NULL is used, I suggest to write a function test to ensure that it's not possible to instanciate the type.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue1635741>
_______________________________________


More information about the Python-bugs-list mailing list