Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix segfault when PyArray_VOID and no minitype in _array_find_type. #142

Closed
wants to merge 2 commits into from

2 participants

@charris
Owner

The patch doesn't apply. You need to do your work in a branch, not in master. And you need to keep master current.

@charris
Owner

I went ahead and hand applied it. I'm not sure why the patch from github didn't work, but you should never do work in the master branch, always use a working branch.

@charris charris closed this
@walshb

This was on a branch "fix_np_lookfor_segv" (https://github.com/walshb/numpy/tree/fix_np_lookfor_segv), but the branch was indeed taken from an older version of master. Thanks for applying it, anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  numpy/core/src/multiarray/common.c
@@ -286,7 +286,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(PyArray_OBJECT);
}
View
4 numpy/core/tests/test_multiarray.py
@@ -327,6 +327,10 @@ def test_from_string(self) :
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.
Something went wrong with that request. Please try again.