[pypy-svn] pypy default: Split space.wrap() into space.wrap() and space._wrap_not_rpython().

arigo commits-noreply at bitbucket.org
Thu Jan 20 10:29:13 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r40969:c5bbb842d44d
Date: 2011-01-20 10:27 +0100
http://bitbucket.org/pypy/pypy/changeset/c5bbb842d44d/

Log:	Split space.wrap() into space.wrap() and space._wrap_not_rpython().

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
@@ -184,8 +184,12 @@
                 return W_LongObject.fromrarith_int(x)
         if isinstance(x, rbigint):
             return W_LongObject(x)
+        return self._wrap_not_rpython(x)
+    wrap._annspecialcase_ = "specialize:wrap"
 
-        # _____ below here is where the annotator should not get _____
+    def _wrap_not_rpython(self, x):
+        "NOT_RPYTHON"
+        # _____ this code is here to support testing only _____
 
         # wrap() of a container works on CPython, but the code is
         # not RPython.  Don't use -- it is kept around mostly for tests.
@@ -229,9 +233,6 @@
             return self.w_Ellipsis
 
         if self.config.objspace.nofaking:
-            # annotation should actually not get here.  If it does, you get
-            # an error during rtyping because '%r' is not supported.  It tells
-            # you that there was a space.wrap() on a strange object.
             raise OperationError(self.w_RuntimeError,
                                  self.wrap("nofaking enabled: refusing "
                                            "to wrap cpython value %r" %(x,)))
@@ -242,8 +243,6 @@
         from fake import fake_object
         return fake_object(self, x)
 
-    wrap._annspecialcase_ = "specialize:wrap"
-
     def wrap_exception_cls(self, x):
         """NOT_RPYTHON"""
         if hasattr(self, 'w_' + x.__name__):


More information about the Pypy-commit mailing list