Fix ticket #230, pxd cdef override for subclass methods
authorRobert Bradshaw <robertwb@math.washington.edu>
Fri, 3 Apr 2009 07:33:16 +0000 (00:33 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Fri, 3 Apr 2009 07:33:16 +0000 (00:33 -0700)
Cython/Compiler/Nodes.py
Cython/Compiler/ParseTreeTransforms.py

index 8d77c456b0877acdbf2551cf7669dfbc54628bf2..8840933eec07741f6823c50ac09a86b4f1fe615e 100644 (file)
@@ -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:
index 58475e3a73f2b82390cfe518457a6c2d9c6a2846..abf571e6cd383d220c1dc9891a009d12a795afc3 100644 (file)
@@ -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: