From: Serhiy Storchaka Date: Fri, 28 Aug 2015 19:17:04 +0000 (+0300) Subject: Issue #24881: Fixed setting binary mode in Python implementation of FileIO X-Git-Tag: v3.6.0a1~1727^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f0f55a00b7d5d31d56b9df27ba1b3ee0e0b71893;p=python Issue #24881: Fixed setting binary mode in Python implementation of FileIO on Windows and Cygwin. Patch from Akira Li. --- diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 50ad9ff996..f47df91247 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 55a7e72628..89b199c2e1 100644 --- 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.