[Python-Dev] Re: my plans for subinterpreters (and a per-interpreter GIL)

2021年12月16日 09:39:33 -0800

On Thu, Dec 16, 2021 at 2:48 AM Petr Viktorin <[email protected]> wrote:
> But does the sign bit need to stay intact, and do we actually need to
> rely on the immortal bit to always be set for immortal objects?
> If the refcount rolls over to zero, an immortal object's dealloc could
> bump it back and give itself another few minutes.
> Allowing such rollover would mean having to deal with negative
> refcounts, but that might be acceptable.
FWIW, my original attempt at immortal objects (quite a while ago) used
the sign bit as the marker (negative refcount meant immortal).
However, this broke GC and Py_DECREF() and getting those to work right
was a pain. It also made a few things harder to debug because a
negative refcount no longer necessarily indicated something had gone
wrong. In the end I switched to a really high bit as the marker and
it was all much simpler.
-eric
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/LJ2WVSUPJY2X3VVJW4EEEFNOBRJ7AB4V/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to