[Cython] Sage build problem
Stefan Behnel
stefan_ml at behnel.de
Fri Jan 31 12:55:13 CET 2014
Hi,
There's some kind of C++ enum issue in the Sage build.
Generated code in sage/libs/ppl.cpp:
"""
static PyObject *__pyx_pf_4sage_4libs_3ppl_11MIP_Problem_30solve(
struct __pyx_obj_4sage_4libs_3ppl_MIP_Problem *__pyx_v_self) {
enum Parma_Polyhedra_Library::PPL_MIP_Problem_Status __pyx_v_tmp;
"""
gcc error:
"""
sage/libs/ppl.cpp: In function 'PyObject*
__pyx_pf_4sage_4libs_3ppl_11MIP_Problem_30solve(__pyx_obj_4sage_4libs_3ppl_MIP_Problem*)':
sage/libs/ppl.cpp:5514:33: error: 'PPL_MIP_Problem_Status' in namespace
'Parma_Polyhedra_Library' does not name a type
sage/libs/ppl.cpp:5514:67: error: invalid type in declaration before ';' token
"""
The type of "tmp" seems to be inferred. That might be a hint that it could
be a problem in Cython.
The Cython code in question is also a bit funny:
sage/libs/ppl.pyx:1076
"""
sig_on()
try:
tmp = self.thisptr.solve() # <<<<<<<<<<<<<<
finally:
sig_off()
"""
The try-finally is useless here, since the call to solve() cannot raise
Python exceptions. The new try-finally code generation shows this clearly,
it does not generate an exception handling block. The idea might have been
that it could raise C++ exceptions, but they don't seem to be declared, so
Cython won't do anything about them.
Might be a hint that Cython could do more to make C++ exception handling
safer by default.
Stefan
More information about the cython-devel
mailing list