Message278284
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. |
|
Date |
User |
Action |
Args |
2016-10-08 01:01:17 | eryksun | set | recipients:
+ eryksun, terry.reedy, paul.moore, vstinner, tim.golden, ezio.melotti, zach.ware, Drekin, steve.dower |
2016-10-08 01:01:17 | eryksun | set | messageid: <1475888477.59.0.737077139889.issue28333@psf.upfronthosting.co.za> |
2016-10-08 01:01:17 | eryksun | link | issue28333 messages |
2016-10-08 01:01:16 | eryksun | create | |
|