summaryrefslogtreecommitdiff
path: root/Python/import.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-02-09 13:33:53 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2014-02-09 13:33:53 +0200
commitc2d47e10f770f449ed811e1de8a6fd8a6cb408c9 (patch)
tree202c6f694a7003b8b2814a615748e57b9110ab9a /Python/import.c
parent8be62cb433ac40e3d51869352c5ee5bd1cd7df53 (diff)
downloadcpython-c2d47e10f770f449ed811e1de8a6fd8a6cb408c9.tar.gz
Issue #20437: Fixed 21 potential bugs when deleting objects references.
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c6
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)