From b51cf45cf15ccbd9539b41e9178892cd4506953e Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Fri, 3 Apr 2009 00:33:16 -0700 Subject: [PATCH] Fix ticket #230, pxd cdef override for subclass methods --- Cython/Compiler/Nodes.py | 2 +- Cython/Compiler/ParseTreeTransforms.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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: -- 2.26.2