[pypy-svn] r7656 - pypy/trunk/src/pypy/objspace/std

mwh at codespeak.net mwh at codespeak.net
Wed Nov 24 13:40:42 CET 2004


Author: mwh
Date: Wed Nov 24 13:40:41 2004
New Revision: 7656

Modified:
   pypy/trunk/src/pypy/objspace/std/fake.py
Log:
an experimental and different way to wrap certain descriptor types.


Modified: pypy/trunk/src/pypy/objspace/std/fake.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/fake.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/fake.py	Wed Nov 24 13:40:41 2004
@@ -108,3 +108,13 @@
 _fake_type_cache.content[type(len)] = fake_builtin_callable
 _fake_type_cache.content[type(list.append)] = fake_builtin_callable
 _fake_type_cache.content[type(type(None).__repr__)] = fake_builtin_callable
+
+from pypy.interpreter.typedef import GetSetProperty
+
+def fake_descriptor(space, d):
+    n = d.__name__
+    return space.wrap(GetSetProperty(lambda x:getattr(x, n),
+                                     lambda x,y:setattr(x, n, y)))
+
+_fake_type_cache.content[type(file.softspace)] = fake_descriptor
+_fake_type_cache.content[type(type.__dict__['__dict__'])] = fake_descriptor



More information about the Pypy-commit mailing list