[pypy-svn] r19581 - in pypy/dist/pypy/interpreter: . test

arigo at codespeak.net arigo at codespeak.net
Sun Nov 6 17:11:34 CET 2005


Author: arigo
Date: Sun Nov  6 17:11:33 2005
New Revision: 19581

Modified:
   pypy/dist/pypy/interpreter/test/test_typedef.py
   pypy/dist/pypy/interpreter/typedef.py
Log:
(pedronis, arigo)

missing attributes of 'member_descriptor' objects.


Modified: pypy/dist/pypy/interpreter/test/test_typedef.py
==============================================================================
--- pypy/dist/pypy/interpreter/test/test_typedef.py	(original)
+++ pypy/dist/pypy/interpreter/test/test_typedef.py	Sun Nov  6 17:11:33 2005
@@ -40,3 +40,12 @@
         dictdescr = type.__dict__['__dict__']
         raises(TypeError, dictdescr.__get__, 5)
         raises(TypeError, dictdescr.__set__, 5, d)
+
+    def test_descr_member_descriptor(self):
+        class X(object):
+            __slots__ = ['x']
+        member = X.x
+        assert member.__name__ == 'x'
+        assert member.__objclass__ is X
+        raises((TypeError, AttributeError), "member.__name__ = 'x'")
+        raises((TypeError, AttributeError), "member.__objclass__ = X")

Modified: pypy/dist/pypy/interpreter/typedef.py
==============================================================================
--- pypy/dist/pypy/interpreter/typedef.py	(original)
+++ pypy/dist/pypy/interpreter/typedef.py	Sun Nov  6 17:11:33 2005
@@ -307,7 +307,7 @@
         w_obj.setslotvalue(self.index, None)
 
 Member.typedef = TypeDef(
-    "Member",
+    "member_descriptor",
     __get__ = interp2app(Member.descr_member_get.im_func,
                          unwrap_spec = [ObjSpace,
                                         Member, W_Root, W_Root]),
@@ -317,6 +317,8 @@
     __delete__ = interp2app(Member.descr_member_del.im_func,
                             unwrap_spec = [ObjSpace,
                                            Member, W_Root]),
+    __name__ = interp_attrproperty('name', cls=Member),
+    __objclass__ = interp_attrproperty_w('w_cls', cls=Member),
     )
 
 # ____________________________________________________________



More information about the Pypy-commit mailing list