From 6decccdafe5bff96a5fff0f553dfd02bb5f8a589 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 29 Oct 2013 16:05:14 +0100 Subject: Issue #19437: Fix Array_subscript() of ctypes, handle Array_item() failure --- Modules/_ctypes/_ctypes.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index daba2ba..9c81247 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -4280,6 +4280,10 @@ Array_subscript(PyObject *myself, PyObject *item) for (cur = start, i = 0; i < slicelen; cur += step, i++) { PyObject *v = Array_item(myself, cur); + if (v == NULL) { + Py_DECREF(np); + return NULL; + } PyList_SET_ITEM(np, i, v); } return np; -- cgit v0.12