summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-07-10 21:16:27 (GMT)
committerGitHub <noreply@github.com>2017-07-10 21:16:27 (GMT)
commitfe6e686c27ce3a3ecdf03803cff7e230dee5530d (patch)
treedea6f45e966e1d4a38044da15992a306759b0fa6 /Python/import.c
parent044e156426825acac8b6c6d1ce14d5b7bcb20bc9 (diff)
downloadcpython-fe6e686c27ce3a3ecdf03803cff7e230dee5530d.zip
cpython-fe6e686c27ce3a3ecdf03803cff7e230dee5530d.tar.gz
cpython-fe6e686c27ce3a3ecdf03803cff7e230dee5530d.tar.bz2
bpo-30891: Fix importlib _find_and_load() race condition (#2646) (#2651)
* Rewrite importlib _get_module_lock(): it is now responsible to hold the imp lock directly. * _find_and_load() now holds the module lock to check if name is in sys.modules to prevent a race condition (cherry picked from commit 4f9a446f3fb42f800e73cd9414dd1eccb3ca4fa7)
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index a9aa5b3..40e02c0 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1560,10 +1560,6 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals,
if (initializing == -1)
PyErr_Clear();
if (initializing > 0) {
-#ifdef WITH_THREAD
- _PyImport_AcquireLock();
-#endif
- /* _bootstrap._lock_unlock_module() releases the import lock */
value = _PyObject_CallMethodIdObjArgs(interp->importlib,
&PyId__lock_unlock_module, abs_name,
NULL);