Eryk Sun added the comment:

> As there is no good interface in core Python to the kernel32 console
> operations (and there probably shouldn't be, it would be better to be 
> consistent), I suggest just flipping the bit at startup on Windows.

I don't follow your statement about consistency. Python could adopt a built-in 
wincon module to partially support the console API, just like winreg partially 
supports the registry API. 

When _WindowsConsoleIO was being developed, I mentioned the idea of enabling VT 
mode a couple of times, but there was no interest that I could see. I don't 
think Windows devs really care much about this feature, especially since it's 
only available in Windows 10. colorama has been the popular way to get 
cross-platform support for supporting text color in terminals and the Windows 
console. There's also pyreadline, which supports VT escapes and much more. 
Enabling the console's VT mode won't simplify the implementation of colorama or 
pyreadline so long as Windows 7 and 8 are supported, which will be for several 
more years. 

One problem with enabling VT mode at startup is that it could cause 
compatibility problems with child processes. cmd faced this problem and has 
since resolved it [1] by reverting to the original console mode before 
executing a program. If Python enables VT mode at startup, there should be a 
sys variable (based on a C global) that has the original mode value. 
Applications would be able to restore the original mode to either opt out 
entirely or before executing a child process. Py_FinalizeEx would also have to 
be modified to restore the original mode before shutting down the interpreter.

[1]: http://preview.tinyurl.com/jgtcgfs

----------
nosy: +eryksun

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

Reply via email to