cython-devel
changeset 1941:3c73ec71e74c
Fix ticket #230, pxd cdef override for subclass methods
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Fri Apr 03 00:33:16 2009 -0700 (4 years ago) |
| parents | e5626282016e |
| children | 4497f635d5fd |
| files | Cython/Compiler/Nodes.py Cython/Compiler/ParseTreeTransforms.py |
line diff
1.1 --- a/Cython/Compiler/Nodes.py Thu Apr 02 17:39:09 2009 -0700
1.2 +++ b/Cython/Compiler/Nodes.py Fri Apr 03 00:33:16 2009 -0700
1.3 @@ -1646,7 +1646,7 @@
1.4 nogil = cfunc_type.nogil,
1.5 visibility = 'private',
1.6 api = False,
1.7 - directive_locals = cfunc.directive_locals)
1.8 + directive_locals = getattr(cfunc, 'directive_locals', {}))
1.9
1.10 def analyse_declarations(self, env):
1.11 if 'locals' in env.directives:
2.1 --- a/Cython/Compiler/ParseTreeTransforms.py Thu Apr 02 17:39:09 2009 -0700
2.2 +++ b/Cython/Compiler/ParseTreeTransforms.py Fri Apr 03 00:33:16 2009 -0700
2.3 @@ -812,6 +812,9 @@
2.4 def visit_DefNode(self, node):
2.5 pxd_def = self.scope.lookup(node.name)
2.6 if pxd_def:
2.7 + if self.scope.is_c_class_scope and len(pxd_def.type.args) > 0:
2.8 + # The self parameter type needs adjusting.
2.9 + pxd_def.type.args[0].type = self.scope.parent_type
2.10 if pxd_def.is_cfunction:
2.11 node = node.as_cfunction(pxd_def)
2.12 else:
