This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients Drekin, eryksun, ezio.melotti, paul.moore, steve.dower, terry.reedy, tim.golden, vstinner, zach.ware
Date 2016-10-08.01:01:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1475888477.59.0.737077139889.issue28333@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-10-08 01:01:17eryksunsetrecipients: + eryksun, terry.reedy, paul.moore, vstinner, tim.golden, ezio.melotti, zach.ware, Drekin, steve.dower
2016-10-08 01:01:17eryksunsetmessageid: <1475888477.59.0.737077139889.issue28333@psf.upfronthosting.co.za>
2016-10-08 01:01:17eryksunlinkissue28333 messages
2016-10-08 01:01:16eryksuncreate