[pypy-commit] pypy default: sanity check

mattip noreply at buildbot.pypy.org
Sat Jun 6 20:46:58 CEST 2015


Author: mattip <matti.picus at gmail.com>
Branch: 
Changeset: r77929:057398c13698
Date: 2015-06-06 20:37 +0300
http://bitbucket.org/pypy/pypy/changeset/057398c13698/

Log:	sanity check

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,6 +345,10 @@
                 if s < mins:
                     mins = s
             t_strides = [s * t_elsize / mins for s in strides]
+            if order not in ('C', 'F'):
+                raise oefmt(space.w_ValueError, "Unknown order %s in astype", order)
+            if order != self.order:
+                t_strides = tstrides[::-1]
             backstrides = calc_backstrides(t_strides, shape)
         else:
             t_strides = []
@@ -399,6 +403,8 @@
         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


More information about the pypy-commit mailing list