MCPcopy Index your code
hub / github.com/python/cpython / _lock_unlock_module

Function _lock_unlock_module

Lib/importlib/_bootstrap.py:466–480  ·  view source on GitHub ↗

Acquires then releases the module lock for a given module name. This is used to ensure a module is completely initialized, in the event it is being imported by another thread.

(name)

Source from the content-addressed store, hash-verified

464
465
466def _lock_unlock_module(name):
467 """Acquires then releases the module lock for a given module name.
468
469 This is used to ensure a module is completely initialized, in the
470 event it is being imported by another thread.
471 """
472 lock = _get_module_lock(name)
473 try:
474 lock.acquire()
475 except _DeadlockError:
476 # Concurrent circular import, we'll accept a partially initialized
477 # module object.
478 pass
479 else:
480 lock.release()
481
482# Frame stripping magic ###############################################
483def _call_with_frames_removed(f, *args, **kwds):

Callers 1

_find_and_loadFunction · 0.85

Calls 3

_get_module_lockFunction · 0.85
acquireMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…