Fix for autotestdict & property not playing well together.
authorCraig Citro <craigcitro@gmail.com>
Wed, 10 Mar 2010 00:51:51 +0000 (16:51 -0800)
committerCraig Citro <craigcitro@gmail.com>
Wed, 10 Mar 2010 00:51:51 +0000 (16:51 -0800)
Cython/Compiler/AnalysedTreeTransforms.py
Cython/Compiler/Nodes.py
tests/run/extpropertyref.pyx

index 4ce100f72e781f1b82cd727afc335038872011f8..f7ef59bd1a3431ee65b17a2d83bd2831848aa54f 100644 (file)
@@ -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,
index c80b0c0f7d2b78c6e47d9f02eafb3124f5520668..de912990bdffad1af15bac8eb4b2b65a8bd5640c 100644 (file)
@@ -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']
 
 
index 1b783e1b86b92fb6c93b1e96e32a928f543e08c2..f2f73af451922ab2628900c908ba0b27c45520be 100644 (file)
@@ -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