Hi all - I get the following compiler crash from cython 0.21.1 (from pip) when compiling a C++ module with debugging. It's fine without the --gdb option.
[1/3] Compiling Cython CXX source for [project]... FAILED: cd [project_build] && cython --cplus -I [project_src] -2 --gdb --output-file [project_build]/[project].cxx [project_src]/[project].pyx Error compiling Cython file: ------------------------------------------------------------ ... def merge(self): cdef cpp_string ofnametmp = self.ofname + ".tmp" merge[cpp_vector[cpp_string]](self.sources, ofnametmp.c_str()) ^ ------------------------------------------------------------ [project_src]/[project].pyx:241:28: Compiler crash in DebugTransform ModuleNode.body = StatListNode([project].pyx:1:0) StatListNode.stats[12] = StatListNode([project].pyx:227:5) StatListNode.stats[0] = CompilerDirectivesNode([project].pyx:227:5) CompilerDirectivesNode.body = StatListNode([project].pyx:227:5) StatListNode.stats[0] = CClassDefNode([project].pyx:227:5, as_name = u'Merge', class_name = u'Merge', decorators = [...]/0, module_name = u'', visibility = u'private') CClassDefNode.body = StatListNode([project].pyx:228:4) StatListNode.stats[1] = DefNode([project].pyx:238:4, modifiers = [...]/0, module_name = u'[Project]', name = u'merge', num_required_args = 1, py_wrapper_required = True, qualname = u'Merge.merge', reqd_kw_flags_cname = '0', used = True) DefNode.body = StatListNode([project].pyx:239:8) StatListNode.stats[0] = ExprStatNode([project].pyx:240:41) ExprStatNode.expr = SimpleCallNode([project].pyx:240:41, analysed = True, is_temp = 1, use_managed_ref = True) SimpleCallNode.function = IndexNode([project].pyx:240:17, is_called = 1, is_subscript = True, result_is_used = True, type_indices = [...]/1, use_managed_ref = True) IndexNode.index = IndexNode([project].pyx:240:28, is_subscript = True, result_is_used = True, use_managed_ref = True) IndexNode.base = NameNode([project].pyx:240:28, cf_maybe_null = True, is_name = True, name = u'cpp_vector', result_is_used = True, use_managed_ref = True) Compiler crash traceback from this point on: File "Cython/Compiler/Visitor.py", line 173, in Cython.Compiler.Visitor.TreeVisitor._visit (cython/Cython/Compiler/Visitor.c:4449) return handler_method(obj) File "python2.7/site-packages/Cython/Compiler/ParseTreeTransforms.py", line 2937, in visit_NameNode node.type.is_cfunction and AttributeError: 'NoneType' object has no attribute 'is_cfunction' In my pyx file, cpp_vector and cpp_string are as follows: from libcpp.vector cimport vector as cpp_vector from libcpp.string cimport string as cpp_string and merge (my C++ function, though I've also got the python def above of a method with the same name) has this signature: cdef void merge[T](const T&, const char *) except+ I've managed to fix it by turning line 2937 in ParseTreeTransforms.py from 2937: node.type.is_cfunction and to 2937: getattr(node.type, 'is_cfunction', False) and which seems to do the trick. I did a quick google to see if anybody else had this issue, but it seems like a fresh bug. Not sure if this is the correct solution though, or whether I've simply buried an underlying issue.
_______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel