[Python-checkins] cpython (3.3): Add missing check of PyDict_SetItem()'s return value

christian.heimes python-checkins at python.org
Sat Jul 20 15:02:00 CEST 2013


http://hg.python.org/cpython/rev/656954ec54a1
changeset:   84732:656954ec54a1
branch:      3.3
parent:      84730:b719f041f849
user:        Christian Heimes <christian at cheimes.de>
date:        Sat Jul 20 15:01:26 2013 +0200
summary:
  Add missing check of PyDict_SetItem()'s return value
CID 486659

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


diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -120,7 +120,10 @@
 
     for (i = 0; i < count; i++) {
         v = PyLong_FromLong(i);
-        PyDict_SetItem(dict, v, v);
+        if (PyDict_SetItem(dict, v, v) < 0) {
+            Py_DECREF(v);
+            return -1;
+        }
         Py_DECREF(v);
     }
 

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


More information about the Python-checkins mailing list