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

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


http://hg.python.org/cpython/rev/c6e7ba7eee88
changeset: 89164:c6e7ba7eee88
branch: 2.7
parent: 89159:08f5b3c1674a
user: Serhiy Storchaka <storchaka at gmail.com>
date: Wed Feb 12 09:54:48 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
@@ -122,7 +122,8 @@
 if (s[0] == '_' && s[1] != '_') {
 if (Py_VerboseFlag > 1)
 PySys_WriteStderr("# clear[1] %s\n", s);
- PyDict_SetItem(d, key, Py_None);
+ if (PyDict_SetItem(d, key, Py_None) != 0)
+ PyErr_Clear();
 }
 }
 }
@@ -135,7 +136,8 @@
 if (s[0] != '_' || strcmp(s, "__builtins__") != 0) {
 if (Py_VerboseFlag > 1)
 PySys_WriteStderr("# clear[2] %s\n", s);
- 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

AltStyle によって変換されたページ (->オリジナル) /