RE: What is "None" in C module

Hammond, Mark (MHammond@jm.cmutual.com.au)
Sun, 09 Apr 95 11:18:00 PDT

>PyObject * obj1, * obj2;
>if (!PyArg_Parse(args, "(OO)", &obj1, &obj2))
> return NULL;
>if (obj2 == Py_None) // Doesn't work
>if (PyObject_Compare(obj2, Py_None) // Doesn't work either
>
>Should this work?

Certainly should. Although the new variable argument list often makes this
unnecessary. eg, it could be written:
PyObject * obj1, * obj2=NULL;
if (!PyArg_ParseTuple(args, "O|O", &obj1, &obj2))
return NULL;
if (obj2 == NULL): # ob2 not passed.

But sometimes your original is needed, and should work.

Mark.