diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-06-04 23:58:12 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-06-05 09:51:44 -0700 |
commit | 024cfe13767ad8a5e6a2693ed9ff56df1d122437 (patch) | |
tree | 824c423effef554af9b0c64366692eaf1751cf59 /numpy | |
parent | 1e11149de47929cafbbc0108beae4702e7ffc2a9 (diff) | |
download | numpy-024cfe13767ad8a5e6a2693ed9ff56df1d122437.tar.gz |
BUG: Remove errant flag meddling in .real and .imag
Fixes #11245
PyArray_NewFromDescr sets the flags just fine by itself.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/getset.c | 1 | ||||
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 16 |
2 files changed, 16 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/getset.c b/numpy/core/src/multiarray/getset.c index 86e6e7a2f..d86f90a53 100644 --- a/numpy/core/src/multiarray/getset.c +++ b/numpy/core/src/multiarray/getset.c @@ -758,7 +758,6 @@ _get_part(PyArrayObject *self, int imag) Py_DECREF(ret); return NULL; } - PyArray_CLEARFLAGS(ret, NPY_ARRAY_C_CONTIGUOUS | NPY_ARRAY_F_CONTIGUOUS); return ret; } diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index a60f2cd92..3bc7e92c1 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -573,6 +573,22 @@ class TestZeroRank(object): x = np.array(2) assert_raises(ValueError, np.add, x, [1], x) + def test_real_imag(self): + # contiguity checks are for gh-11245 + x = np.array(1j) + xr = x.real + xi = x.imag + + assert_equal(xr, np.array(0)) + assert_(type(xr) is np.ndarray) + assert_equal(xr.flags.contiguous, True) + assert_equal(xr.flags.f_contiguous, True) + + assert_equal(xi, np.array(1)) + assert_(type(xi) is np.ndarray) + assert_equal(xi.flags.contiguous, True) + assert_equal(xi.flags.f_contiguous, True) + class TestScalarIndexing(object): def setup(self): |