Dear mailing list I am trying to compile a program with Cython using the compiler directives and I am running into some trouble. Specifically, I am trying to port a Cython 0.18 program to Cython 0.19 and due to changes how char * and Python str are handled, I need to set the c_string_encoding directive. Unfortunately, this fails for my project and also in the following testcase when I try to do it locally:
cimport cython cdef class TestClass: def foo(self): with cython.c_string_encoding("ascii"): return If I replace the directive with "with cython.boundscheck(True):" the program compiles fine. Also adding "#cython: c_string_encoding=ascii" as the first line of the file works fine. However, adding a decorator '@cython.c_string_encoding("ascii")' to foo also crashes the compiler. Finally, compiling with "-X c_string_encoding=ascii" also works. I was following the documentation provided here http://docs.cython.org/src/reference/compilation.html . The error message that I get is attached at the end. Did I do something wrong or can somebody point me in the right direction? Best regards Hannes Roest Error message: inimalcase.pyx:6:13: Compiler crash in InterpretCompilerDirectives ModuleNode.body = StatListNode(minimalcase.pyx:1:0) StatListNode.stats[1] = StatListNode(minimalcase.pyx:3:5) StatListNode.stats[0] = CClassDefNode(minimalcase.pyx:3:5, as_name = u'TestClass', class_name = u'TestClass', module_name = '', visibility = 'private') CClassDefNode.body = StatListNode(minimalcase.pyx:5:4) StatListNode.stats[0] = DefNode(minimalcase.pyx:5:4, modifiers = [...]/0, name = u'foo', num_required_args = 1, py_wrapper_required = True, reqd_kw_flags_cname = '0') DefNode.body = StatListNode(minimalcase.pyx:6:13) StatListNode.stats[0] = WithStatNode(minimalcase.pyx:6:13) Compiler crash traceback from this point on: File "/home/hr/lib/Cython-0.19.1/Cython/Compiler/Visitor.py", line 168, in _visit return handler_method(obj) File "/home/hr/lib/Cython-0.19.1/Cython/Compiler/ParseTreeTransforms.py", line 1002, in visit_WithStatNode for directive in self.try_to_parse_directives(node.manager) or []: File "/home/hr/lib/Cython-0.19.1/Cython/Compiler/ParseTreeTransforms.py", line 861, in try_to_parse_directives directives.append(self.try_to_parse_directive(optname, args, kwds, node.function.pos)) File "/home/hr/lib/Cython-0.19.1/Cython/Compiler/ParseTreeTransforms.py", line 913, in try_to_parse_directive assert False AssertionError: _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel