summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2018-12-11 00:07:48 +0200
committerGitHub <noreply@github.com>2018-12-11 00:07:48 +0200
commit53fdc54545ad541f70fad06c38bdfe65d77ccb31 (patch)
tree6741aeaa9920ed3aa750f3b4305f6afaabf42256 /numpy
parentc1bc15d1d968820b1fd306f00d3c035d5eb10709 (diff)
parentb3692e0d1be09892e098d8abdb318fb9f5eee0fd (diff)
downloadnumpy-53fdc54545ad541f70fad06c38bdfe65d77ccb31.tar.gz
Merge pull request #12528 from ahaldane/fix_reshape_getitem
MAINT: fix an unsafe PyTuple_GET_ITEM call
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/methods.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/methods.c
index 231bd86dc..6254114cc 100644
--- a/numpy/core/src/multiarray/methods.c
+++ b/numpy/core/src/multiarray/methods.c
@@ -187,7 +187,7 @@ array_reshape(PyArrayObject *self, PyObject *args, PyObject *kwds)
}
if (n <= 1) {
- if (PyTuple_GET_ITEM(args, 0) == Py_None) {
+ if (n != 0 && PyTuple_GET_ITEM(args, 0) == Py_None) {
return PyArray_View(self, NULL, NULL);
}
if (!PyArg_ParseTuple(args, "O&:reshape", PyArray_IntpConverter,