From: Craig Citro Date: Wed, 10 Mar 2010 00:51:51 +0000 (-0800) Subject: Fix for autotestdict & property not playing well together. X-Git-Tag: 0.13.beta0~319^2~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2b1548d8305519aecf9dda9e9a6021da7706f6c2;p=cython.git Fix for autotestdict & property not playing well together. --- diff --git a/Cython/Compiler/AnalysedTreeTransforms.py b/Cython/Compiler/AnalysedTreeTransforms.py index 4ce100f7..f7ef59bd 100644 --- a/Cython/Compiler/AnalysedTreeTransforms.py +++ b/Cython/Compiler/AnalysedTreeTransforms.py @@ -6,6 +6,7 @@ from PyrexTypes import py_object_type from Builtin import dict_type from StringEncoding import EncodedString import Naming +import Symtab class AutoTestDictTransform(ScopeTrackingTransform): # Handles autotestdict directive @@ -82,7 +83,17 @@ class AutoTestDictTransform(ScopeTrackingTransform): type=py_object_type, is_py_attr=True, is_temp=True) - name = "%s.%s" % (clsname, node.entry.name) + if isinstance(node.entry.scope, Symtab.PropertyScope): + new_node = AttributeNode(pos, obj=parent, + attribute=node.entry.scope.name, + type=py_object_type, + is_py_attr=True, + is_temp=True) + parent = new_node + name = "%s.%s.%s" % (clsname, node.entry.scope.name, + node.entry.name) + else: + name = "%s.%s" % (clsname, node.entry.name) else: assert False getfunc = AttributeNode(pos, obj=parent, diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index c80b0c0f..de912990 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -1726,7 +1726,7 @@ class PyArgDeclNode(Node): class DecoratorNode(Node): # A decorator # - # decorator NameNode or CallNode + # decorator NameNode or CallNode or AttributeNode child_attrs = ['decorator'] diff --git a/tests/run/extpropertyref.pyx b/tests/run/extpropertyref.pyx index 1b783e1b..f2f73af4 100644 --- a/tests/run/extpropertyref.pyx +++ b/tests/run/extpropertyref.pyx @@ -3,12 +3,17 @@ cdef class Spam: property eggs: def __get__(self): + """ + This is the docstring for Spam.eggs.__get__ + """ return 42 def tomato(): """ >>> tomato() 42 + >>> sorted(__test__.keys()) + [u'Spam.eggs.__get__ (line 5)', u'tomato (line 11)'] """ cdef Spam spam cdef object lettuce