diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 11:33:53 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 11:33:53 (GMT) |
commit | 505ff755d704c73ac613d3e8fed02c79c6ae555a (patch) | |
tree | b9b0142cbeca125a1bcf0413e48d938d0cd390d3 /Python/import.c | |
parent | e9c31470e1680b7c9b9ee83c378b891e90ac58ab (diff) | |
download | cpython-505ff755d704c73ac613d3e8fed02c79c6ae555a.zip cpython-505ff755d704c73ac613d3e8fed02c79c6ae555a.tar.gz cpython-505ff755d704c73ac613d3e8fed02c79c6ae555a.tar.bz2 |
Issue #20437: Fixed 21 potential bugs when deleting objects references.
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c index e91cef8..26f82cf 100644 --- a/Python/import.c +++ b/Python/import.c @@ -253,8 +253,7 @@ imp_release_lock(PyObject *self, PyObject *noargs) void _PyImport_Fini(void) { - Py_XDECREF(extensions); - extensions = NULL; + Py_CLEAR(extensions); #ifdef WITH_THREAD if (import_lock != NULL) { PyThread_free_lock(import_lock); @@ -497,8 +496,7 @@ _PyImport_FixupExtensionObject(PyObject *mod, PyObject *name, /* Somebody already imported the module, likely under a different name. XXX this should really not happen. */ - Py_DECREF(def->m_base.m_copy); - def->m_base.m_copy = NULL; + Py_CLEAR(def->m_base.m_copy); } dict = PyModule_GetDict(mod); if (dict == NULL) |