
On Wed, Dec 15, 2021 at 02:57:46PM -0800, Guido van Rossum wrote:
Another potential issue is that there may be some applications that take refcounts at face value (perhaps obtained using sys.getrefcount()). These would find that immortal objects have a very large refcount, which might surprise them. But technically a very large refcount is totally valid, and the kinds of objects that we plan to immortalize are all widely shared -- who cares if the refcount for None is 5000 or 1610612736? As long as the refcount of *mortal* objects is the same as it was before, this shouldn't be a problem.
I agree with your reasoning. But can we agree to document the presence and interpretation of the magic bit, so that if anyone actually does care (for whatever reason, good bad or indifferent) they can mask off the immortal bit to get the real ref num? Or maybe even have getrefcount() automatically mask the bit off. If we reserve the bit as the immortal bit, then is there any reason to keep that bit visible when returning refcounts? -- Steve