diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-18 16:59:52 +0200 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-04-18 16:59:52 +0200 |
commit | eca851815d654c6e6ef50fe0b38b9e9c6076ceea (patch) | |
tree | 9432ca04787993fb84fb692dcf1bc64fb97f4424 /Python/import.c | |
parent | ec9bac4226c2315c034147ece107fdc1f061e4b5 (diff) | |
parent | d76bc7abac37ac345878ed2db7e264f59fc79985 (diff) | |
download | cpython-git-eca851815d654c6e6ef50fe0b38b9e9c6076ceea.tar.gz |
Merge heads
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/Python/import.c b/Python/import.c index 07c3d6f40c..11d58aefe4 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2447,22 +2447,15 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals, Py_DECREF(partition); if (level == 0) { - if (PyUnicode_GET_LENGTH(name) == - PyUnicode_GET_LENGTH(front)) { - final_mod = mod; - } - else { - final_mod = PyDict_GetItem(interp->modules, front); - if (final_mod == NULL) { - PyErr_Format(PyExc_KeyError, - "%R not in sys.modules as expected", front); - } - } + final_mod = PyDict_GetItem(interp->modules, front); Py_DECREF(front); if (final_mod == NULL) { - goto error_with_unlock; + PyErr_Format(PyExc_KeyError, + "%R not in sys.modules as expected", front); + } + else { + Py_INCREF(final_mod); } - Py_INCREF(final_mod); } else { Py_ssize_t cut_off = PyUnicode_GET_LENGTH(name) - |