From: Stefan Behnel Date: Fri, 19 Nov 2010 07:04:19 +0000 (+0100) Subject: resolve 'cython' compiler directives also on Python classes X-Git-Tag: 0.14.alpha0~116 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c9ff1344c989896f72bc1a192c09d6120fb918e1;p=cython.git resolve 'cython' compiler directives also on Python classes --- diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index 42e9dd5c..9f5037fc 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -784,6 +784,13 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations): body = StatListNode(node.pos, stats=[node]) return self.visit_with_directives(body, directives) + def visit_PyClassDefNode(self, node): + directives = self._extract_directives(node, 'class') + if not directives: + return self.visit_Node(node) + body = StatListNode(node.pos, stats=[node]) + return self.visit_with_directives(body, directives) + def _extract_directives(self, node, scope_name): if not node.decorators: return {}