[issue28164] _PyIO_get_console_type fails for various paths

Eryk Sun report at bugs.python.org
Sun Feb 5 07:56:11 EST 2017


Eryk Sun added the comment:

It's an ugly inconsistency that GetFullPathName fails for bare CONIN$ and CONOUT$ prior to Windows 8, in that it gives a different result from simply passing those names to CreateFile. Anyway, thanks for modifying it to work correctly in this case.

We should test that _WindowsConsoleIO isn't used on Windows 7 and earlier when accessing CONIN$ or CONOUT$ in a directory. How about the following?

        temp_path = tempfile.mkdtemp()
        self.addCleanup(support.rmtree, temp_path)

        conout_path = os.path.join(temp_path, 'CONOUT$')
   
        with open(conout_path, 'wb', buffering=0) as f:
            if sys.getwindowsversion()[:2] > (6, 1):
                self.assertIsInstance(f, ConIO)
            else:
                self.assertNotIsInstance(f, ConIO)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28164>
_______________________________________


More information about the Python-bugs-list mailing list