[Python-checkins] cpython (3.3): Add missing check of PyDict_SetItem()'s return value in
christian.heimes
python-checkins at python.org
Sat Jul 20 14:52:50 CEST 2013
http://hg.python.org/cpython/rev/80a5c2c2fb8a
changeset: 84728:80a5c2c2fb8a
branch: 3.3
parent: 84726:13d5b245ca14
user: Christian Heimes <christian at cheimes.de>
date: Sat Jul 20 14:51:53 2013 +0200
summary:
Add missing check of PyDict_SetItem()'s return value in _PyImport_FindExtensionObject()
CID 486649
files:
Python/import.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Python/import.c b/Python/import.c
--- a/Python/import.c
+++ b/Python/import.c
@@ -553,7 +553,10 @@
mod = def->m_base.m_init();
if (mod == NULL)
return NULL;
- PyDict_SetItem(PyImport_GetModuleDict(), name, mod);
+ if (PyDict_SetItem(PyImport_GetModuleDict(), name, mod) == -1) {
+ Py_DECREF(mod);
+ return NULL;
+ }
Py_DECREF(mod);
}
if (_PyState_AddModule(mod, def) < 0) {
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list