Author: Maciej Fijalkowski <fij...@gmail.com> Branch: Changeset: r75733:13cf744cbd9a Date: 2015-02-06 11:28 +0200 http://bitbucket.org/pypy/pypy/changeset/13cf744cbd9a/
Log: merge diff --git a/pypy/doc/cppyy.rst b/pypy/doc/cppyy.rst --- a/pypy/doc/cppyy.rst +++ b/pypy/doc/cppyy.rst @@ -74,7 +74,9 @@ See the :doc:`backend documentation <cppyy_backend>`. A standalone version of Reflex that also provides the dynamically loadable -backend is available for `download`_. +backend is available for `download`_. Note this is currently the only way to +get the dynamically loadable backend, so use this first. + That version, as well as any other distribution of Reflex (e.g. the one that comes with `ROOT`_, which may be part of your Linux distribution as part of the selection of scientific software) will also work for a build with the 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 @@ -77,12 +77,15 @@ else: new_strides = calc_new_strides(new_shape, self.get_shape(), self.get_strides(), self.order) + if new_strides is None or len(new_strides) != len(new_shape): + return None if new_strides is not None: # We can create a view, strides somehow match up. new_backstrides = calc_backstrides(new_strides, new_shape) assert isinstance(orig_array, W_NDimArray) or orig_array is None return SliceArray(self.start, new_strides, new_backstrides, new_shape, self, orig_array) + return None def get_view(self, space, orig_array, dtype, new_shape): strides, backstrides = calc_strides(new_shape, dtype, @@ -452,7 +455,7 @@ new_strides = calc_new_strides(new_shape, self.get_shape(), self.get_strides(), self.order) - if new_strides is None: + if new_strides is None or len(new_strides) != len(new_shape): raise oefmt(space.w_AttributeError, "incompatible shape for a non-contiguous array") new_backstrides = [0] * len(new_shape) diff --git a/pypy/module/micronumpy/ndarray.py b/pypy/module/micronumpy/ndarray.py --- a/pypy/module/micronumpy/ndarray.py +++ b/pypy/module/micronumpy/ndarray.py @@ -334,8 +334,12 @@ # Create copy with contiguous data arr = self.descr_copy(space) if arr.get_size() > 0: - arr.implementation = arr.implementation.reshape(self, new_shape) - assert arr.implementation + new_implementation = arr.implementation.reshape(self, new_shape) + if new_implementation is None: + raise oefmt(space.w_ValueError, + 'could not reshape array of size %d to shape %s', + arr.get_size(), str(new_shape)) + arr.implementation = new_implementation else: arr.implementation.shape = new_shape return arr diff --git a/pypy/module/micronumpy/strides.py b/pypy/module/micronumpy/strides.py --- a/pypy/module/micronumpy/strides.py +++ b/pypy/module/micronumpy/strides.py @@ -427,7 +427,6 @@ if oldI >= -len(old_shape): cur_step = steps[oldI] n_old_elems_to_use *= old_shape[oldI] - assert len(new_strides) == len(new_shape) return new_strides[:] @jit.unroll_safe _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit