[pypy-commit] pypy py3.5-newtext: hg merge 97de008631bc

arigo pypy.commits at gmail.com
Tue Feb 14 12:09:18 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5-newtext
Changeset: r90121:353187813fc8
Date: 2017-02-14 18:08 +0100
http://bitbucket.org/pypy/pypy/changeset/353187813fc8/

Log:	hg merge 97de008631bc

diff --git a/pypy/interpreter/astcompiler/ast.py b/pypy/interpreter/astcompiler/ast.py
--- a/pypy/interpreter/astcompiler/ast.py
+++ b/pypy/interpreter/astcompiler/ast.py
@@ -50,7 +50,7 @@
     def __init__(self, fields):
         assert fields == []
 
-    def __spacebind__(self, space):
+    def spacebind(self, space):
         return space.newtuple([])
 
 
diff --git a/pypy/interpreter/astcompiler/tools/asdl_py.py b/pypy/interpreter/astcompiler/tools/asdl_py.py
--- a/pypy/interpreter/astcompiler/tools/asdl_py.py
+++ b/pypy/interpreter/astcompiler/tools/asdl_py.py
@@ -479,8 +479,8 @@
     def __init__(self, fields):
         assert fields == []
 
-    def __spacebind__(self, space):
-        return space.newtuple([space.newtext(field) for field in self.fields])
+    def spacebind(self, space):
+        return space.newtuple([])
 
 
 class W_AST(W_Root):
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -306,7 +306,10 @@
         raise oefmt(space.w_TypeError,
                     "ord() expected string of length 1, but %T found", self)
 
-    def __spacebind__(self, space):
+    def spacebind(self, space):
+        """ Return a version of the object bound to a specific object space
+        instance. This is used for objects (like e.g. TypeDefs) that are
+        constructed before there is an object space instance. """
         return self
 
     def unwrap(self, space):
diff --git a/pypy/interpreter/error.py b/pypy/interpreter/error.py
--- a/pypy/interpreter/error.py
+++ b/pypy/interpreter/error.py
@@ -226,8 +226,8 @@
                     w_value.w_traceback = tb
                 else:
                     # traceback has escaped
-                    space.setattr(w_value, space.wrap("__traceback__"),
-                                  space.wrap(self.get_traceback()))
+                    space.setattr(w_value, space.newtext("__traceback__"),
+                                  self.get_w_traceback(space))
         else:
             # the only case left here is (inst, None), from a 'raise inst'.
             w_inst = w_type
@@ -270,7 +270,7 @@
                 pass
             w_t = self.w_type
             w_v = self.get_w_value(space)
-            w_tb = self.get_traceback()
+            w_tb = self.get_w_traceback(space)
             if where or objrepr:
                 if with_traceback:
                     first_line = 'From %s%s:\n' % (where, objrepr)
@@ -334,7 +334,14 @@
         else:
             self._exception_getclass(space, w_cause, "exception causes")
         w_value = self.get_w_value(space)
-        space.setattr(w_value, space.wrap("__cause__"), w_cause)
+        space.setattr(w_value, space.newtext("__cause__"), w_cause)
+
+    def get_w_traceback(self, space):
+        """Return a traceback or w_None. """
+        tb = self.get_traceback()
+        if tb is None:
+            return space.w_None
+        return tb
 
     def set_traceback(self, traceback):
         """Set the current traceback."""
@@ -369,7 +376,7 @@
         w_context = context.get_w_value(space)
         if not space.is_w(w_value, w_context):
             _break_context_cycle(space, w_value, w_context)
-            space.setattr(w_value, space.wrap('__context__'), w_context)
+            space.setattr(w_value, space.newtext('__context__'), w_context)
 
     # A simplified version of _PyErr_TrySetFromCause, which returns a
     # new exception of the same class, but with another error message.
@@ -414,11 +421,11 @@
     This is O(chain length) but context chains are usually very short
     """
     while True:
-        w_next = space.getattr(w_context, space.wrap('__context__'))
+        w_next = space.getattr(w_context, space.newtext('__context__'))
         if space.is_w(w_next, space.w_None):
             break
         if space.is_w(w_next, w_value):
-            space.setattr(w_context, space.wrap('__context__'), space.w_None)
+            space.setattr(w_context, space.newtext('__context__'), space.w_None)
             break
         w_context = w_next
 
@@ -750,6 +757,6 @@
             # when untranslated, we don't wrap into an app-level
             # SystemError (this makes debugging tests harder)
             raise
-        return OperationError(space.w_SystemError, space.wrap(
+        return OperationError(space.w_SystemError, space.newtext(
             "unexpected internal exception (please report a bug): %r%s" %
             (e, extra)))
diff --git a/pypy/interpreter/executioncontext.py b/pypy/interpreter/executioncontext.py
--- a/pypy/interpreter/executioncontext.py
+++ b/pypy/interpreter/executioncontext.py
@@ -312,7 +312,7 @@
                 operr.normalize_exception(space)
                 w_value = operr.get_w_value(space)
                 w_arg = space.newtuple([operr.w_type, w_value,
-                                        operr.get_traceback()])
+                                        operr.get_w_traceback(space)])
 
             d = frame.getorcreatedebug()
             if d.w_locals is not None:
diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -1058,7 +1058,7 @@
 
     # lazy binding to space
 
-    def __spacebind__(self, space):
+    def spacebind(self, space):
         # we first make a real Function object out of it
         # and the result is a wrapped version of this Function.
         return self.get_function(space)
diff --git a/pypy/interpreter/main.py b/pypy/interpreter/main.py
--- a/pypy/interpreter/main.py
+++ b/pypy/interpreter/main.py
@@ -106,7 +106,7 @@
         operationerr.normalize_exception(space)
         w_type = operationerr.w_type
         w_value = operationerr.get_w_value(space)
-        w_traceback = space.wrap(operationerr.get_traceback())
+        w_traceback = operationerr.get_w_traceback(space)
 
         # for debugging convenience we also insert the exception into
         # the interpreter-level sys.last_xxx
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -1226,7 +1226,7 @@
         if isinstance(w_unroller, SApplicationException):
             # app-level exception
             operr = w_unroller.operr
-            w_traceback = operr.get_traceback()
+            w_traceback = operr.get_w_traceback(self.space)
             w_res = self.call_contextmanager_exit_function(
                 w_exitfunc,
                 operr.w_type,
diff --git a/pypy/interpreter/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -466,7 +466,7 @@
     def __init__(self, function):
         self.function = function
 
-    def __spacebind__(self, space):
+    def spacebind(self, space):
         return self.function(space)
 
 # ____________________________________________________________
diff --git a/pypy/module/_cffi_backend/call_python.py b/pypy/module/_cffi_backend/call_python.py
--- a/pypy/module/_cffi_backend/call_python.py
+++ b/pypy/module/_cffi_backend/call_python.py
@@ -130,4 +130,4 @@
 
 @specialize.memo()
 def get_generic_decorator(space):
-    return space.wrap(interp2app(externpy_deco)) # init time
+    return interp2app(externpy_deco).spacebind(space)
diff --git a/pypy/module/_cffi_backend/cbuffer.py b/pypy/module/_cffi_backend/cbuffer.py
--- a/pypy/module/_cffi_backend/cbuffer.py
+++ b/pypy/module/_cffi_backend/cbuffer.py
@@ -152,7 +152,7 @@
         raise oefmt(space.w_TypeError,
                     "don't know the size pointed to by '%s'", ctype.name)
     ptr = w_cdata.unsafe_escaping_ptr()    # w_cdata kept alive by MiniBuffer()
-    return space.wrap(MiniBuffer(LLBuffer(ptr, size), w_cdata))
+    return MiniBuffer(LLBuffer(ptr, size), w_cdata)
 
 MiniBuffer.typedef = TypeDef(
     "_cffi_backend.buffer",
diff --git a/pypy/module/_cffi_backend/ccallback.py b/pypy/module/_cffi_backend/ccallback.py
--- a/pypy/module/_cffi_backend/ccallback.py
+++ b/pypy/module/_cffi_backend/ccallback.py
@@ -183,7 +183,7 @@
                 e.normalize_exception(space)
                 w_t = e.w_type
                 w_v = e.get_w_value(space)
-                w_tb = space.wrap(e.get_traceback())
+                w_tb = e.get_w_traceback(space)
                 w_res = space.call_function(self.w_onerror, w_t, w_v, w_tb)
                 if not space.is_none(w_res):
                     self.convert_result(ll_res, w_res)
diff --git a/pypy/module/_cffi_backend/ctypearray.py b/pypy/module/_cffi_backend/ctypearray.py
--- a/pypy/module/_cffi_backend/ctypearray.py
+++ b/pypy/module/_cffi_backend/ctypearray.py
@@ -97,7 +97,7 @@
 
     def _fget(self, attrchar):
         if attrchar == 'i':     # item
-            return self.space.wrap(self.ctitem)
+            return self.ctitem
         if attrchar == 'l':     # length
             if self.length >= 0:
                 return self.space.newint(self.length)
diff --git a/pypy/module/_cffi_backend/ctypeenum.py b/pypy/module/_cffi_backend/ctypeenum.py
--- a/pypy/module/_cffi_backend/ctypeenum.py
+++ b/pypy/module/_cffi_backend/ctypeenum.py
@@ -23,15 +23,15 @@
             space = self.space
             w_dct = space.newdict()
             for enumvalue, enumerator in self.enumvalues2erators.iteritems():
-                space.setitem(w_dct, space.wrap(enumvalue),
-                                     space.wrap(enumerator))
+                space.setitem(w_dct, space.newint(enumvalue),
+                                     space.newtext(enumerator))
             return w_dct
         if attrchar == 'R':     # relements
             space = self.space
             w_dct = space.newdict()
             for enumerator, enumvalue in self.enumerators2values.iteritems():
-                space.setitem(w_dct, space.wrap(enumerator),
-                                     space.wrap(enumvalue))
+                space.setitem(w_dct, space.newtext(enumerator),
+                                     space.newint(enumvalue))
             return w_dct
         return self._super._fget(self, attrchar)
 
@@ -51,7 +51,7 @@
             s = self.enumvalues2erators[value]
         except KeyError:
             s = str(value)
-        return self.space.wrap(s)
+        return self.space.newtext(s)
 
 
 class W_CTypeEnumSigned(_Mixin_Enum, W_CTypePrimitiveSigned):
diff --git a/pypy/module/_cffi_backend/ctypefunc.py b/pypy/module/_cffi_backend/ctypefunc.py
--- a/pypy/module/_cffi_backend/ctypefunc.py
+++ b/pypy/module/_cffi_backend/ctypefunc.py
@@ -117,12 +117,11 @@
 
     def _fget(self, attrchar):
         if attrchar == 'a':    # args
-            return self.space.newtuple([self.space.wrap(a)
-                                        for a in self.fargs])
+            return self.space.newtuple([a for a in self.fargs])
         if attrchar == 'r':    # result
             return self.ctitem
         if attrchar == 'E':    # ellipsis
-            return self.space.wrap(self.ellipsis)
+            return self.space.newbool(self.ellipsis)
         if attrchar == 'A':    # abi
             return self.space.newint(self.abi)
         return W_CTypePtrBase._fget(self, attrchar)
diff --git a/pypy/module/_cffi_backend/ffi_obj.py b/pypy/module/_cffi_backend/ffi_obj.py
--- a/pypy/module/_cffi_backend/ffi_obj.py
+++ b/pypy/module/_cffi_backend/ffi_obj.py
@@ -262,7 +262,7 @@
         #
         w_ctype = self.ffi_type(w_arg, ACCEPT_ALL)
         align = w_ctype.alignof()
-        return self.space.wrap(align)
+        return self.space.newint(align)
 
 
     @unwrap_spec(w_name=WrappedDefault(None),
@@ -281,7 +281,7 @@
         #
         # returns a single-argument function
         space = self.space
-        w_ffi = space.wrap(self)
+        w_ffi = self
         w_decorator = call_python.get_generic_decorator(space)
         return space.appexec([w_decorator, w_ffi, w_name, w_error, w_onerror],
         """(decorator, ffi, name, error, onerror):
@@ -389,7 +389,7 @@
                 result += ')'
             result += w_ctype.name[w_ctype.name_position:]
         # Python 3: bytes -> unicode string
-        return self.space.wrap(result)
+        return self.space.newtext(result)
 
 
     @unwrap_spec(code=int)
@@ -502,7 +502,7 @@
             _, offset = w_ctype.direct_typeoffsetof(w_field_or_array, False)
         else:
             offset = self._more_offsetof(w_ctype, w_field_or_array, args_w)
-        return self.space.wrap(offset)
+        return self.space.newint(offset)
 
 
     @unwrap_spec(w_cdata=W_CData, maxlen=int)
@@ -558,7 +558,7 @@
             if size < 0:
                 raise oefmt(self.w_FFIError,
                             "don't know the size of ctype '%s'", w_ctype.name)
-        return self.space.wrap(size)
+        return self.space.newint(size)
 
 
     def descr_typeof(self, w_arg):
@@ -626,7 +626,7 @@
         lst1_w = []
         for i in range(rffi.getintfield(ctx, 'c_num_typenames')):
             s = rffi.charp2str(ctx.c_typenames[i].c_name)
-            lst1_w.append(space.wrap(s))
+            lst1_w.append(space.newtext(s))
 
         lst2_w = []
         lst3_w = []
@@ -639,7 +639,7 @@
                 lst_w = lst3_w
             else:
                 lst_w = lst2_w
-            lst_w.append(space.wrap(s))
+            lst_w.append(space.newtext(s))
 
         return space.newtuple([space.newlist(lst1_w),
                                space.newlist(lst2_w),
@@ -718,7 +718,7 @@
     return r
 
 def W_FFIObject___new__(space, w_subtype, __args__):
-    return space.wrap(make_plain_ffi_object(space, w_subtype))
+    return make_plain_ffi_object(space, w_subtype)
 
 def make_CData(space):
     return space.gettypefor(W_CData)
@@ -728,7 +728,7 @@
 
 def make_NULL(space):
     ctvoidp = newtype._new_voidp_type(space)
-    w_NULL = ctvoidp.cast(space.wrap(0))
+    w_NULL = ctvoidp.cast(space.newint(0))
     return w_NULL
 
 def make_error(space):
diff --git a/pypy/module/_cffi_backend/func.py b/pypy/module/_cffi_backend/func.py
--- a/pypy/module/_cffi_backend/func.py
+++ b/pypy/module/_cffi_backend/func.py
@@ -56,7 +56,7 @@
 @unwrap_spec(w_ctype=ctypeobj.W_CType, following=int)
 def typeoffsetof(space, w_ctype, w_field_or_index, following=0):
     ctype, offset = w_ctype.direct_typeoffsetof(w_field_or_index, following)
-    return space.newtuple([space.wrap(ctype), space.newint(offset)])
+    return space.newtuple([ctype, space.newint(offset)])
 
 @unwrap_spec(w_ctype=ctypeobj.W_CType, w_cdata=cdataobj.W_CData, offset=int)
 def rawaddressof(space, w_ctype, w_cdata, offset):
@@ -99,7 +99,7 @@
             break
         key = rffi.charp2str(p)
         value = rffi.charp2str(rffi.ptradd(p, len(key) + 1))
-        space.setitem_str(w_dict, key, space.wrap(value))
+        space.setitem_str(w_dict, key, space.newtext(value))
         index += 1
 
 # ____________________________________________________________
diff --git a/pypy/module/_cffi_backend/lib_obj.py b/pypy/module/_cffi_backend/lib_obj.py
--- a/pypy/module/_cffi_backend/lib_obj.py
+++ b/pypy/module/_cffi_backend/lib_obj.py
@@ -243,7 +243,7 @@
                 if (op == cffi_opcode.OP_GLOBAL_VAR or
                     op == cffi_opcode.OP_GLOBAL_VAR_F):
                     continue
-            names_w.append(space.wrap(rffi.charp2str(g[i].c_name)))
+            names_w.append(space.newtext(rffi.charp2str(g[i].c_name)))
         return space.newlist(names_w)
 
     def full_dict_copy(self):
@@ -252,7 +252,7 @@
         g = self.ctx.c_globals
         w_result = space.newdict()
         for i in range(total):
-            w_attr = space.wrap(rffi.charp2str(g[i].c_name))
+            w_attr = space.newtext(rffi.charp2str(g[i].c_name))
             w_value = self._get_attr(w_attr)
             space.setitem(w_result, w_attr, w_value)
         return w_result
@@ -261,7 +261,7 @@
         # rebuild a string object from 'varname', to do typechecks and
         # to force a unicode back to a plain string
         space = self.space
-        w_value = self._get_attr(space.wrap(varname))
+        w_value = self._get_attr(space.newtext(varname))
         if isinstance(w_value, cglob.W_GlobSupport):
             # regular case: a global variable
             return w_value.address()
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -1254,6 +1254,20 @@
     orig_getline = linecache.getline
     try:
         linecache.getline = lambda *args: 'LINE'    # hack: speed up PyPy tests
+        sys.stderr = cStringIO.StringIO()
+        assert f(100) == 300
+        assert sys.stderr.getvalue() == ''
+        assert f(10000) == -42
+        assert matches(sys.stderr.getvalue(), """\
+From cffi callback <function$Zcb1 at 0x$>:
+Traceback (most recent call last):
+  File "$", line $, in Zcb1
+    $
+  File "$", line $, in check_value
+    $
+ValueError: 42
+""")
+        sys.stderr = cStringIO.StringIO()
         bigvalue = 20000
         assert f(bigvalue) == -42
         assert matches(sys.stderr.getvalue(), """\
@@ -1261,6 +1275,59 @@
 Trying to convert the result back to C:
 OverflowError: integer 60000 does not fit 'short'
 """)
+        sys.stderr = cStringIO.StringIO()
+        bigvalue = 20000
+        assert len(seen) == 0
+        assert ff(bigvalue) == -42
+        assert sys.stderr.getvalue() == ""
+        assert len(seen) == 1
+        exc, val, tb = seen[0]
+        assert exc is OverflowError
+        assert str(val) == "integer 60000 does not fit 'short'"
+        #
+        sys.stderr = cStringIO.StringIO()
+        bigvalue = 20000
+        del seen[:]
+        oops_result = 81
+        assert ff(bigvalue) == 81
+        oops_result = None
+        assert sys.stderr.getvalue() == ""
+        assert len(seen) == 1
+        exc, val, tb = seen[0]
+        assert exc is OverflowError
+        assert str(val) == "integer 60000 does not fit 'short'"
+        #
+        sys.stderr = cStringIO.StringIO()
+        bigvalue = 20000
+        del seen[:]
+        oops_result = "xy"     # not None and not an int!
+        assert ff(bigvalue) == -42
+        oops_result = None
+        assert matches(sys.stderr.getvalue(), """\
+From cffi callback <function$Zcb1 at 0x$>:
+Trying to convert the result back to C:
+OverflowError: integer 60000 does not fit 'short'
+
+During the call to 'onerror', another exception occurred:
+
+TypeError: $integer$
+""")
+        #
+        sys.stderr = cStringIO.StringIO()
+        seen = "not a list"    # this makes the oops() function crash
+        assert ff(bigvalue) == -42
+        assert matches(sys.stderr.getvalue(), """\
+From cffi callback <function$Zcb1 at 0x$>:
+Trying to convert the result back to C:
+OverflowError: integer 60000 does not fit 'short'
+
+During the call to 'onerror', another exception occurred:
+
+Traceback (most recent call last):
+  File "$", line $, in oops
+    $
+AttributeError: 'str' object has no attribute 'append'
+""")
     finally:
         sys.stderr = orig_stderr
         linecache.getline = orig_getline
diff --git a/pypy/module/_codecs/interp_codecs.py b/pypy/module/_codecs/interp_codecs.py
--- a/pypy/module/_codecs/interp_codecs.py
+++ b/pypy/module/_codecs/interp_codecs.py
@@ -484,7 +484,8 @@
                   "backslashreplace", "surrogateescape", "surrogatepass",
                   "namereplace"):
         name = error + "_errors"
-        state.codec_error_registry[error] = space.wrap(interp2app(globals()[name]))
+        state.codec_error_registry[error] = interp2app(
+                globals()[name]).spacebind(space)
 
 
 def _wrap_codec_error(space, operr, action, encoding):
diff --git a/pypy/module/_rawffi/callback.py b/pypy/module/_rawffi/callback.py
--- a/pypy/module/_rawffi/callback.py
+++ b/pypy/module/_rawffi/callback.py
@@ -60,7 +60,7 @@
                         break
             unwrap_value(space, write_ptr, ptr, 0, letter, w_res)
     except OperationError as e:
-        tbprint(space, e.get_traceback(),
+        tbprint(space, e.get_w_traceback(space),
                 space.newtext(e.errorstr(space)))
         # force the result to be zero
         if callback_ptr.result is not None:
diff --git a/pypy/module/cpyext/pyerrors.py b/pypy/module/cpyext/pyerrors.py
--- a/pypy/module/cpyext/pyerrors.py
+++ b/pypy/module/cpyext/pyerrors.py
@@ -54,7 +54,7 @@
     if operror:
         ptype[0] = make_ref(space, operror.w_type)
         pvalue[0] = make_ref(space, operror.get_w_value(space))
-        ptraceback[0] = make_ref(space, operror.get_traceback())
+        ptraceback[0] = make_ref(space, operror.get_w_traceback(space))
     else:
         ptype[0] = lltype.nullptr(PyObject.TO)
         pvalue[0] = lltype.nullptr(PyObject.TO)
@@ -284,7 +284,7 @@
     operror.normalize_exception(space)
     w_type = operror.w_type
     w_value = operror.get_w_value(space)
-    w_tb = operror.get_traceback()
+    w_tb = operror.get_w_traceback(space)
 
     if rffi.cast(lltype.Signed, set_sys_last_vars):
         space.sys.setdictvalue(space, "last_type", w_type)
@@ -371,7 +371,7 @@
     if operror:
         ptype[0] = make_ref(space, operror.w_type)
         pvalue[0] = make_ref(space, operror.get_w_value(space))
-        ptraceback[0] = make_ref(space, operror.get_traceback())
+        ptraceback[0] = make_ref(space, operror.get_w_traceback(space))
     else:
         ptype[0] = lltype.nullptr(PyObject.TO)
         pvalue[0] = lltype.nullptr(PyObject.TO)
diff --git a/pypy/module/imp/importing.py b/pypy/module/imp/importing.py
--- a/pypy/module/imp/importing.py
+++ b/pypy/module/imp/importing.py
@@ -256,7 +256,10 @@
             w_pathname = get_sourcefile(space, pathname)
         else:
             w_pathname = space.wrap_fsdecoded(code_w.co_filename)
-        w_cpathname = space.wrap_fsdecoded(cpathname)
+        if cpathname is not None:
+            w_cpathname = space.wrap_fsdecoded(cpathname)
+        else:
+            w_cpathname = space.w_None
         space.setitem(w_dict, space.newtext("__file__"), w_pathname)
         space.setitem(w_dict, space.newtext("__cached__"), w_cpathname)
     code_w.exec_code(space, w_dict, w_dict)
diff --git a/pypy/module/sys/__init__.py b/pypy/module/sys/__init__.py
--- a/pypy/module/sys/__init__.py
+++ b/pypy/module/sys/__init__.py
@@ -225,7 +225,7 @@
             if operror is None:
                 return space.w_None
             else:
-                return operror.get_traceback()
+                return operror.get_w_traceback(space)
         return None
 
     def get_flag(self, name):
diff --git a/pypy/module/sys/vm.py b/pypy/module/sys/vm.py
--- a/pypy/module/sys/vm.py
+++ b/pypy/module/sys/vm.py
@@ -124,7 +124,7 @@
         return space.newtuple([space.w_None, space.w_None, space.w_None])
     else:
         return space.newtuple([operror.w_type, operror.get_w_value(space),
-                               operror.get_traceback()])
+                               operror.get_w_traceback(space)])
 
 def exc_info_without_tb(space, operror):
     return space.newtuple([operror.w_type, operror.get_w_value(space),
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
@@ -162,7 +162,7 @@
         if isinstance(x, float):
             return W_FloatObject(x)
         if isinstance(x, W_Root):
-            w_result = x.__spacebind__(self)
+            w_result = x.spacebind(self)
             #print 'wrapping', x, '->', w_result
             return w_result
         if isinstance(x, base_int):


More information about the pypy-commit mailing list