[Cython] Compilation failes if a class member is named "INFINITY"

Michael supermihi at posteo.de
Fri Jan 30 10:49:50 CET 2015


Hello,

if I try to compile the following minimal example:

cdef class Test:

    cdef readonly int INFINITY

cython does not complain but gcc refuses with an error message:
In file included from /usr/include/math.h:38:0,
                 from /usr/include/python2.7/pyport.h:325,
                 from /usr/include/python2.7/Python.h:58,
                 from testinf.c:16:
testinf.c:433:7: error: field '__builtin_inff' declared as a function
   int INFINITY;
       ^
testinf.c: In function '__pyx_pf_7testinf_4Test_8INFINITY___get__':
testinf.c:569:50: error: expected identifier before '(' token
   __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->INFINITY); if
(unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10;
__pyx_clineno = __LINE__; goto __pyx_L1_error;}
                                                  ^
Apparently the name "INFINITY" is handled wrongly; any other variable
name seems to be fine.

Regards,
Michael



More information about the cython-devel mailing list