A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-March/143570.html below:

[Python-Dev] Counting references to Py_None

[Python-Dev] Counting references to Py_None [Python-Dev] Counting references to Py_NoneTim Peters tim.peters at gmail.com
Sun Mar 20 13:07:47 EDT 2016
[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.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4