Skip to content

Commit f0f55a0

Browse files
Issue #24881: Fixed setting binary mode in Python implementation of FileIO
on Windows and Cygwin. Patch from Akira Li.
1 parent 079fc7f commit f0f55a0

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/_pyio.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
import errno
99
import array
1010
import stat
11+
import sys
1112
# Import _thread instead of threading to reduce startup cost
1213
try:
1314
from _thread import allocate_lock as Lock
1415
except ImportError:
1516
from _dummy_thread import allocate_lock as Lock
16-
if os.name == 'win32':
17+
if sys.platform in {'win32', 'cygwin'}:
1718
from msvcrt import setmode as _setmode
1819
else:
1920
_setmode = None

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Core and Builtins
1414
Library
1515
-------
1616

17+
- Issue #24881: Fixed setting binary mode in Python implementation of FileIO
18+
on Windows and Cygwin. Patch from Akira Li.
19+
1720
- Issue #21112: Fix regression in unittest.expectedFailure on subclasses.
1821
Patch from Berker Peksag.
1922

0 commit comments

Comments
 (0)