MCPcopy Create free account
hub / github.com/tox-dev/filelock / try_illegal_transition

Function try_illegal_transition

tests/sqlite/test_lock.py:100–109  ·  view source on GitHub ↗
(lock_file: str, hold_mode: Literal["read", "write"], result: Synchronized[int])

Source from the content-addressed store, hash-verified

98
99
100def try_illegal_transition(lock_file: str, hold_mode: Literal["read", "write"], result: Synchronized[int]) -> None:
101 lock = ReadWriteLock(lock_file)
102 with getattr(lock, f"{hold_mode}_lock")():
103 try:
104 if hold_mode == "read":
105 lock.acquire_write()
106 else:
107 lock.acquire_read()
108 except RuntimeError:
109 result.value = 0
110
111
112@pytest.mark.timeout(PROCESS_DEADLINE * 3)

Callers

nothing calls this directly

Calls 3

acquire_writeMethod · 0.95
acquire_readMethod · 0.95
ReadWriteLockClass · 0.90

Tested by

no test coverage detected