mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-09 19:30:29 +00:00
remove locking context managers
This commit is contained in:
parent
d5543c8f78
commit
e043046e43
2 changed files with 29 additions and 34 deletions
|
@ -531,7 +531,6 @@ def _module_repr_from_spec(spec):
|
|||
def _exec(spec, module):
|
||||
"""Execute the spec's specified module in an existing module's namespace."""
|
||||
name = spec.name
|
||||
with _ModuleLockManager(name):
|
||||
if sys.modules.get(name) is not module:
|
||||
msg = 'module {!r} not in sys.modules'.format(name)
|
||||
raise ImportError(msg, name=name)
|
||||
|
@ -613,7 +612,6 @@ def _load(spec):
|
|||
clobbered.
|
||||
|
||||
"""
|
||||
with _ModuleLockManager(spec.name):
|
||||
return _load_unlocked(spec)
|
||||
|
||||
|
||||
|
@ -816,7 +814,6 @@ def _find_spec(name, path, target=None):
|
|||
# sys.modules provides one.
|
||||
is_reload = name in sys.modules
|
||||
for finder in meta_path:
|
||||
with _ImportLockContext():
|
||||
try:
|
||||
find_spec = finder.find_spec
|
||||
except AttributeError:
|
||||
|
@ -911,7 +908,6 @@ _NEEDS_LOADING = object()
|
|||
|
||||
def _find_and_load(name, import_):
|
||||
"""Find and load the module."""
|
||||
with _ModuleLockManager(name):
|
||||
module = sys.modules.get(name, _NEEDS_LOADING)
|
||||
if module is _NEEDS_LOADING:
|
||||
return _find_and_load_unlocked(name, import_)
|
||||
|
@ -921,7 +917,6 @@ def _find_and_load(name, import_):
|
|||
'None in sys.modules'.format(name))
|
||||
raise ModuleNotFoundError(message, name=name)
|
||||
|
||||
_lock_unlock_module(name)
|
||||
return module
|
||||
|
||||
|
||||
|
|
2
third_party/python/Python/import.c
vendored
2
third_party/python/Python/import.c
vendored
|
@ -1613,7 +1613,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals,
|
|||
Py_DECREF(value);
|
||||
if (initializing == -1)
|
||||
PyErr_Clear();
|
||||
if (initializing > 0) {
|
||||
if (0 && initializing > 0) {
|
||||
value = _PyObject_CallMethodIdObjArgs(interp->importlib,
|
||||
&PyId__lock_unlock_module, abs_name,
|
||||
NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue