[Python-checkins] cpython (3.6): Adds precheck for console filename to fix Windows 7.

steve.dower python-checkins at python.org
Sat Feb 4 20:37:10 EST 2017


https://hg.python.org/cpython/rev/ea4728ef5956
changeset: 106439:ea4728ef5956
branch: 3.6
parent: 106437:8b20ed083a94
user: Steve Dower <steve.dower at microsoft.com>
date: Sat Feb 04 17:36:47 2017 -0800
summary:
 Adds precheck for console filename to fix Windows 7.
files:
 Modules/_io/winconsoleio.c | 14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -86,6 +86,19 @@
 return '0円';
 }
 
+ char m = '0円';
+ if (!_wcsicmp(decoded_wstr, L"CONIN$")) {
+ m = 'r';
+ } else if (!_wcsicmp(decoded_wstr, L"CONOUT$")) {
+ m = 'w';
+ } else if (!_wcsicmp(decoded_wstr, L"CON")) {
+ m = 'x';
+ }
+ if (m) {
+ PyMem_Free(decoded_wstr);
+ return m;
+ }
+
 DWORD length;
 wchar_t name_buf[MAX_PATH], *pname_buf = name_buf;
 
@@ -99,7 +112,6 @@
 }
 PyMem_Free(decoded_wstr);
 
- char m = '0円';
 if (length) {
 wchar_t *name = pname_buf;
 if (length >= 4 && name[3] == L'\\' &&
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /