[Cython] Cython 0.16 issue Windows with Mingw32

Vitja Makarov vitja.makarov at gmail.com
Tue Apr 24 09:45:14 CEST 2012

2012/4/24 Stefan Behnel <stefan_ml at behnel.de>:
> Stefan Behnel, 23.04.2012 20:28:
>> Nathan Dunfield, 23.04.2012 17:58:
>>> I've encountered the following issue with Cython 0.16 on Windows with
>>> using the Mingw32 compiler (I'm using Python 3.2 here, but I don't think
>>> that's the issue):
>>> $ python3 setup.py build -c mingw32
>>> running build
>>> running build_py
>>> running build_ext
>>> skipping 'SnapPy.c' Cython extension (up-to-date)
>>> building 'snappy.SnapPy' extension
>>> c:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Iheaders -Iunix_kit -Iaddl_code -I. -Ipari/pari-2.3.4/include/ -Ipari/pari-2.3.4/include/pari -Ic:\Python32\include -Ic:\Python32\PC -c SnapPy.c -o build\temp.win32-3.2\Release\snappy.o
>>> SnapPy.c: In function `__pyx_f_6snappy_6SnapPy_13Triangulation_build_rep_into_Sn':
>>> SnapPy.c:25187: warning: implicit declaration of function `fg_get_num_orig_gens'
>>> SnapPy.c:25423: warning: implicit declaration of function `candidateSn_is_valid'
>>> SnapPy.c:25435: warning: implicit declaration of function `candidateSn_is_transitive'
>>> SnapPy.c: At top level:
>>> SnapPy.c:76434: error: initializer element is not constant
>>> SnapPy.c:76434: error: (near initialization for `__pyx_CyFunctionType_type.tp_call')
>>> error: command 'gcc' failed with exit status 1
>> Hmm, that line basically just says "PyCFunction_Call", which is a function
>> exported by CPython. I wonder why gcc would consider this "not a constant".
> My guess is that it's a Windows-DLL issue. Maybe symbols exported by
> Windows-DLLs simply aren't "constant". We should be able to fix this by
> indirecting the slot through a static function.

We can also fill it later at type initialization. But since we already have

#define __Pyx_CyFunction_Call PyCFunction_Call

and PyPy version of __Pyx_CyFunction_Call I think it's better to
replace define with static function you mentioned above.


More information about the cython-devel mailing list