[pypy-commit] pypy numpy-multidim: make shape and chunks non-resizable lists
fijal
noreply at buildbot.pypy.org
Fri Oct 28 22:09:44 CEST 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-multidim
Changeset: r48590:d790f132a006
Date: 2011-10-28 22:08 +0200
http://bitbucket.org/pypy/pypy/changeset/d790f132a006/
Log: make shape and chunks non-resizable lists
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
@@ -61,7 +61,7 @@
dtype = space.interp_w(interp_dtype.W_Dtype,
space.call_function(space.gettypefor(interp_dtype.W_Dtype), w_dtype)
)
- arr = NDimArray(size, shape, dtype=dtype)
+ arr = NDimArray(size, shape[:], dtype=dtype)
i = 0
for i in range(len(elems_w)):
w_elem = elems_w[i]
@@ -345,8 +345,8 @@
shape[i] = -1
else:
shape[i] = lgt
- shape = [i for i in shape if i != -1]
- return NDimSlice(self, new_sig, chunks, shape)
+ shape = [i for i in shape if i != -1][:]
+ return NDimSlice(self, new_sig, chunks[:], shape)
def descr_getitem(self, space, w_idx):
if self._single_item_result(space, w_idx):
@@ -576,7 +576,7 @@
class NDimSlice(ViewArray):
signature = signature.BaseSignature()
-
+
def __init__(self, parent, signature, chunks, shape):
ViewArray.__init__(self, parent, signature, shape)
self.chunks = chunks
More information about the pypy-commit
mailing list