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
Cythonizing and compiling on macOS with Apple clang version 14.0.3 (clang-1403.0.22.14.1) generates the following
compiler warning for "equality comparison with extraneous parentheses".
clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot $MACOS13SDK -I$VENV_INCLUDE -I$PYTHON311_INCLUDE -c mycode.c -o $BUILD_DIR/mycode.o
mycode.c:5898:28: warning: equality comparison with extraneous parentheses
[-Wparentheses-equality]
if (((__pyx_v_c_mode[0]) == 'f')) {
~~~~~~~~~~~~~~~~~~~~^~~~~~
mycode.c:5898:28: note: remove extraneous parentheses around the comparison to
silence this warning
if (((__pyx_v_c_mode[0]) == 'f')) {
~ ^ ~
mycode.c:5898:28: note: use '=' to turn this equality comparison into an
assignment
if (((__pyx_v_c_mode[0]) == 'f')) {
^~
=
1 warning generated.
Searching mycode.c for if (((__pyx_v_c_mode[0]) == 'f')) { takes me to the following
generated C function.
/* "View.MemoryView":268 * * @cname("__pyx_array_new") * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<< * cdef array result * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. */staticstruct__pyx_array_obj*__pyx_array_new(PyObject*__pyx_v_shape, Py_ssize_t__pyx_v_itemsize, char*__pyx_v_format, char*__pyx_v_c_mode, char*__pyx_v_buf) {
struct__pyx_array_obj*__pyx_v_result=0;
PyObject*__pyx_v_mode=0;
struct__pyx_array_obj*__pyx_r=NULL;
__Pyx_RefNannyDeclarationsPyObject*__pyx_t_1=NULL;
int__pyx_t_2;
PyObject*__pyx_t_3=NULL;
PyObject*__pyx_t_4=NULL;
int__pyx_lineno=0;
constchar*__pyx_filename=NULL;
int__pyx_clineno=0;
__Pyx_RefNannySetupContext("array_cwrapper", 0);
/* "View.MemoryView":270 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): * cdef array result * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<< * * if buf is NULL: */if (((__pyx_v_c_mode[0]) =='f')) {
__Pyx_INCREF(__pyx_n_s_fortran);
__pyx_t_1=__pyx_n_s_fortran;
} else {
__Pyx_INCREF(__pyx_n_s_c);
__pyx_t_1=__pyx_n_s_c;
}
__pyx_v_mode= ((PyObject*)__pyx_t_1);
__pyx_t_1=0;
/* ✂️ */
}
Code to reproduce the behaviour:
I don't have a minimal example, except to say that my code uses Cython memoryviews extensively as function parameters like unsigned int8_t[:, :, ::1] out not None. I build my Cython code with the following setup.py
Describe the bug
Cythonizing and compiling on macOS with Apple clang version 14.0.3 (clang-1403.0.22.14.1) generates the following
compiler warning for "equality comparison with extraneous parentheses".
Searching
mycode.c
forif (((__pyx_v_c_mode[0]) == 'f')) {
takes me to the followinggenerated C function.
Code to reproduce the behaviour:
I don't have a minimal example, except to say that my code uses Cython memoryviews extensively as function parameters like
unsigned int8_t[:, :, ::1] out not None
. I build my Cython code with the followingsetup.py
and then I ran
$ python setup.py build_ext --force --inplace
Expected behaviour
Cython's generated C code should not produce warnings on major compilers under default build setups.
OS
macOS 13.4.1
Python version
CPython 3.11.3
Cython version
3.0.0
Additional context
setuptools 67.7.2
The text was updated successfully, but these errors were encountered: