Incomplete hack for autotestdict, see #387
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Thu, 15 Oct 2009 19:28:41 +0000 (21:28 +0200)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Thu, 15 Oct 2009 19:28:41 +0000 (21:28 +0200)
Cython/Compiler/AnalysedTreeTransforms.py
tests/run/autotestdict.pyx

index 3f01e20d9d754f4e60ad897c101571d87e87ecbb..bf57cf1611ccf147e2efaac26e84d3876668ee17 100644 (file)
@@ -10,6 +10,8 @@ import Naming
 class AutoTestDictTransform(ScopeTrackingTransform):
     # Handles autotestdict directive
 
+    blacklist = ['__cinit__', '__dealloc__']
+
     def visit_ModuleNode(self, node):
         self.scope_type = 'module'
         self.scope_node = node
@@ -62,6 +64,8 @@ class AutoTestDictTransform(ScopeTrackingTransform):
                 parent = ModuleRefNode(pos)
                 name = node.entry.name
             elif self.scope_type in ('pyclass', 'cclass'):
+                if self.scope_type == 'cclass' and node.name in self.blacklist:
+                    return node
                 mod = ModuleRefNode(pos)
                 if self.scope_type == 'pyclass':
                     clsname = self.scope_node.name
index 32e90b51fc1703cc9315eadcd791157974ce9621..8b2d824d518d44405b8fc9fb5be6ca0553e9653e 100644 (file)
@@ -61,7 +61,7 @@ class MyClass:
     >>> True
     True
     """
-    
+
     def method(self):
         """>>> add_log("class method")"""
 
@@ -75,3 +75,21 @@ cdef class MyCdefClass:
     def method(self):
         """>>> add_log("cdef class method")"""
 
+    def __cinit__(self):
+        """
+        Should not be included, as it can't be looked up with getattr
+
+        >>> True
+        False
+        """
+
+    def __dealloc__(self):
+        """
+        Should not be included, as it can't be looked up with getattr
+
+        >>> True
+        False
+        """
+
+
+