diff options
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): |