[pypy-commit] pypy remove-dict-smm: Make space.unwrap call w_obj.unwrap(space) on W_Root which returns w_obj by default.

Manuel Jacob noreply at buildbot.pypy.org
Fri May 17 14:58:48 CEST 2013


Author: Manuel Jacob
Branch: remove-dict-smm
Changeset: r64256:b93bb30957b8
Date: 2013-05-17 14:50 +0200
http://bitbucket.org/pypy/pypy/changeset/b93bb30957b8/

Log:	Make space.unwrap call w_obj.unwrap(space) on W_Root which returns
	w_obj by default.

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -242,6 +242,11 @@
     def __spacebind__(self, space):
         return self
 
+    def unwrap(self, space):
+        """NOT_RPYTHON"""
+        # _____ this code is here to support testing only _____
+        return self
+
 
 class W_InterpIterable(W_Root):
     def __init__(self, space, w_iterable):
diff --git a/pypy/objspace/std/model.py b/pypy/objspace/std/model.py
--- a/pypy/objspace/std/model.py
+++ b/pypy/objspace/std/model.py
@@ -326,9 +326,6 @@
             s += ' instance of %s' % self.w__class__
         return '<%s>' % s
 
-    def unwrap(self, space):
-        raise UnwrapError('cannot unwrap %r' % self)
-
 
 class UnwrapError(Exception):
     pass
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -253,10 +253,9 @@
 
     def unwrap(self, w_obj):
         """NOT_RPYTHON"""
-        if isinstance(w_obj, model.W_Object):
+        # _____ this code is here to support testing only _____
+        if isinstance(w_obj, W_Root):
             return w_obj.unwrap(self)
-        if isinstance(w_obj, W_Root):
-            return w_obj
         raise model.UnwrapError("cannot unwrap: %r" % w_obj)
 
     def newint(self, intval):


More information about the pypy-commit mailing list