[Cython] Question on "numpy_common.pxi" in NumPy tests
Stefan Behnel
stefan_ml at behnel.de
Wed Mar 28 08:49:21 CEST 2012
Lisandro Dalcin, 27.03.2012 21:34:
> On 27 March 2012 17:20, Stefan Behnel wrote:
>> the NumPy related tests use a file "numpy_common.pxi" that contains this
>> useless code:
>>
>> """
>> cdef extern from *:
>> bint FALSE "0"
>> void import_array()
>> void import_umath()
>>
>> if FALSE:
>> import_array()
>> import_umath()
>> """
>>
>> Does this serve any purpose? It currently leads to build failures of the
>> tests in C++ mode because the "import_umath()" call seems to inline code
>> with a bare "return" statement, which is not allowed in the module init
>> function (which returns a reference to the module).
>>
>> Is there any reason why this can't just die?
>
> Oh! long long ago Cython testsuite was able to run without a single C
> compiler warning... That numpy common file was a hack to silent
> "defined but not used" warnings about the import array/umath functions
> defined in NumPy headers.
Ok - in that case, it should be enough to move the import calls into a cdef
function body and "avoiding" to call that.
And a comment in the file would be helpful ...
Stefan
More information about the cython-devel
mailing list