Cython has moved to github.

cython-devel

view tests/compile/pylong.pyx @ 1064:9d489341f992

sizeof() works on cdef attributes and cimported types
author Robert Bradshaw <robertwb@math.washington.edu>
date Sat Aug 16 16:30:15 2008 -0700 (3 years ago)
parents
children cad371ab9fb7
line source
1 cdef extern from "Python.h":
2 ctypedef struct PyTypeObject:
3 pass
5 ctypedef struct PyObject:
6 Py_ssize_t ob_refcnt
7 PyTypeObject *ob_type
9 cdef extern from "longintrepr.h":
10 cdef struct _longobject:
11 int ob_refcnt
12 PyTypeObject *ob_type
13 int ob_size
14 unsigned int *ob_digit
16 def test(temp = long(0)):
17 cdef _longobject *l
18 l = <_longobject *> temp
19 print sizeof(l.ob_size)
20 print sizeof(l.ob_digit[0])