cpython/Doc/c-api/none.rst

29 lines
697 B
ReStructuredText
Raw Normal View History

.. highlightlang:: c
.. _noneobject:
The ``None`` Object
-------------------
.. index:: object: None
2012-01-14 11:42:02 -04:00
Note that the :c:type:`PyTypeObject` for ``None`` is not directly exposed in the
Python/C API. Since ``None`` is a singleton, testing for object identity (using
2012-01-14 11:42:02 -04:00
``==`` in C) is sufficient. There is no :c:func:`PyNone_Check` function for the
same reason.
2012-01-14 11:42:02 -04:00
.. c:var:: PyObject* Py_None
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.
2012-01-14 11:42:02 -04:00
.. c:macro:: Py_RETURN_NONE
2012-01-14 11:42:02 -04:00
Properly handle returning :c:data:`Py_None` from within a C function.
.. versionadded:: 2.4