New submission from Eryk Sun:

_PyIO_get_console_type currently hard codes the names "CON", "CONIN$", and 
"CONOUT$" and doesn't use a case-insensitive comparison. For example, opening 
"conin$" doesn't get directed to WindowsConsoleIO:

    >>> open('conin$', 'rb', buffering=0)
    <_io.FileIO name='conin$' mode='rb' closefd=True>

unlike CONIN$:

    >>> open('CONIN$', 'rb', buffering=0)
   <_io._WindowsConsoleIO mode='rb' closefd=True>

This also ignores the special handling of DOS devices in existing directories. 
The normal DOS-device check (i.e. if the parent directory exists, call 
GetFullPathName to normalize the path) isn't reliable, unfortunately. Prior to 
Windows 8, CreateFile special-cases parsing console paths by calling 
BaseIsThisAConsoleName, which has an annoying speed hack that makes it buggy. 
Ultimately the only way to know if a path opens the console is to open it and 
check the handle.

----------
components: IO, Library (Lib), Windows
messages: 276512
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: test needed
status: open
title: _PyIO_get_console_type fails for various paths
type: behavior
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28164>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to