cimport breaks in the presence of non-python return types

12 views
Skip to first unread message

Claudio Freire

unread,
Dec 2, 2016, 6:22:15 PM12/2/16
to cython-users
This is an interesting bug, I believe.

Tested with 0.23.5 and 0.25.1

When cimporting some type, the presence (used or not) of a ccall function that returns a non-pyobject makes the compiler generate broken C:

Try this with the attached sources:

>>> import pyximport ; pyximport.install(pyimport = True)
(<pyximport.pyximport.PyImporter object at 0x7fae1e473650>, <pyximport.pyximport.PyxImporter object at 0x7fae1846e190>)
>>> import cimptest2
/home/claudiofreire/.pyxbld/temp.linux-x86_64-2.7/pyrex/cimptest2.c:969:18: warning: ‘__Pyx_CFunc_double____double___to_py’ defined but not used [-Wunused-function]
 static PyObject *__Pyx_CFunc_double____double___to_py(double (*__pyx_v_f)(double)) {
                  ^
>>>

Comment out the ccall in cimptest.py, and you get success:

>>> import pyximport ; pyximport.install(pyimport = True)
(<pyximport.pyximport.PyImporter object at 0x7fd0813d1650>, <pyximport.pyximport.PyxImporter object at 0x7fd07b3cc190>)
>>> import cimptest2
>>>



cimptest.pxd
cimptest.py
cimptest2.pxd
cimptest2.py
Reply all
Reply to author
Forward
0 new messages