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

arigo at codespeak.net arigo at codespeak.net
Tue Jun 29 16:31:39 CEST 2004


Author: arigo
Date: Tue Jun 29 16:31:38 2004
New Revision: 5389

Modified:
   pypy/trunk/src/pypy/objspace/std/cpythonobject.py
Log:
not all CPython objects have a __class__ attribute.


Modified: pypy/trunk/src/pypy/objspace/std/cpythonobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/cpythonobject.py	(original)
+++ pypy/trunk/src/pypy/objspace/std/cpythonobject.py	Tue Jun 29 16:31:38 2004
@@ -42,7 +42,10 @@
         return "cpyobj(%r)" % (w_self.cpyobj,)
 
     def getclass(w_self, space):
-        return space.wrap(w_self.cpyobj.__class__)
+        try:
+            return space.wrap(w_self.cpyobj.__class__)
+        except AttributeError:   # no __class__!
+            return space.wrap(type(w_self.cpyobj))
 
     def lookup(w_self, name):
         # hack for wrapped CPython types



More information about the Pypy-commit mailing list