diff --git a/git/util.py b/git/util.py index 0ef8bdeb7..a3748f0fe 100644 --- a/git/util.py +++ b/git/util.py @@ -935,11 +935,7 @@ def _obtain_lock_or_raise(self) -> None: ) try: - flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL - if is_win: - flags |= os.O_SHORT_LIVED - fd = os.open(lock_file, flags, 0) - os.close(fd) + open(lock_file, mode='w', closefd=True) except OSError as e: raise IOError(str(e)) from e