diff options
author | Steve Dower <steve.dower@microsoft.com> | 2017-02-05 01:37:00 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2017-02-05 01:37:00 (GMT) |
commit | 8c67fdd24b232d96fc9fd4ba73c165f02ef67cff (patch) | |
tree | 9d6deffa934dfa3b8aef0aad25825a52df8d3bfc | |
parent | d2f4404bbbec57e191cefc37cccac1d7f54d57c9 (diff) | |
parent | a7e164881e9b853044ab1dcc3063a9aba8b83b19 (diff) | |
download | cpython-8c67fdd24b232d96fc9fd4ba73c165f02ef67cff.zip cpython-8c67fdd24b232d96fc9fd4ba73c165f02ef67cff.tar.gz cpython-8c67fdd24b232d96fc9fd4ba73c165f02ef67cff.tar.bz2 |
Merge from 3.6
-rw-r--r-- | Modules/_io/winconsoleio.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c index a2607b4..4d36bb5 100644 --- a/Modules/_io/winconsoleio.c +++ b/Modules/_io/winconsoleio.c @@ -86,6 +86,19 @@ char _PyIO_get_console_type(PyObject *path_or_fd) { 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 @@ char _PyIO_get_console_type(PyObject *path_or_fd) { } PyMem_Free(decoded_wstr); - char m = '\0'; if (length) { wchar_t *name = pname_buf; if (length >= 4 && name[3] == L'\\' && |