Skip to content

Commit 53fdc54

Browse files
authored
Merge pull request numpy#12528 from ahaldane/fix_reshape_getitem
MAINT: fix an unsafe PyTuple_GET_ITEM call
2 parents c1bc15d + b3692e0 commit 53fdc54

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

numpy/core/src/multiarray/methods.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ array_reshape(PyArrayObject *self, PyObject *args, PyObject *kwds)
187187
}
188188

189189
if (n <= 1) {
190-
if (PyTuple_GET_ITEM(args, 0) == Py_None) {
190+
if (n != 0 && PyTuple_GET_ITEM(args, 0) == Py_None) {
191191
return PyArray_View(self, NULL, NULL);
192192
}
193193
if (!PyArg_ParseTuple(args, "O&:reshape", PyArray_IntpConverter,

0 commit comments

Comments
 (0)