diff options
author | Jaime <jaime.frio@gmail.com> | 2014-12-30 03:48:56 -0800 |
---|---|---|
committer | Jaime <jaime.frio@gmail.com> | 2014-12-30 03:48:56 -0800 |
commit | fb898ce678c8d45364d1ee7b1a6d0308562a8ad9 (patch) | |
tree | 265fb0149ca981d326a3bf039655b5fcacd39a27 /numpy | |
parent | 1f6084a48b3a8a3b417573ac8aaf6932e585ccd0 (diff) | |
parent | 61f3b10a4fe6a2e5061230bf15d6afb7d6c442d1 (diff) | |
download | numpy-fb898ce678c8d45364d1ee7b1a6d0308562a8ad9.tar.gz |
Merge pull request #5386 from maniteja123/issue5354
BUG: Issue 5354 - Fixed segmentation fault when clipping complex arrays
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/arraytypes.c.src | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_numeric.py | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src index 89b5404b4..e3236ed3f 100644 --- a/numpy/core/src/multiarray/arraytypes.c.src +++ b/numpy/core/src/multiarray/arraytypes.c.src @@ -3598,8 +3598,6 @@ static void npy_intp i; @type@ max_val, min_val; - min_val = *min; - max_val = *max; if (max != NULL) { max_val = *max; } diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py index ea145ef81..d8b01a532 100644 --- a/numpy/core/tests/test_numeric.py +++ b/numpy/core/tests/test_numeric.py @@ -1176,6 +1176,18 @@ class TestClip(TestCase): act = self.clip(a, m, M) assert_array_strict_equal(ac, act) + def test_clip_complex(self): + # Address Issue gh-5354 for clipping complex arrays + # Test native complex input without explicit min/max + # ie, either min=None or max=None + a = np.ones(10, dtype=np.complex) + m = a.min() + M = a.max() + am = self.fastclip(a, m, None) + aM = self.fastclip(a, None, M) + assert_array_strict_equal(am, a) + assert_array_strict_equal(aM, a) + def test_clip_non_contig(self): #Test clip for non contiguous native input and native scalar min/max. a = self._generate_data(self.nr * 2, self.nc * 3) |