Author: Armin Rigo <[email protected]>
Branch: py3.5-newtext
Changeset: r90124:ce468b82d2f3
Date: 2017-02-14 18:17 +0100
http://bitbucket.org/pypy/pypy/changeset/ce468b82d2f3/
Log: hg merge ffa1b618069f
diff --git a/pypy/module/cppyy/converter.py b/pypy/module/cppyy/converter.py
--- a/pypy/module/cppyy/converter.py
+++ b/pypy/module/cppyy/converter.py
@@ -188,7 +188,7 @@
return state.c_voidp
def convert_argument(self, space, w_obj, address, call_local):
- w_tc = space.findattr(w_obj, space.wrap('typecode'))
+ w_tc = space.findattr(w_obj, space.newtext('typecode'))
if w_tc is not None and space.str_w(w_tc) != self.typecode:
raise oefmt(space.w_TypeError,
"expected %s pointer type, but received %s",
@@ -332,7 +332,7 @@
def from_memory(self, space, w_obj, w_pycppclass, offset):
address = rffi.cast(rffi.CCHARP, self._get_raw_address(space, w_obj,
offset))
- return space.wrap(address[0])
+ return space.newbytes(address[0])
def to_memory(self, space, w_obj, w_value, offset):
address = rffi.cast(rffi.CCHARP, self._get_raw_address(space, w_obj,
offset))
@@ -403,7 +403,7 @@
def from_memory(self, space, w_obj, w_pycppclass, offset):
address = self._get_raw_address(space, w_obj, offset)
charpptr = rffi.cast(rffi.CCHARPP, address)
- return space.wrap(rffi.charp2str(charpptr[0]))
+ return space.newbytes(rffi.charp2str(charpptr[0]))
def free_argument(self, space, arg, call_local):
lltype.free(rffi.cast(rffi.CCHARPP, arg)[0], flavor='raw')
@@ -667,7 +667,7 @@
# TODO: get the actual type info from somewhere ...
address = self._get_raw_address(space, w_obj, offset)
longptr = rffi.cast(rffi.LONGP, address)
- return space.wrap(longptr[0])
+ return space.newlong(longptr[0])
_converters = {} # builtin and custom types
diff --git a/pypy/module/cppyy/executor.py b/pypy/module/cppyy/executor.py
--- a/pypy/module/cppyy/executor.py
+++ b/pypy/module/cppyy/executor.py
@@ -56,7 +56,7 @@
raise NotImplementedError
lresult = capi.c_call_l(space, cppmethod, cppthis, num_args, args)
ptrval = rffi.cast(rffi.ULONG, lresult)
- arr = space.interp_w(W_Array, unpack_simple_shape(space,
space.wrap(self.typecode)))
+ arr = space.interp_w(W_Array, unpack_simple_shape(space,
space.newtext(self.typecode)))
if ptrval == 0:
from pypy.module.cppyy import interp_cppyy
return interp_cppyy.get_nullptr(space)
@@ -130,9 +130,9 @@
lresult = capi.c_call_l(space, cppmethod, cppthis, num_args, args)
ccpresult = rffi.cast(rffi.CCHARP, lresult)
if ccpresult == rffi.cast(rffi.CCHARP, 0):
- return space.wrap("")
+ return space.newbytes("")
result = rffi.charp2str(ccpresult) # TODO: make it a choice to free
- return space.wrap(result)
+ return space.newbytes(result)
class ConstructorExecutor(FunctionExecutor):
@@ -141,7 +141,7 @@
from pypy.module.cppyy import interp_cppyy
newthis = capi.c_constructor(space, cppmethod, cpptype, num_args, args)
assert lltype.typeOf(newthis) == capi.C_OBJECT
- return space.wrap(rffi.cast(rffi.LONG, newthis)) # really want
ptrdiff_t here
+ return space.newlong(rffi.cast(rffi.LONG, newthis)) # really want
ptrdiff_t here
class InstancePtrExecutor(FunctionExecutor):
@@ -202,7 +202,7 @@
cstr, cstr_len = capi.c_call_s(space, cppmethod, cppthis, num_args,
args)
pystr = rffi.charpsize2str(cstr, cstr_len)
capi.c_free(space, rffi.cast(rffi.VOIDP, cstr))
- return space.wrap(pystr)
+ return space.newbytes(pystr)
def execute_libffi(self, space, cif_descr, funcaddr, buffer):
from pypy.module.cppyy.interp_cppyy import FastCallNotPossible
diff --git a/pypy/module/cppyy/ffitypes.py b/pypy/module/cppyy/ffitypes.py
--- a/pypy/module/cppyy/ffitypes.py
+++ b/pypy/module/cppyy/ffitypes.py
@@ -57,7 +57,7 @@
return arg
def _wrap_object(self, space, obj):
- return space.wrap(bool(ord(rffi.cast(rffi.CHAR, obj))))
+ return space.newbool(bool(ord(rffi.cast(rffi.CHAR, obj))))
def cffi_type(self, space):
state = space.fromcache(State)
@@ -214,7 +214,7 @@
return r_singlefloat(space.float_w(w_obj))
def _wrap_object(self, space, obj):
- return space.wrap(float(obj))
+ return space.newfloat(float(obj))
def cffi_type(self, space):
state = space.fromcache(State)
diff --git a/pypy/module/cppyy/interp_cppyy.py
b/pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py
+++ b/pypy/module/cppyy/interp_cppyy.py
@@ -43,7 +43,7 @@
errmsg = "failed to load cdll"
else:
errmsg = e.msg
- raise OperationError(space.w_RuntimeError, space.wrap(str(errmsg)))
+ raise OperationError(space.w_RuntimeError, space.newtext(str(errmsg)))
return W_CPPLibrary(space, cdll)
class State(object):
@@ -63,7 +63,7 @@
if state.w_nullptr is None:
from pypy.module._rawffi.interp_rawffi import unpack_simple_shape
from pypy.module._rawffi.array import W_Array, W_ArrayInstance
- arr = space.interp_w(W_Array, unpack_simple_shape(space,
space.wrap('P')))
+ arr = space.interp_w(W_Array, unpack_simple_shape(space,
space.newtext('P')))
# TODO: fix this hack; fromaddress() will allocate memory if address
# is null and there seems to be no way around it (ll_buffer can not
# be touched directly)
@@ -75,7 +75,7 @@
@unwrap_spec(name=str)
def resolve_name(space, name):
- return space.wrap(capi.c_resolve_name(space, name))
+ return space.newtext(capi.c_resolve_name(space, name))
@unwrap_spec(name=str)
def scope_byname(space, name):
@@ -121,7 +121,7 @@
return None
def std_string_name(space):
- return space.wrap(capi.std_string_name)
+ return space.newtext(capi.std_string_name)
@unwrap_spec(w_callback=W_Root)
def set_class_generator(space, w_callback):
@@ -134,7 +134,7 @@
state.w_fngen_callback = w_callback
def register_class(space, w_pycppclass):
- w_cppclass = space.findattr(w_pycppclass, space.wrap("_cpp_proxy"))
+ w_cppclass = space.findattr(w_pycppclass, space.newtext("_cpp_proxy"))
cppclass = space.interp_w(W_CPPClass, w_cppclass, can_be_None=False)
# add back-end specific method pythonizations (doing this on the wrapped
# class allows simple aliasing of methods)
@@ -443,7 +443,7 @@
try:
s = self.space.str_w(args_w[i])
except OperationError:
- s = self.space.str_w(self.space.getattr(args_w[i],
self.space.wrap('__name__')))
+ s = self.space.str_w(self.space.getattr(args_w[i],
self.space.newtext('__name__')))
s = capi.c_resolve_name(self.space, s)
if s != self.templ_args[i]:
raise oefmt(self.space.w_TypeError,
@@ -549,7 +549,7 @@
# only get here if all overloads failed ...
errmsg = 'none of the %d overloaded methods succeeded. Full details:'
% len(self.functions)
if hasattr(self.space, "fake"): # FakeSpace fails errorstr (see
below)
- raise OperationError(self.space.w_TypeError,
self.space.wrap(errmsg))
+ raise OperationError(self.space.w_TypeError,
self.space.newtext(errmsg))
w_exc_type = None
all_same_type = True
for i in range(len(self.functions)):
@@ -573,15 +573,15 @@
errmsg += ' Exception: '+str(e)
if all_same_type and w_exc_type is not None:
- raise OperationError(w_exc_type, self.space.wrap(errmsg))
+ raise OperationError(w_exc_type, self.space.newtext(errmsg))
else:
- raise OperationError(self.space.w_TypeError,
self.space.wrap(errmsg))
+ raise OperationError(self.space.w_TypeError,
self.space.newtext(errmsg))
def signature(self):
sig = self.functions[0].signature()
for i in range(1, len(self.functions)):
sig += '\n'+self.functions[i].signature()
- return self.space.wrap(sig)
+ return self.space.newtext(sig)
def __repr__(self):
return "W_CPPOverload(%s)" % [f.signature() for f in self.functions]
@@ -774,7 +774,7 @@
return capi.c_scoped_final_name(self.space, self.handle)
def get_method_names(self):
- return self.space.newlist([self.space.wrap(name) for name in
self.methods])
+ return self.space.newlist([self.space.newtext(name) for name in
self.methods])
def get_overload(self, name):
try:
@@ -786,7 +786,7 @@
return new_method
def get_datamember_names(self):
- return self.space.newlist([self.space.wrap(name) for name in
self.datamembers])
+ return self.space.newlist([self.space.newtext(name) for name in
self.datamembers])
def get_datamember(self, name):
try:
@@ -879,17 +879,17 @@
alldir = []
for i in range(capi.c_num_scopes(self.space, self)):
sname = capi.c_scope_name(self.space, self, i)
- if sname: alldir.append(self.space.wrap(sname))
+ if sname: alldir.append(self.space.newtext(sname))
allmeth = {}
for i in range(capi.c_num_methods(self.space, self)):
idx = capi.c_method_index_at(self.space, self, i)
mname = capi.c_method_name(self.space, self, idx)
if mname: allmeth.setdefault(mname, 0)
for m in allmeth.keys():
- alldir.append(self.space.wrap(m))
+ alldir.append(self.space.newtext(m))
for i in range(capi.c_num_datamembers(self.space, self)):
dname = capi.c_datamember_name(self.space, self, i)
- if dname: alldir.append(self.space.wrap(dname))
+ if dname: alldir.append(self.space.newtext(dname))
return self.space.newlist(alldir)
@@ -977,7 +977,7 @@
num_bases = capi.c_num_bases(self.space, self)
for i in range(num_bases):
base_name = capi.c_base_name(self.space, self, i)
- bases.append(self.space.wrap(base_name))
+ bases.append(self.space.newtext(base_name))
return self.space.newlist(bases)
W_CPPClass.typedef = TypeDef(
@@ -1073,7 +1073,7 @@
# allow user to determine ownership rules on a per object level
def fget_python_owns(self, space):
- return space.wrap(self.python_owns)
+ return space.newbool(self.python_owns)
@unwrap_spec(value=bool)
def fset_python_owns(self, space, value):
@@ -1112,7 +1112,7 @@
def instance__eq__(self, w_other):
# special case: if other is None, compare pointer-style
if self.space.is_w(w_other, self.space.w_None):
- return self.space.wrap(not self._rawobject)
+ return self.space.newbool(not self._rawobject)
# get here if no class-specific overloaded operator is available, try
to
# find a global overload in gbl, in __gnu_cxx (for iterators), or in
the
@@ -1143,7 +1143,7 @@
# the first data member in a struct and the struct have the same
address)
other = self.space.interp_w(W_CPPInstance, w_other, can_be_None=False)
# TODO: factor out
iseq = (self._rawobject == other._rawobject) and (self.cppclass ==
other.cppclass)
- return self.space.wrap(iseq)
+ return self.space.newbool(iseq)
def instance__ne__(self, w_other):
return self.space.not_(self.instance__eq__(w_other))
@@ -1171,7 +1171,7 @@
w_as_builtin = self._get_as_builtin()
if w_as_builtin is not None:
return self.space.repr(w_as_builtin)
- return self.space.wrap("<%s object at 0x%x>" %
+ return self.space.newtext("<%s object at 0x%x>" %
(self.cppclass.name, rffi.cast(rffi.ULONG,
self.get_rawobject())))
def destruct(self):
@@ -1237,12 +1237,12 @@
except KeyError:
final_name = capi.c_scoped_final_name(space, handle)
# the callback will cache the class by calling register_class
- w_pycppclass = space.call_function(state.w_clgen_callback,
space.wrap(final_name))
+ w_pycppclass = space.call_function(state.w_clgen_callback,
space.newtext(final_name))
return w_pycppclass
def get_interface_func(space, w_callable, npar):
state = space.fromcache(State)
- return space.call_function(state.w_fngen_callback, w_callable,
space.wrap(npar))
+ return space.call_function(state.w_fngen_callback, w_callable,
space.newint(npar))
def wrap_cppobject(space, rawobject, cppclass,
do_cast=True, python_owns=False, is_ref=False, fresh=False):
@@ -1257,7 +1257,7 @@
w_pycppclass = get_pythonized_cppclass(space, actual)
offset = capi.c_base_offset1(space, actual, cppclass,
rawobject, -1)
rawobject = capi.direct_ptradd(rawobject, offset)
- w_cppclass = space.findattr(w_pycppclass,
space.wrap("_cpp_proxy"))
+ w_cppclass = space.findattr(w_pycppclass,
space.newtext("_cpp_proxy"))
cppclass = space.interp_w(W_CPPClass, w_cppclass,
can_be_None=False)
except Exception:
# failed to locate/build the derived class, so stick to the
base (note
@@ -1294,7 +1294,7 @@
def addressof(space, w_obj):
"""Takes a bound C++ instance or array, returns the raw address."""
address = _addressof(space, w_obj)
- return space.wrap(address)
+ return space.newlong(address)
@unwrap_spec(owns=bool, cast=bool)
def bind_object(space, w_obj, w_pycppclass, owns=False, cast=False):
@@ -1305,7 +1305,7 @@
except Exception:
# accept integer value as address
rawobject = rffi.cast(capi.C_OBJECT, space.uint_w(w_obj))
- w_cppclass = space.findattr(w_pycppclass, space.wrap("_cpp_proxy"))
+ w_cppclass = space.findattr(w_pycppclass, space.newtext("_cpp_proxy"))
if not w_cppclass:
w_cppclass = scope_byname(space, space.str_w(w_pycppclass))
if not w_cppclass:
diff --git a/pypy/module/cppyy/test/test_advancedcpp.py
b/pypy/module/cppyy/test/test_advancedcpp.py
--- a/pypy/module/cppyy/test/test_advancedcpp.py
+++ b/pypy/module/cppyy/test/test_advancedcpp.py
@@ -18,8 +18,8 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_test_dct = cls.space.wrap(test_dct)
- cls.w_capi_identity = cls.space.wrap(capi.identify())
+ cls.w_test_dct = cls.space.newtext(test_dct)
+ cls.w_capi_identity = cls.space.newtext(capi.identify())
cls.w_advanced = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_cint.py
b/pypy/module/cppyy/test/test_cint.py
--- a/pypy/module/cppyy/test/test_cint.py
+++ b/pypy/module/cppyy/test/test_cint.py
@@ -169,11 +169,11 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_N = cls.space.wrap(5)
- cls.w_M = cls.space.wrap(10)
- cls.w_fname = cls.space.wrap("test.root")
- cls.w_tname = cls.space.wrap("test")
- cls.w_title = cls.space.wrap("test tree")
+ cls.w_N = cls.space.newint(5)
+ cls.w_M = cls.space.newint(10)
+ cls.w_fname = cls.space.newtext("test.root")
+ cls.w_tname = cls.space.newtext("test")
+ cls.w_title = cls.space.newtext("test tree")
cls.w_iotypes = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (iotypes_dct,))
diff --git a/pypy/module/cppyy/test/test_crossing.py
b/pypy/module/cppyy/test/test_crossing.py
--- a/pypy/module/cppyy/test/test_crossing.py
+++ b/pypy/module/cppyy/test/test_crossing.py
@@ -73,7 +73,7 @@
def setup_class(cls):
# cppyy specific additions (note that test_dct is loaded late
# to allow the generated extension module be loaded first)
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_pre_imports = cls.space.appexec([], """():
import ctypes, cppyy""") # prevents leak-checking complaints on
ctypes' statics
@@ -105,7 +105,7 @@
from pypy.module.imp.importing import get_so_extension
fullmodname = os.path.join(
os.path.dirname(mod), name + get_so_extension(space))
- return space.wrap(fullmodname)
+ return space.newtext(fullmodname)
self.w_create_cdll = self.space.wrap(interp2app(create_cdll))
diff --git a/pypy/module/cppyy/test/test_datatypes.py
b/pypy/module/cppyy/test/test_datatypes.py
--- a/pypy/module/cppyy/test/test_datatypes.py
+++ b/pypy/module/cppyy/test/test_datatypes.py
@@ -12,7 +12,7 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_datatypes = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_fragile.py
b/pypy/module/cppyy/test/test_fragile.py
--- a/pypy/module/cppyy/test/test_fragile.py
+++ b/pypy/module/cppyy/test/test_fragile.py
@@ -17,8 +17,8 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_test_dct = cls.space.wrap(test_dct)
- cls.w_identity = cls.space.wrap(capi.identify())
+ cls.w_test_dct = cls.space.newtext(test_dct)
+ cls.w_identity = cls.space.newtext(capi.identify())
cls.w_fragile = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_operators.py
b/pypy/module/cppyy/test/test_operators.py
--- a/pypy/module/cppyy/test/test_operators.py
+++ b/pypy/module/cppyy/test/test_operators.py
@@ -15,8 +15,8 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_N = cls.space.wrap(5) # should be imported from the dictionary
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_N = cls.space.newint(5) # should be imported from the dictionary
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_operators = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_overloads.py
b/pypy/module/cppyy/test/test_overloads.py
--- a/pypy/module/cppyy/test/test_overloads.py
+++ b/pypy/module/cppyy/test/test_overloads.py
@@ -16,7 +16,7 @@
def setup_class(cls):
env = os.environ
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_overloads = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_pythonify.py
b/pypy/module/cppyy/test/test_pythonify.py
--- a/pypy/module/cppyy/test/test_pythonify.py
+++ b/pypy/module/cppyy/test/test_pythonify.py
@@ -14,7 +14,7 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_example01 = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
@@ -372,7 +372,7 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_example01 = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_stltypes.py
b/pypy/module/cppyy/test/test_stltypes.py
--- a/pypy/module/cppyy/test/test_stltypes.py
+++ b/pypy/module/cppyy/test/test_stltypes.py
@@ -15,8 +15,8 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_N = cls.space.wrap(13)
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_N = cls.space.newint(13)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_stlvector = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
@@ -203,7 +203,7 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_stlstring = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
@@ -279,8 +279,8 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_N = cls.space.wrap(13)
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_N = cls.space.newint(13)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_stlstring = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
@@ -335,8 +335,8 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_N = cls.space.wrap(13)
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_N = cls.space.newint(13)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_stlstring = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
@@ -444,7 +444,7 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_stlstring = cls.space.appexec([], """():
import cppyy, sys
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
@@ -481,7 +481,7 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_stlstring = cls.space.appexec([], """():
import cppyy, sys
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_streams.py
b/pypy/module/cppyy/test/test_streams.py
--- a/pypy/module/cppyy/test/test_streams.py
+++ b/pypy/module/cppyy/test/test_streams.py
@@ -15,7 +15,7 @@
spaceconfig = dict(usemodules=['cppyy', '_rawffi', 'itertools'])
def setup_class(cls):
- cls.w_test_dct = cls.space.wrap(test_dct)
+ cls.w_test_dct = cls.space.newtext(test_dct)
cls.w_streams = cls.space.appexec([], """():
import cppyy
return cppyy.load_reflection_info(%r)""" % (test_dct, ))
diff --git a/pypy/module/cppyy/test/test_zjit.py
b/pypy/module/cppyy/test/test_zjit.py
--- a/pypy/module/cppyy/test/test_zjit.py
+++ b/pypy/module/cppyy/test/test_zjit.py
@@ -63,6 +63,10 @@
class FakeBase(W_Root):
typename = None
+class FakeBool(FakeBase):
+ typename = "bool"
+ def __init__(self, val):
+ self.val = val
class FakeInt(FakeBase):
typename = "int"
def __init__(self, val):
@@ -153,6 +157,30 @@
return FakeInt(int(obj))
assert 0
+ @specialize.argtype(1)
+ def newbool(self, obj):
+ return FakeBool(obj)
+
+ @specialize.argtype(1)
+ def newint(self, obj):
+ return FakeInt(obj)
+
+ @specialize.argtype(1)
+ def newlong(self, obj):
+ return FakeInt(obj)
+
+ @specialize.argtype(1)
+ def newfloat(self, obj):
+ return FakeFloat(obj)
+
+ @specialize.argtype(1)
+ def newbytes(self, obj):
+ return FakeString(obj)
+
+ @specialize.argtype(1)
+ def newtext(self, obj):
+ return FakeString(obj)
+
def float_w(self, w_obj, allow_conversion=True):
assert isinstance(w_obj, FakeFloat)
return w_obj.val
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit