summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-08-28 19:20:29 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-08-28 19:20:29 (GMT)
commitccb31673a68f700489540212fad14b749add05a1 (patch)
treeec4275617f316ee125770643af81ed43c1c13340
parentfd10a767a2a33aedc73de6eb6ff3dae96b35a540 (diff)
parentf0f55a00b7d5d31d56b9df27ba1b3ee0e0b71893 (diff)
downloadcpython-ccb31673a68f700489540212fad14b749add05a1.zip
cpython-ccb31673a68f700489540212fad14b749add05a1.tar.gz
cpython-ccb31673a68f700489540212fad14b749add05a1.tar.bz2
Issue #24881: Fixed setting binary mode in Python implementation of FileIO
on Windows and Cygwin. Patch from Akira Li.
-rw-r--r--Lib/_pyio.py3
-rw-r--r--Misc/NEWS3
2 files changed, 5 insertions, 1 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index 33d8a3f..f472256 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -8,12 +8,13 @@ import codecs
import errno
import array
import stat
+import sys
# Import _thread instead of threading to reduce startup cost
try:
from _thread import allocate_lock as Lock
except ImportError:
from _dummy_thread import allocate_lock as Lock
-if os.name == 'win32':
+if sys.platform in {'win32', 'cygwin'}:
from msvcrt import setmode as _setmode
else:
_setmode = None
diff --git a/Misc/NEWS b/Misc/NEWS
index fcb06db..9b455ab 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -79,6 +79,9 @@ Core and Builtins
Library
-------
+- Issue #24881: Fixed setting binary mode in Python implementation of FileIO
+ on Windows and Cygwin. Patch from Akira Li.
+
- Issue #21112: Fix regression in unittest.expectedFailure on subclasses.
Patch from Berker Peksag.