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

Class _DummyModuleLock

Lib/importlib/_bootstrap.py:392–410  ·  view source on GitHub ↗

A simple _ModuleLock equivalent for Python builds without multi-threading support.

Source from the content-addressed store, hash-verified

390
391
392class _DummyModuleLock:
393 """A simple _ModuleLock equivalent for Python builds without
394 multi-threading support."""
395
396 def __init__(self, name):
397 self.name = name
398 self.count = 0
399
400 def acquire(self):
401 self.count += 1
402 return True
403
404 def release(self):
405 if self.count == 0:
406 raise RuntimeError('cannot release un-acquired lock')
407 self.count -= 1
408
409 def __repr__(self):
410 return f'_DummyModuleLock({self.name!r}) at {id(self)}'
411
412
413class _ModuleLockManager:

Callers 1

_get_module_lockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…