Author: Ronan Lamy <[email protected]>
Branch:
Changeset: r77932:75e2c1d303eb
Date: 2015-06-07 02:36 +0100
http://bitbucket.org/pypy/pypy/changeset/75e2c1d303eb/
Log: Fix translation and allow order='K'
diff --git a/pypy/module/micronumpy/concrete.py
b/pypy/module/micronumpy/concrete.py
--- a/pypy/module/micronumpy/concrete.py
+++ b/pypy/module/micronumpy/concrete.py
@@ -345,10 +345,12 @@
if s < mins:
mins = s
t_strides = [s * t_elsize / mins for s in strides]
- if order not in ('C', 'F'):
+ if order == 'K':
+ pass
+ elif order not in ('C', 'F'):
raise oefmt(space.w_ValueError, "Unknown order %s in astype",
order)
- if order != self.order:
- t_strides = tstrides[::-1]
+ elif order != self.order:
+ t_strides.reverse()
backstrides = calc_backstrides(t_strides, shape)
else:
t_strides = []
@@ -379,7 +381,7 @@
gc._trace_callback(callback, arg, storage)
storage += step
i += 1
-
+
lambda_customtrace = lambda: customtrace
def _setup():
@@ -403,8 +405,6 @@
make_sure_not_resized(backstrides)
self.shape = shape
self.size = support.product(shape) * dtype.elsize
- if order not in ('C', 'F'):
- raise oefmt(space.w_ValueError, "Unknown order %s in astype",
order)
self.order = order
self.dtype = dtype
self.strides = strides
@@ -445,7 +445,7 @@
gcstruct = V_OBJECTSTORE
flags = NPY.ARRAY_ALIGNED | NPY.ARRAY_WRITEABLE
if storage == lltype.nullptr(RAW_STORAGE):
- length = support.product(shape)
+ length = support.product(shape)
if dtype.num == NPY.OBJECT:
storage = dtype.itemtype.malloc(length * dtype.elsize,
zero=True)
gcstruct = _create_objectstore(storage, length, dtype.elsize)
@@ -507,7 +507,7 @@
ConcreteArray.__init__(self, shape, dtype, order, strides, backstrides,
storage, zero)
self.flags &= ~ NPY.ARRAY_WRITEABLE
-
+
def descr_setitem(self, space, orig_array, w_index, w_value):
raise OperationError(space.w_ValueError, space.wrap(
"assignment destination is read-only"))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit