STINNER Victor <vstin...@python.org> added the comment:

> Hm, the deep-frozen objects are statically initialized with a very large 
> refcount that isn't accounted for (they are intended to be immortal). It 
> seems that Py_Finalize() somehow decrefs those objects. I guess this means we 
> need some kind of flag indicating certain objects are immortal (Eric has 
> proposed several schemes), then we could just mark these objects as immortal.

The problem is only _Py_RefTotal. Maybe frozen_only_do_patchups() should 
increment _Py_RefTotal when Python it build with Py_DEBUG macro defined, so it 
can be safely decremented in Py_Finalize()?

Adding a flag in PyObject/PyTypeObject and modifying Py_DECREF() sounds more 
controversial. I suggest to do that later ;-) (I am not convinced that it's the 
best approach.) I would suggest to write a PEP for immortal objects.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46449>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to