[pypy-commit] pypy refactor-signature: kill some dead code and a failing test

fijal noreply at buildbot.pypy.org
Tue Dec 20 23:08:20 CET 2011


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: refactor-signature
Changeset: r50781:5bb7c7ef1481
Date: 2011-12-21 00:05 +0200
http://bitbucket.org/pypy/pypy/changeset/5bb7c7ef1481/

Log:	kill some dead code and a failing test

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
@@ -468,9 +468,6 @@
     def descr_getitem(self, space, w_idx):
         if self._single_item_result(space, w_idx):
             concrete = self.get_concrete()
-            if len(concrete.shape) < 1:
-                raise OperationError(space.w_IndexError, space.wrap(
-                        "0-d arrays can't be indexed"))
             item = concrete._index_of_single_item(space, w_idx)
             return concrete.getitem(item)
         chunks = self._prepare_slice_args(space, w_idx)
@@ -480,9 +477,6 @@
         self.invalidated()
         if self._single_item_result(space, w_idx):
             concrete = self.get_concrete()
-            if len(concrete.shape) < 1:
-                raise OperationError(space.w_IndexError, space.wrap(
-                        "0-d arrays can't be indexed"))
             item = concrete._index_of_single_item(space, w_idx)
             dtype = concrete.find_dtype()
             concrete.setitem(item, dtype.coerce(space, w_value))
@@ -642,9 +636,6 @@
     def find_dtype(self):
         return self.dtype
 
-    def getitem(self, item):
-        raise NotImplementedError
-
     def to_str(self, space, comma, builder, indent=' ', use_ellipsis=False):
         builder.append(self.dtype.itemtype.str_format(self.value))
 
@@ -657,10 +648,6 @@
     def get_concrete_or_scalar(self):
         return self
 
-
-    def get_storage(self, space):
-        raise OperationError(space.w_TypeError, space.wrap("Cannot get array interface on scalars in pypy"))
-
 class VirtualArray(BaseArray):
     """
     Class for representing virtual arrays, such as binary ops or ufuncs
@@ -1065,9 +1052,6 @@
     def create_sig(self, res_shape):
         return self.array_sig(res_shape)
 
-    def get_storage(self, space):
-        return self.storage
-
     def __del__(self):
         lltype.free(self.storage, flavor='raw', track_allocation=False)
 
diff --git a/pypy/module/micronumpy/test/test_numarray.py b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -910,6 +910,11 @@
         c = (a + a)
         d = c[::2][::2]
         assert d[1] == 8
+        b = a + a
+        c = c[::2]
+        c[:] = 3
+        assert b[0] == 3
+        assert b[1] == 4
 
     def test_tolist_scalar(self):
         from numpypy import int32, bool_


More information about the pypy-commit mailing list