2008-01-20 10:30:57 +01:00
|
|
|
.. highlightlang:: c
|
|
|
|
|
|
|
|
.. _noneobject:
|
|
|
|
|
|
|
|
The None Object
|
|
|
|
---------------
|
|
|
|
|
|
|
|
.. index:: object: None
|
|
|
|
|
2010-10-06 12:11:56 +02:00
|
|
|
Note that the :c:type:`PyTypeObject` for ``None`` is not directly exposed in the
|
2008-01-20 10:30:57 +01:00
|
|
|
Python/C API. Since ``None`` is a singleton, testing for object identity (using
|
2010-10-06 12:11:56 +02:00
|
|
|
``==`` in C) is sufficient. There is no :c:func:`PyNone_Check` function for the
|
2008-01-20 10:30:57 +01:00
|
|
|
same reason.
|
|
|
|
|
|
|
|
|
2010-10-06 12:11:56 +02:00
|
|
|
.. c:var:: PyObject* Py_None
|
2008-01-20 10:30:57 +01:00
|
|
|
|
|
|
|
The Python ``None`` object, denoting lack of value. This object has no methods.
|
|
|
|
It needs to be treated just like any other object with respect to reference
|
|
|
|
counts.
|
|
|
|
|
|
|
|
|
2010-10-06 12:11:56 +02:00
|
|
|
.. c:macro:: Py_RETURN_NONE
|
2008-01-20 10:30:57 +01:00
|
|
|
|
2010-10-06 12:11:56 +02:00
|
|
|
Properly handle returning :c:data:`Py_None` from within a C function (that is,
|
2008-01-20 10:30:57 +01:00
|
|
|
increment the reference count of None and return it.)
|