Is 'x' an instance of a new-style class?
Hrvoje Niksic
hniksic at xemacs.org
Tue Sep 16 09:02:46 EDT 2008
MatthewS <schaefer.mp at gmail.com> writes:
> Thanks Gabriel, the second solution seems to work based on my tests.
> So I have this now this test:
>
> static BOOL IsPythonInstance( PyObject * src )
> {
> {
> // old style classes or instances or new style classes or instances
> if( ( PyInstance_Check( src ) ) || ( PyClass_Check( src ) ) ||
> PyObject_TypeCheck( src, &PyBaseObject_Type) )
> {
> return TRUE;
> }
>
> return FALSE;
> }
> }
I think this will return TRUE on any Python object you pass it.
More information about the Python-list
mailing list