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

serhiy.storchaka python-checkins at python.org
Wed Feb 12 08:56:13 CET 2014


http://hg.python.org/cpython/rev/ffc4f03adcac
changeset:   89165:ffc4f03adcac
branch:      3.3
parent:      89160:188c046d7afb
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Feb 12 09:55:01 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
@@ -300,7 +300,8 @@
                     else
                         PyErr_Clear();
                 }
-                PyDict_SetItem(d, key, Py_None);
+                if (PyDict_SetItem(d, key, Py_None) != 0)
+                    PyErr_Clear();
             }
         }
     }
@@ -319,7 +320,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