writing extension -- custom type validation

Alex Martelli aleaxit at yahoo.com
Mon May 28 05:14:35 EDT 2001


"Eric Hagemann" <ehagemann at home.com> wrote in message
news:TniQ6.31542$G5.6615112 at news1.rdc1.md.home.com...
> I am making a new data type in an extension module.
>
> Is there as way to detect  / check for a custom type (of the type I am
> creating) from a PyObject ?

Of course.  You normally define an appropriate macro:

#define PyPloppy_Check(v) (((PyObject*)v)->ob_type == &PyPloppy_Type)


Alex







More information about the Python-list mailing list