[Python-checkins] cpython (3.5): Issue #24881: Fixed setting binary mode in Python implementation of FileIO

serhiy.storchaka python-checkins at python.org
Fri Aug 28 21:20:51 CEST 2015


https://hg.python.org/cpython/rev/687da8760a58
changeset:   97535:687da8760a58
branch:      3.5
parent:      97533:ac3f1a6b1de2
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Aug 28 22:17:04 2015 +0300
summary:
  Issue #24881: Fixed setting binary mode in Python implementation of FileIO
on Windows and Cygwin.  Patch from Akira Li.

files:
  Lib/_pyio.py |  3 ++-
  Misc/NEWS    |  3 +++
  2 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Lib/_pyio.py b/Lib/_pyio.py
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -8,12 +8,13 @@
 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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -14,6 +14,9 @@
 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.
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list