Jeroen Demeyer
2015-02-25 13:40:01 UTC
Is there any way in Cython to access the Python "long" type?
Essentially, what I'm trying to do is
cdef extern from "longintrepr.h":
cdef long PyLong_SHIFT
ctypedef unsigned int digit
ctypedef class __builtin__.long [object PyLongObject]:
cdef digit* digits
cdef extern from "Python.h":
cdef _PyObject_NewVar(type t, Py_ssize_t size)
def foo(s):
cdef long L = _PyObject_NewVar(long, s)
The problem is that Cython always thinks that "long" means C long, while
I really want Python long. Is there any solution for this?
Essentially, what I'm trying to do is
cdef extern from "longintrepr.h":
cdef long PyLong_SHIFT
ctypedef unsigned int digit
ctypedef class __builtin__.long [object PyLongObject]:
cdef digit* digits
cdef extern from "Python.h":
cdef _PyObject_NewVar(type t, Py_ssize_t size)
def foo(s):
cdef long L = _PyObject_NewVar(long, s)
The problem is that Cython always thinks that "long" means C long, while
I really want Python long. Is there any solution for this?
--
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.