Author: Carl Friedrich Bolz <[email protected]>
Branch: space-newtext
Changeset: r88655:97f865748606
Date: 2016-11-25 11:20 +0100
http://bitbucket.org/pypy/pypy/changeset/97f865748606/
Log: remove the remaining relevant wraps in micronumpy (hopefully)
diff --git a/pypy/module/micronumpy/appbridge.py
b/pypy/module/micronumpy/appbridge.py
--- a/pypy/module/micronumpy/appbridge.py
+++ b/pypy/module/micronumpy/appbridge.py
@@ -18,7 +18,7 @@
def call_method(self, space, path, name, args):
w_method = getattr(self, 'w_' + name)
if w_method is None:
- w_method = space.appexec([space.wrap(path), space.wrap(name)],
+ w_method = space.appexec([space.newtext(path),
space.newtext(name)],
"(path, name): return getattr(__import__(path,
fromlist=[name]), name)")
setattr(self, 'w_' + name, w_method)
return space.call_args(w_method, args)
diff --git a/pypy/module/micronumpy/boxes.py b/pypy/module/micronumpy/boxes.py
--- a/pypy/module/micronumpy/boxes.py
+++ b/pypy/module/micronumpy/boxes.py
@@ -613,7 +613,8 @@
class W_CharacterBox(W_FlexibleBox):
def convert_to(self, space, dtype):
- return dtype.coerce(space, space.wrap(self.raw_str()))
+ # XXX should be newbytes?
+ return dtype.coerce(space, space.newtext(self.raw_str()))
def descr_len(self, space):
return space.len(self.item(space))
diff --git a/pypy/module/micronumpy/compile.py
b/pypy/module/micronumpy/compile.py
--- a/pypy/module/micronumpy/compile.py
+++ b/pypy/module/micronumpy/compile.py
@@ -409,9 +409,12 @@
def newdict(self, module=True):
return DictObject({})
+ @specialize.argtype(1)
def newint(self, i):
if isinstance(i, IntObject):
return i
+ if isinstance(i, base_int):
+ return LongObject(i)
return IntObject(i)
def setitem(self, obj, index, value):
diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py
--- a/pypy/module/micronumpy/ctors.py
+++ b/pypy/module/micronumpy/ctors.py
@@ -468,7 +468,7 @@
val = dtype.itemtype.default_fromstring(space)
else:
try:
- val = dtype.coerce(space, space.wrap(piece))
+ val = dtype.coerce(space, space.newtext(piece))
except OperationError as e:
if not e.match(space, space.w_ValueError):
raise
@@ -476,7 +476,7 @@
while not gotit and len(piece) > 0:
piece = piece[:-1]
try:
- val = dtype.coerce(space, space.wrap(piece))
+ val = dtype.coerce(space, space.newtext(piece))
gotit = True
except OperationError as e:
if not e.match(space, space.w_ValueError):
diff --git a/pypy/module/micronumpy/ndarray.py
b/pypy/module/micronumpy/ndarray.py
--- a/pypy/module/micronumpy/ndarray.py
+++ b/pypy/module/micronumpy/ndarray.py
@@ -1271,7 +1271,7 @@
op_name, self.get_dtype().get_name())
shape = self.get_shape()
if space.is_none(w_axis) or len(shape) <= 1:
- return space.wrap(getattr(loop, op_name_flat)(self))
+ return space.newint(getattr(loop, op_name_flat)(self))
else:
axis = space.int_w(w_axis)
assert axis >= 0
@@ -1359,7 +1359,7 @@
assert isinstance(multiarray, MixedModule)
reconstruct = multiarray.get("_reconstruct")
parameters = space.newtuple([self.getclass(space), space.newtuple(
- [space.newint(0)]), space.wrap("b")])
+ [space.newint(0)]), space.newtext("b")])
builder = StringBuilder()
if self.get_dtype().is_object():
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -462,7 +462,7 @@
signed = True
def to_builtin_type(self, space, box):
- return space.wrap(self.for_computation(self.unbox(box)))
+ return space.newint(self.for_computation(self.unbox(box)))
def _base_coerce(self, space, w_item):
if w_item is None:
diff --git a/pypy/module/micronumpy/ufuncs.py b/pypy/module/micronumpy/ufuncs.py
--- a/pypy/module/micronumpy/ufuncs.py
+++ b/pypy/module/micronumpy/ufuncs.py
@@ -1206,7 +1206,7 @@
nargs = interp_attrproperty("nargs", cls=W_Ufunc,
wrapfn="newint"),
signature = interp_attrproperty("signature", cls=W_Ufunc,
- wrapfn="newtext"),
+ wrapfn="newtext_or_none"),
reduce = interp2app(W_Ufunc.descr_reduce),
outer = interp2app(W_Ufunc.descr_outer),
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit