From: Robert Bradshaw Date: Sun, 15 Mar 2009 05:45:55 +0000 (-0700) Subject: Fix #156, missing self in cpdef method. X-Git-Tag: 0.11.1.alpha~59 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8dbd550c002c81ba032f9c7017b6b9f7e3ec0781;p=cython.git 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 --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 45920b4f..64572fb4 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1336,7 +1336,7 @@ class CFuncDefNode(FuncDefNode): self.entry.inline_func_in_pxd = self.inline_in_pxd self.return_type = type.return_type - if self.overridable: + if self.overridable and len(self.args) > 0: import ExprNodes py_func_body = self.call_self_node(is_module_scope = env.is_module_scope) self.py_func = DefNode(pos = self.pos, @@ -1393,7 +1393,7 @@ class CFuncDefNode(FuncDefNode): def analyse_expressions(self, env): self.analyse_default_values(env) - if self.overridable: + if self.py_func is not None: self.py_func.analyse_expressions(env) def generate_function_header(self, code, with_pymethdef, with_opt_args = 1, with_dispatch = 1, cname = None): diff --git a/tests/bugs/missing_self_in_cpdef_method_T156.pyx b/tests/bugs/missing_self_in_cpdef_method_T156.pyx deleted file mode 100644 index a7eb65b3..00000000 --- a/tests/bugs/missing_self_in_cpdef_method_T156.pyx +++ /dev/null @@ -1,5 +0,0 @@ - -cdef class B: - cpdef b(): - pass - diff --git a/tests/errors/missing_self_in_cpdef_method_T156.pyx b/tests/errors/missing_self_in_cpdef_method_T156.pyx new file mode 100644 index 00000000..9296ba8a --- /dev/null +++ b/tests/errors/missing_self_in_cpdef_method_T156.pyx @@ -0,0 +1,8 @@ + +cdef class B: + cpdef b(): + pass + +_ERRORS = u""" +:3:10: C method has no self argument +"""