You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
By inspecting the generated .c/.cpp file, I found an intermediate variable of type char * is created to hold the return value of type const char *, causing compiler warnings (or errors with stricter compiler warning checks like -Werror).
and the reason is __pyx_t_1 is declared as char *, not const char *, so in a production environment with more sophisticated build system, it's turned to an error:
...
cupy/core/dlpack.cpp:4298:32: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
__pyx_t_4 = PyCapsule_GetName(__pyx_v_dltensor); if (unlikely(__pyx_t_4 == ((char *)NULL) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L1_error)
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
error: command 'gcc' failed with exit status 1
making any functions returning const char * not usable in Cython.
Expected behavior
It should just work by respecting the constness if declared in a cdef variable. Currently I don't even know how to work around it after scratching my head for a long time, which is rare to me...
Environment (please complete the following information):
OS: Linux
Python version 3.7.8
Cython version 0.29.21
Additional context
None
The text was updated successfully, but these errors were encountered:
I suspect this has been very recently fixed in #3940 and it probably just needs backporting. I'll leave this open as a reminder to backport that patch to 0.29.x
Describe the bug
By inspecting the generated
.c
/.cpp
file, I found an intermediate variable of typechar *
is created to hold the return value of typeconst char *
, causing compiler warnings (or errors with stricter compiler warning checks like-Werror
).To Reproduce
Code to reproduce the behaviour:
With a simple
cythonize
a warning is raised:and the reason is
__pyx_t_1
is declared aschar *
, notconst char *
, so in a production environment with more sophisticated build system, it's turned to an error:making any functions returning
const char *
not usable in Cython.Expected behavior
It should just work by respecting the constness if declared in a
cdef
variable. Currently I don't even know how to work around it after scratching my head for a long time, which is rare to me...Environment (please complete the following information):
Additional context
None
The text was updated successfully, but these errors were encountered: