filelock: fix lockfile cleanup
Python 3.7 does not support the "missing_ok" argument in pathlib.unlink(). Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
e41a934f74
commit
bc34ebdff9
|
@ -96,7 +96,8 @@ class AsyncExclusiveFileLock(contextlib.AbstractAsyncContextManager):
|
|||
|
||||
def _release_file(self) -> None:
|
||||
with contextlib.suppress(OSError, PermissionError):
|
||||
self.lock_path.unlink(missing_ok=True)
|
||||
if self.lock_path.is_file():
|
||||
self.lock_path.unlink()
|
||||
with contextlib.suppress(OSError, PermissionError):
|
||||
fcntl.flock(self.fd, fcntl.LOCK_UN)
|
||||
with contextlib.suppress(OSError, PermissionError):
|
||||
|
|
Loading…
Reference in New Issue