[pypy-svn] r74251 - pypy/trunk/pypy/objspace/std

afa at codespeak.net afa at codespeak.net
Thu Apr 29 23:06:20 CEST 2010


Author: afa
Date: Thu Apr 29 23:06:19 2010
New Revision: 74251

Modified:
   pypy/trunk/pypy/objspace/std/fake.py
Log:
Fix faking of  objects without a __dict__ (file, for example)


Modified: pypy/trunk/pypy/objspace/std/fake.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/fake.py	(original)
+++ pypy/trunk/pypy/objspace/std/fake.py	Thu Apr 29 23:06:19 2010
@@ -116,7 +116,11 @@
             w_self.val = val
             w_self.space = space
         def getdict(w_self):
-            return w_self.space.wrap(w_self.val.__dict__)
+            try:
+                d = w_self.val.__dict__
+            except AttributeError:
+                return W_Object.getdict(w_self)
+            return w_self.space.wrap(d)
         def unwrap(w_self, space):
             return w_self.val
     W_Fake.__name__ = 'W_Fake%s'%(cpy_type.__name__.capitalize())



More information about the Pypy-commit mailing list