cython-devel

changeset 1863:51b79d9aca35

Fix #156, missing self in cpdef method.
author Robert Bradshaw <robertwb@math.washington.edu>
date Sat Mar 14 22:45:55 2009 -0700 (2 years ago)
parents 620326b14c3f
children f1d76eb11182
files Cython/Compiler/Nodes.py tests/bugs/missing_self_in_cpdef_method_T156.pyx tests/errors/missing_self_in_cpdef_method_T156.pyx
line diff
1.1 --- a/Cython/Compiler/Nodes.py Sun Feb 08 12:49:15 2009 +0100 1.2 +++ b/Cython/Compiler/Nodes.py Sat Mar 14 22:45:55 2009 -0700 1.3 @@ -1336,7 +1336,7 @@ 1.4 self.entry.inline_func_in_pxd = self.inline_in_pxd 1.5 self.return_type = type.return_type 1.6 1.7 - if self.overridable: 1.8 + if self.overridable and len(self.args) > 0: 1.9 import ExprNodes 1.10 py_func_body = self.call_self_node(is_module_scope = env.is_module_scope) 1.11 self.py_func = DefNode(pos = self.pos, 1.12 @@ -1393,7 +1393,7 @@ 1.13 1.14 def analyse_expressions(self, env): 1.15 self.analyse_default_values(env) 1.16 - if self.overridable: 1.17 + if self.py_func is not None: 1.18 self.py_func.analyse_expressions(env) 1.19 1.20 def generate_function_header(self, code, with_pymethdef, with_opt_args = 1, with_dispatch = 1, cname = None):
2.1 --- a/tests/bugs/missing_self_in_cpdef_method_T156.pyx Sun Feb 08 12:49:15 2009 +0100 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,5 +0,0 @@ 2.4 - 2.5 -cdef class B: 2.6 - cpdef b(): 2.7 - pass 2.8 -
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tests/errors/missing_self_in_cpdef_method_T156.pyx Sat Mar 14 22:45:55 2009 -0700 3.3 @@ -0,0 +1,8 @@ 3.4 + 3.5 +cdef class B: 3.6 + cpdef b(): 3.7 + pass 3.8 + 3.9 +_ERRORS = u""" 3.10 +:3:10: C method has no self argument 3.11 +"""