summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-06-05 15:37:30 -0600
committerGitHub <noreply@github.com>2018-06-05 15:37:30 -0600
commit43dfd505ef218fc0ff6af18826bee07bcff35ffc (patch)
tree7dd1e9cfe47eee6a1565f648b68f91dd2b49386a /numpy
parent5b8b1349ed194516b5e1804b63ff4266bca286ab (diff)
parent024cfe13767ad8a5e6a2693ed9ff56df1d122437 (diff)
downloadnumpy-43dfd505ef218fc0ff6af18826bee07bcff35ffc.tar.gz
Merge pull request #11249 from eric-wieser/0d-complex-contiguous
BUG: Remove errant flag meddling in .real and .imag
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/getset.c1
-rw-r--r--numpy/core/tests/test_multiarray.py16
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):