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 martin.panter
Recipients davispuh, ezio.melotti, martin.panter, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Date 2016-06-02.02:38:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1464835106.3.0.697918590311.issue27179@psf.upfronthosting.co.za>
In-reply-to
Content
I don’t know much about the conventions for stdout etc encoding on Windows. But in general, the patch does not seem robust. Does it work if sys.stdout is a pipe or file (not a console)? I doubt it will work when sys.stdout has been replaced by e.g. StringIO, and sys.stdout.encoding is None. Maybe you could use sys.__stdout__. But then, what happens when you run Python without any stdout at all, say in a GUI like Idle?

On Linux, the patch may have no effect in common cases. But again, it will break if sys.stdout has been replaced, or is set to None.

Looking at _Py_device_encoding() in Python/fileutils.c, perhaps you need a Windows-specific interface to GetConsoleCP() and GetConsoleOutputCP() that subprocess can use.
History
Date User Action Args
2016-06-02 02:38:26martin.pantersetrecipients: + martin.panter, paul.moore, vstinner, tim.golden, ezio.melotti, zach.ware, steve.dower, davispuh
2016-06-02 02:38:26martin.pantersetmessageid: <1464835106.3.0.697918590311.issue27179@psf.upfronthosting.co.za>
2016-06-02 02:38:26martin.panterlinkissue27179 messages
2016-06-02 02:38:25martin.pantercreate