diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 13:33:53 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-09 13:33:53 +0200 |
commit | c2d47e10f770f449ed811e1de8a6fd8a6cb408c9 (patch) | |
tree | 202c6f694a7003b8b2814a615748e57b9110ab9a /Python/import.c | |
parent | 8be62cb433ac40e3d51869352c5ee5bd1cd7df53 (diff) | |
download | cpython-c2d47e10f770f449ed811e1de8a6fd8a6cb408c9.tar.gz |
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 e91cef83ff..26f82cf29b 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) |