]> granicus.if.org Git - python/commitdiff
Issue #24881: Fixed setting binary mode in Python implementation of FileIO
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 28 Aug 2015 19:17:04 +0000 (22:17 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Fri, 28 Aug 2015 19:17:04 +0000 (22:17 +0300)
on Windows and Cygwin.  Patch from Akira Li.

Lib/_pyio.py
Misc/NEWS

index 50ad9ff9962ee16f3c066b99f699690e082bafe4..f47df91247d047d114648e24f3b45a5ecbcd135b 100644 (file)
@@ -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
index 55a7e72628bceb8c898dd17399f42a5d6fe8e398..89b199c2e128c873b522e8021a56a3344c14d34d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -14,6 +14,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.