I would just like to check if a PyObject
that I have is None
. I naively expected that any None
Pyobject *
returned from a fun
You can just compare directly with Py_None
using ==
:
if (obj == Py_None)
From the docs:
Note that the
PyTypeObject
forNone
is not directly exposed in the Python/C API. SinceNone
is a singleton, testing for object identity (using==
in C) is sufficient. There is noPyNone_Check()
function for the same reason.