[pypy-svn] r73323 - in pypy/branch/cpython-extension/pypy/module/cpyext: . test

trundle at codespeak.net trundle at codespeak.net
Sat Apr 3 03:23:28 CEST 2010


Author: trundle
Date: Sat Apr  3 03:23:26 2010
New Revision: 73323

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/test/foo.c
   pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py
   pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py
Log:
Test and fix docstrings of members.


Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/foo.c
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/foo.c	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/foo.c	Sat Apr  3 03:23:26 2010
@@ -112,7 +112,7 @@
      "A helpful docstring."},
     {"int_member_readonly", T_INT, offsetof(fooobject, foo), READONLY,
      "A helpful docstring."},
-    {"broken_member", 0xaffe, 0, 0, ""},
+    {"broken_member", 0xaffe, 0, 0, NULL},
     {"object_member", T_OBJECT, offsetof(fooobject, foo_object), 0,
      "A Python object."},
     {"object_member_ex", T_OBJECT_EX, offsetof(fooobject, foo_object), 0,

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/test/test_typeobject.py	Sat Apr  3 03:23:26 2010
@@ -39,7 +39,8 @@
         assert "readonly" in str(exc.value)
         raises(SystemError, "obj.broken_member")
         raises(SystemError, "obj.broken_member = 42")
-
+        assert module.fooType.broken_member.__doc__ is None
+        assert module.fooType.object_member.__doc__ == "A Python object."
         assert obj.object_member is None
         obj.object_member = "hello"
         assert obj.object_member == "hello"

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/typeobject.py	Sat Apr  3 03:23:26 2010
@@ -59,8 +59,8 @@
         self.name = rffi.charp2str(member.c_name)
         flags = rffi.cast(lltype.Signed, member.c_flags)
         doc = set = None
-        if doc:
-            doc = rffi.charp2str(getset.c_doc)
+        if member.c_doc:
+            doc = rffi.charp2str(member.c_doc)
         get = GettersAndSetters.member_getter.im_func
         del_ = GettersAndSetters.member_delete.im_func
         if not (flags & structmemberdefs.READONLY):



More information about the Pypy-commit mailing list