[Python-Dev] Counting references to Py_None
Tim Peters
tim.peters at gmail.com
Sun Mar 20 13:07:47 EDT 2016
More information about the Python-Dev mailing list
Sun Mar 20 13:07:47 EDT 2016
- Previous message (by thread): [Python-Dev] Counting references to Py_None
- Next message (by thread): [Python-Dev] Counting references to Py_None
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Facundo Batista <facundobatista at 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.
- Previous message (by thread): [Python-Dev] Counting references to Py_None
- Next message (by thread): [Python-Dev] Counting references to Py_None
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list