FILE object in Python3.0 extension modules
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Fri May 29 22:00:19 EDT 2009
En Fri, 29 May 2009 08:48:26 -0300, Benjamin Peterson
<benjamin at python.org> escribió:
> Joachim Dahl <dahl.joachim <at> gmail.com> writes:
>>
>> How do I perform type checking for such an object in the extension
>> module,
>> and how do I extract a FILE * object from it? I browsed the C API
>> documentation, but
>> couldn't find an answer.
>
> You use PyObject_IsInstance to test if the object is an instance of
> io.IOBase.
But you have to import the io module first, don't you? That's not usually
necesary for most built in types -- e.g. PyFloat_Check just checks for a
float object.
--
Gabriel Genellina
More information about the Python-list
mailing list