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

Method _release

src/filelock/_windows.py:203–213  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

201 os.close(fd) # another holder owns the byte-range lock; let the retry loop try again
202
203 def _release(self) -> None:
204 fd = cast("int", self._context.lock_file_fd)
205 # Retain the descriptor until the OS unlock succeeds: if UnlockFileEx raises, the byte-range lock is still
206 # held, so is_locked must keep reporting held rather than losing the fd. Only after the unlock commits do
207 # close and unlink run as post-unlock cleanup; their failure cannot make the lock held again.
208 _unlock_fd(fd)
209 self._mark_descriptor_released()
210 self._close_released_fd(fd, default_suppresses=False)
211 if not self._preserve_lock_file: # preserve_lock_file keeps a stable file identity for the caller (#605)
212 with suppress(OSError):
213 Path(self.lock_file).unlink()
214
215 def _open_non_reparse_fd(path: str, mode: int) -> int | None:
216 """

Callers

nothing calls this directly

Calls 3

_close_released_fdMethod · 0.80
_unlock_fdFunction · 0.70

Tested by

no test coverage detected