Author: Carl Friedrich Bolz <[email protected]>
Branch: space-newtext
Changeset: r88319:a7bb81dcc53e
Date: 2016-11-10 18:26 +0100
http://bitbucket.org/pypy/pypy/changeset/a7bb81dcc53e/
Log: __spacebind__ -> spacebind (there's no need to make it look like a
special method)
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):
self.fields = fields
- def __spacebind__(self, space):
+ def spacebind(self, space):
return space.newtuple([space.wrap(field) for field in self.fields])
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
@@ -437,7 +437,7 @@
def __init__(self, fields):
self.fields = fields
- def __spacebind__(self, space):
+ def spacebind(self, space):
return space.newtuple([space.newtext(field) for field in self.fields])
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -313,7 +313,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/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -986,7 +986,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/typedef.py b/pypy/interpreter/typedef.py
--- a/pypy/interpreter/typedef.py
+++ b/pypy/interpreter/typedef.py
@@ -417,7 +417,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/cbuffer.py
b/pypy/module/_cffi_backend/cbuffer.py
--- a/pypy/module/_cffi_backend/cbuffer.py
+++ b/pypy/module/_cffi_backend/cbuffer.py
@@ -88,4 +88,4 @@
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)
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
@@ -297,7 +297,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):
@@ -405,7 +405,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)
@@ -518,7 +518,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)
@@ -574,7 +574,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):
@@ -642,7 +642,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 = []
@@ -655,7 +655,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),
@@ -734,7 +734,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)
@@ -744,7 +744,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/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
--- a/pypy/module/_ssl/interp_ssl.py
+++ b/pypy/module/_ssl/interp_ssl.py
@@ -1132,7 +1132,7 @@
self.w_sslerror = space.new_exception_class(
"_ssl.SSLError", w_socketerror)
space.setattr(self.w_sslerror, space.newtext('__str__'),
- interp2app(SSLError_descr_str).__spacebind__(space))
+ interp2app(SSLError_descr_str).spacebind(space))
self.w_sslzeroreturnerror = space.new_exception_class(
"_ssl.SSLZeroReturnError", self.w_sslerror)
self.w_sslwantreaderror = space.new_exception_class(
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
@@ -154,7 +154,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):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit