[Cython] Accessing the internals of a Python long
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat Aug 23 02:58:52 CEST 2008
> On Aug 2, 2008, at 7:53 PM, Case Vanhorsen wrote:
>
>>cdef extern from "longintrepr.h":
>> cdef struct _longobject:
>> ...
>>def test(temp = long(0)):
>> cdef _longobject *l
>> l = <_longobject *> temp
This is not the way I would recommend going about this.
It's better to use an external extension type. Then
you'll get appropriate type testing instead of assuming
that the object being passes is a long.
--
Greg
More information about the Cython-dev
mailing list