[pypy-commit] pypy space-newtext: a few more in _cffi_backend
cfbolz
pypy.commits at gmail.com
Fri Nov 11 11:44:32 EST 2016
Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: space-newtext
Changeset: r88323:97de008631bc
Date: 2016-11-11 17:43 +0100
http://bitbucket.org/pypy/pypy/changeset/97de008631bc/
Log: a few more in _cffi_backend
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/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_cdata=W_CData, size=int)
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()
More information about the pypy-commit
mailing list