Author: Matti Picus <[email protected]>
Branch: pypy-pyarray
Changeset: r67047:746c18a936f7
Date: 2013-09-22 00:21 +0300
http://bitbucket.org/pypy/pypy/changeset/746c18a936f7/
Log: move 61c630f73ba3 to branch and remove untested __array_prepare__,
__array_wrap__
diff --git a/pypy/module/micronumpy/interp_numarray.py
b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -437,22 +437,6 @@
# stub implementation of __array__()
return self
- def descr___array_prepare__(self, space, w_array):
- # stub implementation of __array_prepare__()
- if isinstance(w_array, W_NDimArray):
- return w_array
- else:
- raise OperationError(space.w_TypeError,
- space.wrap("can only be called with ndarray
object"))
-
- def descr___array_wrap__(self, space, w_array):
- # stub implementation of __array_wrap__()
- if isinstance(w_array, W_NDimArray):
- return w_array
- else:
- raise OperationError(space.w_TypeError,
- space.wrap("can only be called with ndarray
object"))
-
def descr_array_iface(self, space):
addr = self.implementation.get_storage_as_int(space)
# will explode if it can't
@@ -1157,8 +1141,6 @@
__array_finalize__ = interp2app(W_NDimArray.descr___array_finalize__),
__array__ = interp2app(W_NDimArray.descr___array__),
- __array_prepare__ = interp2app(W_NDimArray.descr___array_prepare__),
- __array_wrap__ = interp2app(W_NDimArray.descr___array_wrap__),
)
@unwrap_spec(ndmin=int, copy=bool, subok=bool)
diff --git a/pypy/module/micronumpy/test/test_subtype.py
b/pypy/module/micronumpy/test/test_subtype.py
--- a/pypy/module/micronumpy/test/test_subtype.py
+++ b/pypy/module/micronumpy/test/test_subtype.py
@@ -245,30 +245,3 @@
c = array(a, float)
assert c.dtype is dtype(float)
- def test___array_wrap__(self):
- from numpypy import ndarray, add, ones
- class with_wrap(object):
- called_wrap = False
- def __array__(self):
- return ones(1)
- def __array_wrap__(self, arr, context):
- self.called_wrap = True
- return arr
- a = with_wrap()
- x = add(a, a)
- assert x == 2
- assert type(x) == ndarray
- assert a.called_wrap
-
- def test___array_prepare__(self):
- from numpypy import ndarray, array, add, ones
- class with_prepare(ndarray):
- called_prepare = False
- def __array_prepare__(self, arr, context):
- self.called_prepare = True
- return array(arr).view(type=with_prepare)
- a = array(1).view(type=with_prepare)
- x = add(a, a)
- assert x == 2
- assert type(x) == with_prepare
- assert a.called_prepare
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit