summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-01-19 16:54:26 -0800
committerCharles Harris <charlesr.harris@gmail.com>2013-01-19 16:54:26 -0800
commit56b06fe5bf20d11ca8188a00333ddf69ed8b2e42 (patch)
tree9ae1cba6de87ab059aa5de9a1ec2fa91889f6acc
parentee5fd949b962735d6282fb6f6e08c5c54c1edd4d (diff)
parent51495ffc5d56d33d15a80f250c7d36038783af3e (diff)
downloadnumpy-56b06fe5bf20d11ca8188a00333ddf69ed8b2e42.tar.gz
Merge pull request #2933 from seberg/result_type-segfault
BUG: Fix segfault in np.result_type for None input.
-rw-r--r--numpy/core/src/multiarray/multiarraymodule.c2
-rw-r--r--numpy/core/tests/test_numeric.py1
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