mirror of
https://github.com/python/cpython.git
synced 2025-07-28 13:44:43 +00:00
run_module shouldn't hold the import lock when running a script
This commit is contained in:
parent
cdb7948f97
commit
c841bb6b63
1 changed files with 9 additions and 13 deletions
|
@ -379,8 +379,6 @@ def _run_module_code(code, init_globals=None,
|
|||
restore_module = mod_name in sys.modules
|
||||
if restore_module:
|
||||
saved_module = sys.modules[mod_name]
|
||||
imp.acquire_lock()
|
||||
try:
|
||||
sys.argv[0] = mod_fname
|
||||
sys.modules[mod_name] = temp_module
|
||||
try:
|
||||
|
@ -392,8 +390,6 @@ def _run_module_code(code, init_globals=None,
|
|||
sys.modules[mod_name] = saved_module
|
||||
else:
|
||||
del sys.modules[mod_name]
|
||||
finally:
|
||||
imp.release_lock()
|
||||
# Copy the globals of the temporary module, as they
|
||||
# may be cleared when the temporary module goes away
|
||||
return mod_globals.copy()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue