From c9ff1344c989896f72bc1a192c09d6120fb918e1 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 19 Nov 2010 08:04:19 +0100 Subject: [PATCH] resolve 'cython' compiler directives also on Python classes --- Cython/Compiler/ParseTreeTransforms.py | 7 +++++++ 1 file changed, 7 insertions(+) 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 {} -- 2.26.2