robertwb / issues-import-test

0 stars 0 forks source link

Bug accessing internals of Python long #73

Closed robertwb closed 7 years ago

robertwb commented 7 years ago

Reported by casevh on 5 Aug 2008 14:57 UTC I am trying to access the internal structure of a Python long. The code fragment below works when I use Pyrex 0.9.8.4 but generates a compile error when using Cython 0.9.8.

The code:

 cdef extern from "Python.h":
    ctypedef struct PyTypeObject:
        pass
    ctypedef struct PyObject:
        Py_ssize_t ob_refcnt
        PyTypeObject * ob_type
cdef extern from "longintrepr.h":
    cdef struct _longobject:
        int ob_refcnt
        PyTypeObject * ob_type
        int ob_size
        unsigned int * ob_digit
def test(temp = long(0)):
    cdef _longobject *l
    l = <_longobject *> temp
    print sizeof(l.ob_size)
    print sizeof(l.ob_digit[0])

Migrated-From: http://trac.cython.org/ticket/41
robertwb commented 7 years ago

Modified by robertwb on 9 Aug 2008 07:40 UTC

robertwb commented 7 years ago

Comment by robertwb on 16 Aug 2008 11:11 UTC This is due to #51

robertwb commented 7 years ago

Comment by robertwb on 16 Aug 2008 23:35 UTC See http://hg.cython.org/cython-devel/rev/9d489341f992

robertwb commented 7 years ago

Modified by robertwb on 19 Aug 2008 04:36 UTC