From 0e8edab421e3b20ff2f4085e06040101c2d9865f Mon Sep 17 00:00:00 2001 From: jaimefrio Date: Sun, 7 Dec 2014 19:32:36 -0800 Subject: BUG: digitize segfaults on TypeError The new searchsorted-based digitize introduced in #5101 segfaults when it should raise a TypeError. --- numpy/lib/tests/test_function_base.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'numpy/lib/tests/test_function_base.py') diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 80faf85a6..03521ca4c 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -861,6 +861,13 @@ class TestDigitize(TestCase): bins = [1, 1, 0, 1] assert_raises(ValueError, digitize, x, bins) + def test_casting_error(self): + x = [1, 2, 3+1.j] + bins = [1, 2, 3] + assert_raises(TypeError, digitize, x, bins) + x, bins = bins, x + assert_raises(TypeError, digitize, x, bins) + class TestUnwrap(TestCase): def test_simple(self): -- cgit v1.2.1