Commit 8dbd550c authored by Robert Bradshaw's avatar Robert Bradshaw

Fix #156, missing self in cpdef method.

--HG--
rename : tests/bugs/missing_self_in_cpdef_method_T156.pyx => tests/errors/missing_self_in_cpdef_method_T156.pyx
parent a686f030
...@@ -1336,7 +1336,7 @@ class CFuncDefNode(FuncDefNode): ...@@ -1336,7 +1336,7 @@ class CFuncDefNode(FuncDefNode):
self.entry.inline_func_in_pxd = self.inline_in_pxd self.entry.inline_func_in_pxd = self.inline_in_pxd
self.return_type = type.return_type self.return_type = type.return_type
if self.overridable: if self.overridable and len(self.args) > 0:
import ExprNodes import ExprNodes
py_func_body = self.call_self_node(is_module_scope = env.is_module_scope) py_func_body = self.call_self_node(is_module_scope = env.is_module_scope)
self.py_func = DefNode(pos = self.pos, self.py_func = DefNode(pos = self.pos,
...@@ -1393,7 +1393,7 @@ class CFuncDefNode(FuncDefNode): ...@@ -1393,7 +1393,7 @@ class CFuncDefNode(FuncDefNode):
def analyse_expressions(self, env): def analyse_expressions(self, env):
self.analyse_default_values(env) self.analyse_default_values(env)
if self.overridable: if self.py_func is not None:
self.py_func.analyse_expressions(env) self.py_func.analyse_expressions(env)
def generate_function_header(self, code, with_pymethdef, with_opt_args = 1, with_dispatch = 1, cname = None): def generate_function_header(self, code, with_pymethdef, with_opt_args = 1, with_dispatch = 1, cname = None):
......
...@@ -3,3 +3,6 @@ cdef class B: ...@@ -3,3 +3,6 @@ cdef class B:
cpdef b(): cpdef b():
pass pass
_ERRORS = u"""
:3:10: C method has no self argument
"""
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment