It does seem a bit silly to actually be tracking that refcount :-)
Not that silly. It can easily help in C extensions to detect wrong DECREF calls:
import ctypes non = ctypes.c_long.from_address(id(None)) non.value = 10
Fatal Python error: none_dealloc: deallocating None Python runtime state: finalizing (tstate=0x000055c66cf263f0)
Current thread 0x00007f4afa383740 (most recent call first): <no Python frame> [1] 635685 abort (core dumped) python On Thu, 16 Dec 2021 at 00:31, Christopher Barker <pythonchb@gmail.com> wrote:
On Wed, Dec 15, 2021 at 3:00 PM Guido van Rossum <guido@python.org> wrote:
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.
indeed:
$ python -c "import sys; print(sys.getrefcount(None))" 4110
and a newly started iPython session:
In [2]: sys.getrefcount(None) Out[2]: 28491
It does seem a bit silly to actually be tracking that refcount :-)
-CHB
-- Christopher Barker, PhD (Chris)
Python Language Consulting - Teaching - Scientific Software Development - Desktop GUI and Web Development - wxPython, numpy, scipy, Cython _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/36N4I4CJ... Code of Conduct: http://python.org/psf/codeofconduct/