summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/common.c8
-rw-r--r--numpy/core/tests/test_multiarray.py4
2 files changed, 9 insertions, 3 deletions
diff --git a/numpy/core/src/multiarray/common.c b/numpy/core/src/multiarray/common.c
index 5b17ad28c..546883ddd 100644
--- a/numpy/core/src/multiarray/common.c
+++ b/numpy/core/src/multiarray/common.c
@@ -253,7 +253,8 @@ _array_find_type(PyObject *op, PyArray_Descr *minitype, int max)
}
if (minitype == NULL) {
minitype = chktype;
- } else {
+ }
+ else {
newtype = PyArray_PromoteTypes(chktype, minitype);
Py_DECREF(minitype);
minitype = newtype;
@@ -273,7 +274,8 @@ _array_find_type(PyObject *op, PyArray_Descr *minitype, int max)
finish:
if (minitype == NULL) {
outtype = chktype;
- } else {
+ }
+ else {
outtype = PyArray_PromoteTypes(chktype, minitype);
Py_DECREF(chktype);
Py_DECREF(minitype);
@@ -286,7 +288,7 @@ _array_find_type(PyObject *op, PyArray_Descr *minitype, int max)
* unless input was already a VOID
*/
if (outtype->type_num == PyArray_VOID &&
- minitype->type_num != PyArray_VOID) {
+ (minitype == NULL || minitype->type_num != PyArray_VOID)) {
Py_DECREF(outtype);
return PyArray_DescrFromType(NPY_OBJECT);
}
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index 03f1b10c6..b9dfcddf9 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -327,6 +327,10 @@ class TestCreation(TestCase):
msg = 'String conversion for %s' % type
assert_equal(array(nstr, dtype=type), result, err_msg=msg)
+ def test_void(self):
+ arr = np.array([np.void(0)], dtype='V')
+ assert_equal(arr.dtype.kind, 'V')
+
def test_non_sequence_sequence(self):
"""Should not segfault.