Eryk Sun added the comment:

I'm sure Steve already has this covered, but FWIW here's a patch to call 
WriteConsoleW. Here's the result with the patch applied:

    >>> sys.ps1 = '»»» '
    »»» input("αβψδ: ")
    αβψδ: spam
    'spam'

and with interactive stdin and stdout/stderr redirected to a file:

    >set PYTHONIOENCODING=utf-8
    >amd64\python_d.exe >out.txt 2>&1
    input("αβψδ: ")
    spam
    ^Z

    >chcp 65001
    Active code page: 65001

    >type out.txt
    Python 3.6.0b1+ (default, Oct  7 2016, 23:47:58)
    [MSC v.1900 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> αβψδ: 'spam'
    >>>

If it can't write the prompt for some reason (e.g. out of memory, decoding 
fails, WriteConsole fails), it doesn't fall back on fprintf to write the 
prompt. Should it? 

This should also get a test that calls ReadConsoleOutputCharacter to verify 
that the correct prompt is written.

----------
keywords: +patch
Added file: http://bugs.python.org/file45008/issue_28333_01.patch

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

Reply via email to