Pyrex - Cannot convert Python object argument to type 'void (*)'
Duncan Booth
duncan at NOSPAMrcp.co.uk
Mon May 12 04:34:49 EDT 2003
"Haris Bogdanovic" <haris at email.hinet.hr> wrote in
news:b9joug$a7e1$1 at as201.hinet.hr:
> I have function:
> def setInputHostApiSpecificStreamInfo(self, void *streamInfo):
> and I get error:
> Cannot convert Python object argument to type 'void (*)'
>
> I don't understand what's wrong.
>
Pyrex can perform automatic conversion from certain Python types to certain
C types, so you can specify arguments as 'int' and pass integers, or 'char
*' and pass strings. The actual values passed to the function when you call
it from Python are Python objects, and the conversion code is included in
the compiled function.
There aren't any automatic conversions from a Python object to 'void*'.
Perhaps you meant to use cdef here instead of def. A cdef function is not
callable from Python, but it can take arguments of any C type.
--
Duncan Booth duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
More information about the Python-list
mailing list