Replace io.open with the built-in.

As of Python 3, io.open is an alias for the built-in open function.
This commit is contained in:
Mads Jensen
2024-12-14 11:29:40 +01:00
parent 0f0000298b
commit 8a69b2f1d9
4 changed files with 8 additions and 11 deletions
+2 -2
View File
@@ -187,13 +187,13 @@ class _WindowsLockMechanism(_BaseLockMechanism):
By default on Windows, acquiring a file handler gives exclusive access to the process
and results in an effective lock. However, it is possible to explicitly acquire the
file handler in shared access in terms of read and write, and this is done by os.open
and io.open in Python. So an explicit lock needs to be done through the call of
in Python. So an explicit lock needs to be done through the call of
msvcrt.locking, that will lock the first byte of the file. In theory, it is also
possible to access a file in shared delete access, allowing other processes to delete an
opened file. But this needs also to be done explicitly by all processes using the Windows
low level APIs, and Python does not do it. As of Python 3.7 and below, Python developers
state that deleting a file opened by a process from another process is not possible with
os.open and io.open.
os.open.
Consequently, msvcrt.locking is sufficient to obtain an effective lock, and the race
condition encountered on Linux is not possible on Windows, leading to a simpler workflow.
"""