[issue46449] Deep-freezed modules create inconsistency in sys.gettotalrefcount() (_Py_Reftotal)

Guido van Rossum report at bugs.python.org
Fri Jan 21 00:01:26 EST 2022


Guido van Rossum <guido at 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.

This reminds me, since https://github.com/python/cpython/pull/30715 (which I merged yesterday) the deep-frozen objects also reference the small ints directly, as well as the singleton for b"". Is this even safe across Py_Finalize()/Py_Initialize()? If not, we'll need to roll that back as well.

----------

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


More information about the Python-bugs-list mailing list