[Python-checkins] cpython (3.4): Issue #19255: Clear error after failed PyDict_SetItem() on shutdown.

larry.hastings python-checkins at python.org
Mon Mar 17 07:33:00 CET 2014


http://hg.python.org/cpython/rev/af8f856db136
changeset:   89770:af8f856db136
branch:      3.4
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Feb 12 09:55:45 2014 +0200
summary:
  Issue #19255: Clear error after failed PyDict_SetItem() on shutdown.
This silences a Coverity complain.

files:
  Objects/moduleobject.c |  6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c
--- a/Objects/moduleobject.c
+++ b/Objects/moduleobject.c
@@ -330,7 +330,8 @@
                     else
                         PyErr_Clear();
                 }
-                PyDict_SetItem(d, key, Py_None);
+                if (PyDict_SetItem(d, key, Py_None) != 0)
+                    PyErr_Clear();
             }
         }
     }
@@ -349,7 +350,8 @@
                     else
                         PyErr_Clear();
                 }
-                PyDict_SetItem(d, key, Py_None);
+                if (PyDict_SetItem(d, key, Py_None) != 0)
+                    PyErr_Clear();
             }
         }
     }

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


More information about the Python-checkins mailing list