[pypy-svn] pypy fast-forward: Add doc to __dict__ and __weakref__ descriptors

amauryfa commits-noreply at bitbucket.org
Tue Jan 11 00:51:31 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40568:ba7b8fbd9e6a
Date: 2011-01-11 00:18 +0100
http://bitbucket.org/pypy/pypy/changeset/ba7b8fbd9e6a/

Log:	Add doc to __dict__ and __weakref__ descriptors

diff --git a/pypy/objspace/std/test/test_typeobject.py b/pypy/objspace/std/test/test_typeobject.py
--- a/pypy/objspace/std/test/test_typeobject.py
+++ b/pypy/objspace/std/test/test_typeobject.py
@@ -1003,6 +1003,13 @@
         del list.a
         raises(AttributeError, "l.a")
 
+    def test_doc(self):
+        class C(object):
+            pass
+
+        assert C.__dict__['__dict__'].__doc__.startswith("dictionary for")
+        assert C.__dict__['__weakref__'].__doc__.startswith("list of weak")
+
 class AppTestGetattributeShortcut:
 
     def setup_class(cls):

diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -626,7 +626,8 @@
     w_docstring = code.getdocstring(space)
     return space.newtuple([w_docstring])
 
-weakref_descr = GetSetProperty(descr_get_weakref)
+weakref_descr = GetSetProperty(descr_get_weakref,
+                    doc="list of weak references to the object (if defined)")
 weakref_descr.name = '__weakref__'
 
 def make_weakref_descr(cls):

diff --git a/pypy/objspace/std/stdtypedef.py b/pypy/objspace/std/stdtypedef.py
--- a/pypy/objspace/std/stdtypedef.py
+++ b/pypy/objspace/std/stdtypedef.py
@@ -38,7 +38,8 @@
         a = a.base
     return True
 
-std_dict_descr = GetSetProperty(descr_get_dict, descr_set_dict, descr_del_dict)
+std_dict_descr = GetSetProperty(descr_get_dict, descr_set_dict, descr_del_dict,
+                    doc="dictionary for instance variables (if defined)")
 std_dict_descr.name = '__dict__'
 
 # ____________________________________________________________


More information about the Pypy-commit mailing list