C api question and determining PyObject type

lallous lallous at lgwm.org
Mon Nov 16 05:03:27 EST 2009


Hello

I have an a class defined as:

    class __object(object):
        pass

Now, I call a C function that takes a PyObject* and checks its type:

if (PyString_Check(obj)) ...
if (PySequence_Check(obj)) ....

Before doing the check, I print the passed object with PyObject_Str() and 
get:

passed object: <__main__.__object object at 0x040E4050>

However, the C code returns true on the:
if (PySequence_Check(obj)) ....


Why? That is not a sequence?

Please advise.

--
Elias 




More information about the Python-list mailing list