From: Dag Sverre Seljebotn Date: Thu, 15 Oct 2009 19:28:41 +0000 (+0200) Subject: Incomplete hack for autotestdict, see #387 X-Git-Tag: 0.13.beta0~2^2~121^2~41 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=221ef93e503928bbc23a7b793088d8ca5f58c215;p=cython.git Incomplete hack for autotestdict, see #387 --- diff --git a/Cython/Compiler/AnalysedTreeTransforms.py b/Cython/Compiler/AnalysedTreeTransforms.py index 3f01e20d..bf57cf16 100644 --- a/Cython/Compiler/AnalysedTreeTransforms.py +++ b/Cython/Compiler/AnalysedTreeTransforms.py @@ -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 diff --git a/tests/run/autotestdict.pyx b/tests/run/autotestdict.pyx index 32e90b51..8b2d824d 100644 --- a/tests/run/autotestdict.pyx +++ b/tests/run/autotestdict.pyx @@ -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 + """ + + +