strange error message
Hi cython devs, a strange error message, showing cython internals: $ cat gldraw.pxd ctypedef float vec4[4] ctypedef vec4 mat4[4] $ cat glarea.pyx cimport gldraw cdef struct Data: gldraw.mat4 matrix cdef Data data cdef void sync(): data.changed = True # <- this wrong line produces the error $ cython glarea.pyx Error compiling Cython file: ------------------------------------------------------------ ... void PyTuple_SET_ITEM(object p, Py_ssize_t pos, object o) void PyList_SET_ITEM(object p, Py_ssize_t pos, object o) @cname("__Pyx_carray_to_py_vec4") cdef inline list __Pyx_carray_to_py_vec4(vec4 *v, Py_ssize_t length): ^ ------------------------------------------------------------ carray.to_py:112:41: 'vec4' is not a type identifier Error compiling Cython file: ------------------------------------------------------------ ... PyList_SET_ITEM(l, i, value) return l @cname("__Pyx_carray_to_tuple_vec4") cdef inline tuple __Pyx_carray_to_tuple_vec4(vec4 *v, Py_ssize_t length): ^ ------------------------------------------------------------ carray.to_py:124:45: 'vec4' is not a type identifier $ cython --version Cython version 0.23.3 Best regards, B.C.
Hi, not a cython dev, but I believe I hit the very same problem (I'm going on vacation now, full report in January). You may fix the compilation error by adding the following unused import:
from gldraw import vec4
Please tell me if it works for you, Baptiste Le 26/12/2015 11:59, B. Clausius a écrit :
Hi cython devs,
a strange error message, showing cython internals:
$ cat gldraw.pxd ctypedef float vec4[4] ctypedef vec4 mat4[4]
$ cat glarea.pyx cimport gldraw
cdef struct Data: gldraw.mat4 matrix
cdef Data data
cdef void sync(): data.changed = True # <- this wrong line produces the error
$ cython glarea.pyx
Error compiling Cython file: ------------------------------------------------------------ ... void PyTuple_SET_ITEM(object p, Py_ssize_t pos, object o) void PyList_SET_ITEM(object p, Py_ssize_t pos, object o)
@cname("__Pyx_carray_to_py_vec4") cdef inline list __Pyx_carray_to_py_vec4(vec4 *v, Py_ssize_t length): ^ ------------------------------------------------------------
carray.to_py:112:41: 'vec4' is not a type identifier
Error compiling Cython file: ------------------------------------------------------------ ... PyList_SET_ITEM(l, i, value) return l
@cname("__Pyx_carray_to_tuple_vec4") cdef inline tuple __Pyx_carray_to_tuple_vec4(vec4 *v, Py_ssize_t length): ^ ------------------------------------------------------------
carray.to_py:124:45: 'vec4' is not a type identifier
$ cython --version Cython version 0.23.3
Best regards,
B.C.
Le 28/12/2015 17:12, Baptiste Carvello a écrit :
Hi,
not a cython dev, but I believe I hit the very same problem (I'm going on vacation now, full report in January).
You may fix the compilation error by adding the following unused import:
from gldraw import vec4
sorry, that's a cimport, i.e.
from gldraw cimport vec4
Please tell me if it works for you,
Baptiste
On Mon, Dec 28, 2015 at 1:15 PM, Baptiste Carvello <devel@baptiste-carvello.net> wrote:
Le 28/12/2015 17:12, Baptiste Carvello a écrit :
Hi,
not a cython dev, but I believe I hit the very same problem (I'm going on vacation now, full report in January).
You may fix the compilation error by adding the following unused import:
from gldraw import vec4
sorry, that's a cimport, i.e.
from gldraw cimport vec4
+1, that's the solution. We should make the error better...
Am 31.12.2015 um 01:00 schrieb Robert Bradshaw:
On Mon, Dec 28, 2015 at 1:15 PM, Baptiste Carvello <devel@baptiste-carvello.net> wrote:
Le 28/12/2015 17:12, Baptiste Carvello a écrit :
Hi,
not a cython dev, but I believe I hit the very same problem (I'm going on vacation now, full report in January).
You may fix the compilation error by adding the following unused import:
from gldraw import vec4
sorry, that's a cimport, i.e.
from gldraw cimport vec4
+1, that's the solution. We should make the error better...
I added that line and replaced "cdef void sync():" by "cpdef void sync():" to be able to test it: $ cat glarea.pyx cimport gldraw from gldraw cimport vec4 cdef struct Data: gldraw.mat4 matrix cdef Data data cpdef void sync(): data.changed = True # <- this wrong line produces the error It compiles without errors, but i get a exception at runtime (not surprised): $ python3 Python 3.4.3+ (default, Oct 14 2015, 16:03:50) [GCC 5.2.1 20151010] on linux Type "help", "copyright", "credits" or "license" for more information.
import glarea glarea.sync() Exception ignored in: 'glarea.sync' AttributeError: 'dict' object has no attribute 'changed'
This would be ok for me, but i wonder if cython should recognize this at compile time. The code tries to assign a new attribute to a cdef struct and that will always fail, or am I wrong?
Le 31/12/2015 01:00, Robert Bradshaw a écrit :
On Mon, Dec 28, 2015 at 1:15 PM, Baptiste Carvello <devel@baptiste-carvello.net> wrote:
Le 28/12/2015 17:12, Baptiste Carvello a écrit :
Hi,
not a cython dev, but I believe I hit the very same problem (I'm going on vacation now, full report in January).
You may fix the compilation error by adding the following unused import:
from gldraw import vec4
sorry, that's a cimport, i.e.
from gldraw cimport vec4
+1, that's the solution. We should make the error better...
Hi, back from vacation :-) I would like to know if this behaviour (not taking namespace into account in generated Cython code) is a deliberate design choice, or a wart that should be fixed if possible. In the latter case, I'll open an issue about it. FYI, the behaviour was newly introduced in 2014 when the Python<->C conversion code was rewritten (rev. fd565517). Code like the OP's worked fine before that. Baptiste
participants (3)
-
B. Clausius -
Baptiste Carvello -
Robert Bradshaw