You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In version 1474:7f1b96cad687, the following code crashes the compiler:
cdef class A:
cpdef foo():
pass
Note that foo() should be foo(self). If you replace the cpdef with either def or cdef, the error is correctly reported and cython works fine. With the above code segment, however, we get the following error in addition to the error report:
Error converting Pyrex file to C:
------------------------------------------------------------
...
cdef class A:
cpdef foo():
^
------------------------------------------------------------
/home/hoytak/workspace/cython-tests/paramstruct.pyx:2:10: C method has no self argument
Traceback (most recent call last):
File "/home/hoytak/sysroot/bin/cython", line 8, in <module>
main(command_line = 1)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Main.py", line 728, in main
result = compile(sources, options)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Main.py", line 705, in compile
return compile_multiple(source, options)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Main.py", line 675, in compile_multiple
result = run_pipeline(source, options)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Main.py", line 537, in run_pipeline
err, enddata = context.run_pipeline(pipeline, source)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Main.py", line 196, in run_pipeline
data = phase(data)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/ParseTreeTransforms.py", line 595, in __call__
return super(AnalyseDeclarationsTransform, self).__call__(root)
File "Visitor.py", line 177, in Cython.Compiler.Visitor.CythonTransform.__call__ (/home/hoytak/sysroot/src/cython/Cython/Compiler/Visitor.c:2365)
File "Visitor.py", line 163, in Cython.Compiler.Visitor.VisitorTransform.__call__ (/home/hoytak/sysroot/src/cython/Cython/Compiler/Visitor.c:2109)
File "Visitor.py", line 43, in Cython.Compiler.Visitor.BasicVisitor.visit (/home/hoytak/sysroot/src/cython/Cython/Compiler/Visitor.c:955)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/ParseTreeTransforms.py", line 598, in visit_ModuleNode
node.analyse_declarations(self.env_stack[ File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/ModuleNode.py", line 58, in analyse_declarations
self.body.analyse_declarations(env)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Nodes.py", line 313, in analyse_declarations
stat.analyse_declarations(env)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Nodes.py", line 2553, in analyse_declarations
self.body.analyse_declarations(scope)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Nodes.py", line 313, in analyse_declarations
stat.analyse_declarations(env)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Nodes.py", line 1262, in analyse_declarations
py_func_body = self.call_self_node(is_module_scope = env.is_module_scope)
File "/home/hoytak/sysroot/lib/python2.5/site-packages/Cython/Compiler/Nodes.py", line 1291, in call_self_node
self_arg = ExprNodes.NameNode(self.pos, name=arg_names[0](-1])
))
IndexError: list index out of range
Hello,
In version 1474:7f1b96cad687, the following code crashes the compiler:
Note that foo() should be foo(self). If you replace the cpdef with either def or cdef, the error is correctly reported and cython works fine. With the above code segment, however, we get the following error in addition to the error report:
Thanks!
--Hoyt
Migrated from http://trac.cython.org/ticket/156
The text was updated successfully, but these errors were encountered: