| 205 | event: Literal["os.fork", "os.forkpty", "_posixsubprocess.fork_exec"], |
| 206 | ) -> None: |
| 207 | class AuditedLock(BaseFileLock): |
| 208 | def _acquire(self) -> None: |
| 209 | self._context.lock_file_fd = None |
| 210 | if event == "_posixsubprocess.fork_exec": |
| 211 | sys.audit(event, (), (), None) |
| 212 | else: |
| 213 | sys.audit(event) |
| 214 | |
| 215 | _release = _acquire |
| 216 | |
| 217 | with pytest.raises(RuntimeError, match="unsafe while filelock is changing descriptor ownership"): |
| 218 | AuditedLock(str(tmp_path / "audit.lock"), is_singleton=False).acquire(timeout=0) |
no outgoing calls