[Facundo Batista <facundobati...@gmail.com>]
> I'm seeing that our code increases the reference counting to Py_None,
> and I find this a little strange: isn't Py_None eternal and will never
> die?

Yes, but it's immortal in CPython because its reference count never
falls to 0 (it's created with a reference count of 1 to begin with).
That's the only thing that makes it immortal.


> What's the point of counting its references?

Uniformity and simplicity:  code using a PyObject* increments and
decrements reference counts appropriately with no concern for what
_kind_ of object is being pointed at.  All objects (including None)
are treated exactly the same way for refcount purposes.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to