diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-10-29 15:05:14 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-10-29 15:05:14 (GMT) |
commit | 6decccdafe5bff96a5fff0f553dfd02bb5f8a589 (patch) | |
tree | 3b7802b9450e9b812120726014b8016c6460d384 | |
parent | db816d65464051ffa1aa2cce59dc7df721bbe873 (diff) | |
download | cpython-6decccdafe5bff96a5fff0f553dfd02bb5f8a589.zip cpython-6decccdafe5bff96a5fff0f553dfd02bb5f8a589.tar.gz cpython-6decccdafe5bff96a5fff0f553dfd02bb5f8a589.tar.bz2 |
Issue #19437: Fix Array_subscript() of ctypes, handle Array_item() failure
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 4 |
1 files changed, 4 insertions, 0 deletions
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; |