From: Robert Bradshaw Date: Fri, 3 Apr 2009 07:33:16 +0000 (-0700) Subject: Fix ticket #230, pxd cdef override for subclass methods X-Git-Tag: 0.11.1.alpha~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b51cf45cf15ccbd9539b41e9178892cd4506953e;p=cython.git Fix ticket #230, pxd cdef override for subclass methods --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 8d77c456..8840933e 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1646,7 +1646,7 @@ class DefNode(FuncDefNode): nogil = cfunc_type.nogil, visibility = 'private', api = False, - directive_locals = cfunc.directive_locals) + directive_locals = getattr(cfunc, 'directive_locals', {})) def analyse_declarations(self, env): if 'locals' in env.directives: diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 58475e3a..abf571e6 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -812,6 +812,9 @@ class AlignFunctionDefinitions(CythonTransform): def visit_DefNode(self, node): pxd_def = self.scope.lookup(node.name) if pxd_def: + if self.scope.is_c_class_scope and len(pxd_def.type.args) > 0: + # The self parameter type needs adjusting. + pxd_def.type.args[0].type = self.scope.parent_type if pxd_def.is_cfunction: node = node.as_cfunction(pxd_def) else: