On Feb 16, 2009, at 8:26 PM, Ondrej Certik wrote:
> Currently I am using the following code and everything works for me:
[...]
> But it uses the PY_NEW macro:
>
> #define PY_NEW(zzz_type) \
> (((PyTypeObject*)(zzz_type))->tp_new((PyTypeObject*)(zzz_type),
> global_empty_tuple, NULL))
>
> and global_empty_tuple() that I had to initialize, etc. I copied this
> from Sage. Is there some better way to do the above, so that I don't
> have to include the special macro above and the corresponding .h and
> .c files in my project?
How about
cdef extern from *:
ctypedef struct RichPyTypeObject "PyTypeObject":
object tp_new(object, object, PyObject*)
cdef inline PY_NEW(T):
return (<RichPyTypeObject*>x).tp_new(T, (), NULL)
- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev