diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2013-01-19 23:33:16 +0100 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2013-01-19 23:33:16 +0100 |
commit | 51495ffc5d56d33d15a80f250c7d36038783af3e (patch) | |
tree | 6de0fdf57c534f516180ebd80fec95032b1d80e1 | |
parent | 27690e33fa2202ecb1bca338ff38320de84b27ea (diff) | |
download | numpy-51495ffc5d56d33d15a80f250c7d36038783af3e.tar.gz |
BUG: Fix segfault in np.result_type for None input.
Makes behavior identical to np.dtype(None), which fits to how
the function works.
-rw-r--r-- | numpy/core/src/multiarray/multiarraymodule.c | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_numeric.py | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c index f0cf3e5f9..f8ade57da 100644 --- a/numpy/core/src/multiarray/multiarraymodule.c +++ b/numpy/core/src/multiarray/multiarraymodule.c @@ -2875,7 +2875,7 @@ array_result_type(PyObject *NPY_UNUSED(dummy), PyObject *args) "too many arguments"); goto finish; } - if (!PyArray_DescrConverter2(obj, &dtypes[ndtypes])) { + if (!PyArray_DescrConverter(obj, &dtypes[ndtypes])) { goto finish; } ++ndtypes; diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py index f9c9cdf52..b6a9c5157 100644 --- a/numpy/core/tests/test_numeric.py +++ b/numpy/core/tests/test_numeric.py @@ -465,6 +465,7 @@ class TestTypes(TestCase): def test_result_type(self): self.check_promotion_cases(np.result_type) + assert_(np.result_type(None) == np.dtype(None)) def test_promote_types_endian(self): # promote_types should always return native-endian types |