[pypy-svn] r14619 - pypy/dist/pypy/objspace/std

pedronis at codespeak.net pedronis at codespeak.net
Wed Jul 13 16:50:59 CEST 2005


Author: pedronis
Date: Wed Jul 13 16:50:58 2005
New Revision: 14619

Modified:
   pypy/dist/pypy/objspace/std/fake.py
Log:
avoid .name to be lifted improperly to BaseWrappable.



Modified: pypy/dist/pypy/objspace/std/fake.py
==============================================================================
--- pypy/dist/pypy/objspace/std/fake.py	(original)
+++ pypy/dist/pypy/objspace/std/fake.py	Wed Jul 13 16:50:58 2005
@@ -190,13 +190,13 @@
     def __init__(self, space, d):
         self.name = d.__name__
 
-    def descr_descriptor_get(space, w_descriptor, w_obj, w_cls=None):
+    def descr_descriptor_get(space, descr, w_obj, w_cls=None):
         # XXX HAAAAAAAAAAAACK (but possibly a good one)
         if w_obj == space.w_None and not space.is_true(space.is_(w_cls, space.type(space.w_None))):
-            #print w_descriptor, w_obj, w_cls
-            return w_descriptor
+            #print descr, w_obj, w_cls
+            return space.wrap(descr)
         else:
-            name = space.unwrap(w_descriptor).name
+            name = descr.name
             obj = space.unwrap(w_obj)
             try:
                 val = getattr(obj, name)  # this gives a "not RPython" warning
@@ -205,8 +205,8 @@
                 raise
             return space.wrap(val)
 
-    def descr_descriptor_set(space, w_descriptor, w_obj, w_value):
-        name = space.unwrap(w_descriptor).name
+    def descr_descriptor_set(space, descr, w_obj, w_value):
+        name = descr.name
         obj = space.unwrap(w_obj)
         val = space.unwrap(w_value)
         try:
@@ -214,19 +214,28 @@
         except:
             wrap_exception(space)
 
-    def descr_descriptor_del(space, w_descriptor, w_obj):
-        name = space.unwrap(w_descriptor).name
+    def descr_descriptor_del(space, descr, w_obj):
+        name = descr.name
         obj = space.unwrap(w_obj)
         try:
             delattr(obj, name)
         except:
             wrap_exception(space)
 
-    typedef = TypeDef("FakeDescriptor",
-        __get__ = interp2app(descr_descriptor_get),
-        __set__ = interp2app(descr_descriptor_set),
-        __delete__ = interp2app(descr_descriptor_del),
-        )
+
+W_FakeDescriptor.typedef = TypeDef(
+    "FakeDescriptor",
+    __get__ = interp2app(W_FakeDescriptor.descr_descriptor_get.im_func,
+                         unwrap_spec = [baseobjspace.ObjSpace, W_FakeDescriptor,
+                                        baseobjspace.W_Root,
+                                        baseobjspace.W_Root]),
+    __set__ = interp2app(W_FakeDescriptor.descr_descriptor_set.im_func,
+                         unwrap_spec = [baseobjspace.ObjSpace, W_FakeDescriptor,
+                                        baseobjspace.W_Root, baseobjspace.W_Root]),
+    __delete__ = interp2app(W_FakeDescriptor.descr_descriptor_del.im_func,
+                            unwrap_spec = [baseobjspace.ObjSpace, W_FakeDescriptor,
+                                           baseobjspace.W_Root]),
+    )
 
 _fake_type_cache[type(file.softspace)] = W_FakeDescriptor
 _fake_type_cache[type(type.__dict__['__dict__'])] = W_FakeDescriptor



More information about the Pypy-commit mailing list