From 77ec0cc43a64ea615e316132300465d04076fef1 Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Fri, 16 Oct 2009 13:31:53 +0200 Subject: [PATCH] Yet another bugfix for autotestdict --- Cython/Compiler/AnalysedTreeTransforms.py | 6 +++++- tests/run/autotestdict.pyx | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/AnalysedTreeTransforms.py b/Cython/Compiler/AnalysedTreeTransforms.py index 89992500..933250c6 100644 --- a/Cython/Compiler/AnalysedTreeTransforms.py +++ b/Cython/Compiler/AnalysedTreeTransforms.py @@ -64,7 +64,11 @@ 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: + if isinstance(node, CFuncDefNode): + name = node.py_func.name + else: + name = node.name + if self.scope_type == 'cclass' and name in self.blacklist: return node mod = ModuleRefNode(pos) if self.scope_type == 'pyclass': diff --git a/tests/run/autotestdict.pyx b/tests/run/autotestdict.pyx index 2cd8d17e..bc1f7fc0 100644 --- a/tests/run/autotestdict.pyx +++ b/tests/run/autotestdict.pyx @@ -12,6 +12,7 @@ all_tests_run() is executed which does final validation. >>> items.sort() >>> for key, value in items: ... print('%s ; %s' % (key, value)) +MyCdefClass.cpdef_method (line 78) ; >>> add_log("cpdef class method") MyCdefClass.method (line 75) ; >>> add_log("cdef class method") MyClass.method (line 65) ; >>> add_log("class method") doc_without_test (line 47) ; Some docs @@ -22,7 +23,6 @@ myfunc (line 44) ; >>> add_log("def") log = [] - cdef cdeffunc(): """ Please don't include me! @@ -75,6 +75,9 @@ cdef class MyCdefClass: def method(self): """>>> add_log("cdef class method")""" + cpdef cpdef_method(self): + """>>> add_log("cpdef class method")""" + def __cinit__(self): """ Should not be included, as it can't be looked up with getattr -- 2.26.2