run_module shouldn't hold the import lock when running a script

This commit is contained in:
Nick Coghlan 2006-03-24 13:05:53 +00:00
parent cdb7948f97
commit c841bb6b63

View file

@ -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()