diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-11-26 14:49:26 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-11-29 16:32:11 -0700 |
commit | e9ef83d72b8d5ca6828b16fc8cdf435905fe9bb0 (patch) | |
tree | f82a40f25c1d76654a5c389bf87d5132d3797acf /numpy/lib/tests/test_regression.py | |
parent | dac0e5d70e397857ea7d6cf10975de582003a82f (diff) | |
download | numpy-e9ef83d72b8d5ca6828b16fc8cdf435905fe9bb0.tar.gz |
DEP: Deprecate changing shape of non-C-contiguous array via descr.
This deprecates assignment of a new descriptor to the dtype attribute of
a non-C-contiguous array if it result in changing the shape. This
effectively bars viewing a multidimensional Fortran array using a dtype
that changes the element size along the first axis.
The reason for the deprecation is that, when relaxed strides checking is
enabled, arrays that are both C and Fortran contiguous are always
treated as C contiguous which breaks some code that depended the two
being mutually exclusive for arrays of dimension > 1. The intent of this
deprecation is to prepare the way to always enable relaxed stride
checking.
Example
-------
```
In [1]: import warnings
In [2]: warnings.simplefilter('always')
In [3]: a = ones((2, 1), order='F').view(complex)
/home/charris/.local/bin/ipython:1: DeprecationWarning: Changing the shape
of non-C contiguous array by descriptor assignment is deprecated. To
maintain the Fortran contiguity of a multidimensional Fortran array, use
'a.T.view(...).T' instead
```
Diffstat (limited to 'numpy/lib/tests/test_regression.py')
0 files changed, 0 insertions, 0 deletions