[Python-checkins] cpython: Issue #19437: Fix Array_subscript() of ctypes, handle Array_item() failure

victor.stinner python-checkins at python.org
Tue Oct 29 19:45:49 CET 2013


http://hg.python.org/cpython/rev/1e5bbaed79ca
changeset:   86740:1e5bbaed79ca
parent:      86735:6fdbb81b4020
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Oct 29 16:05:14 2013 +0100
summary:
  Issue #19437: Fix Array_subscript() of ctypes, handle Array_item() failure

files:
  Modules/_ctypes/_ctypes.c |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -4280,6 +4280,10 @@
         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;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list