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

Michael supermihi at posteo.de
Thu Feb 5 14:26:11 CET 2015


Am 05.02.2015 um 12:30 schrieb Greg Ewing:
> Stefan Behnel wrote:
>> Python extension types are just structs at the C level, and struct member
>> names cannot be mangled.
> 
> Well, in principle it *could* mangle the names in
> structs that aren't declared "cdef extern". I didn't
> do that in Pyrex because it didn't seem necessary;
> I hadn't anticipated problems like collision with
> macros.
> 
> It's probably too late to change it now, since it
> would break existing code that interoperates with
> foreign code.
> 
To me, that sounds like a too complicated solution for a marginal
problem. It's a bit odd that you can't use special names like INFINITY
for cdef class members, but on the other hand, I think that's a
reasonable restriction since you are generating C code, and in C you
can't name a struct member INFINITY either (at least with gcc).


More information about the cython-devel mailing list