resolve 'cython' compiler directives also on Python classes
authorStefan Behnel <scoder@users.berlios.de>
Fri, 19 Nov 2010 07:04:19 +0000 (08:04 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 19 Nov 2010 07:04:19 +0000 (08:04 +0100)
Cython/Compiler/ParseTreeTransforms.py

index 42e9dd5ce95e654497b070bad76900d02f51ea22..9f5037fc53328599a89273855a11c3bba8f257c7 100644 (file)
@@ -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 {}