]> granicus.if.org Git - python/commitdiff
Issue #19255: Clear error after failed PyDict_SetItem() on shutdown.
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 12 Feb 2014 07:55:01 +0000 (09:55 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 12 Feb 2014 07:55:01 +0000 (09:55 +0200)
This silences a Coverity complain.

Objects/moduleobject.c

index 2f2bd36b55d23fb19133a050c4de1e5991c1d0de..72978aef53a3227f58d3188b00452995f52790d8 100644 (file)
@@ -300,7 +300,8 @@ _PyModule_Clear(PyObject *m)
                     else
                         PyErr_Clear();
                 }
-                PyDict_SetItem(d, key, Py_None);
+                if (PyDict_SetItem(d, key, Py_None) != 0)
+                    PyErr_Clear();
             }
         }
     }
@@ -319,7 +320,8 @@ _PyModule_Clear(PyObject *m)
                     else
                         PyErr_Clear();
                 }
-                PyDict_SetItem(d, key, Py_None);
+                if (PyDict_SetItem(d, key, Py_None) != 0)
+                    PyErr_Clear();
             }
         }
     }