Issue 29898: PYTHONLEGACYWINDOWSIOENCODING isn't implemented (original) (raw)

Issue29898

Created on 2017-03-24 22:34 by eryksun, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1576 merged berker.peksag,2017-05-14 05:46
PR 1609 merged berker.peksag,2017-05-16 16:19
Messages (6)
msg290240 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2017-03-24 22:34
The environment variable PYTHONLEGACYWINDOWSIOENCODING is documented here: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONLEGACYWINDOWSIOENCODING but not actually implemented. Also, I think setting PYTHONIOENCODING to anything except UTF-8 should disable using io._WindowsConsoleIO.
msg290357 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-03-24 23:34
It's actually called "PYTHONLEGACYWINDOWSSTDIO" in Python/pylifecycle.c, which is also what PEP 528 says it should be, so this is a docs issue. You're correct that PYTHONIOENCODING is overridden by detection of a real console, however, PYTHONIOENCODING doesn't currently set a flag anywhere, and the (required for compatibility) defaults on Windows would make it look like it's always been set to something else. In my opinion, you should set PYTHONLEGACYWINDOWSSTDIO to indicate that even though we know the incoming encoding (Unicode from an interactive console), you don't care and you want to override it with a default value. Then use PYTHONIOENCODING to set that default value. This is most consistent with the existing use of PYTHONIOENCODING (it's the default unless you know exactly which encoding you are getting).
msg290467 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2017-03-25 07:42
I prefer the name PYTHONLEGACYWINDOWSIOENCODING for symmetry with both PYTHONIOENCODING and PYTHONLEGACYWINDOWSFSENCODING, but I suppose you changed it to make it more visually distinguished from the latter. I discovered this issue due to the modified behavior of PYTHONIOENCODING. It's not really a disruptive change, but it looks wrong based solely on the --help text description of PYTHONIOENCODING. An alternative would be to set Py_LegacyWindowsStdioFlag in _Py_InitializeEx_Private either when PYTHONLEGACYWINDOWSSTDIO is set or when PYTHONIOENCODING isn't a case-insensitive match for "utf-8" with an optional :errors spec. That way people get exactly what they asked for, even if it's mojibake nonsense given the console's current input and output codepages.
msg290489 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-03-25 17:05
Sure, but you're proposing a change to a correctly documented (apart from the variable name) and released behavior. It can't be changed in 3.6, and I don't see a compelling reason to have different behavior in 3.7.
msg293756 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-05-16 09:36
New changeset 87fa8a780e9045a26c735f085c07bba4b2d0be60 by Berker Peksag in branch 'master': bpo-29898: Fix incorrect env variable name (GH-1576) https://github.com/python/cpython/commit/87fa8a780e9045a26c735f085c07bba4b2d0be60
msg293798 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-05-16 21:31
New changeset 0d267041c40a3ab655676b885c0ba35ed9685848 by Berker Peksag in branch '3.6': bpo-29898: Fix incorrect env variable name (GH-1576) https://github.com/python/cpython/commit/0d267041c40a3ab655676b885c0ba35ed9685848
History
Date User Action Args
2022-04-11 14:58:44 admin set github: 74084
2017-05-16 21:32:02 berker.peksag set status: open -> closedresolution: fixedstage: backport needed -> resolved
2017-05-16 21:31:42 berker.peksag set messages: +
2017-05-16 16:19:28 berker.peksag set pull_requests: + <pull%5Frequest1700>
2017-05-16 09:37:09 berker.peksag set stage: test needed -> backport needed
2017-05-16 09:36:49 berker.peksag set nosy: + berker.peksagmessages: +
2017-05-14 05:46:41 berker.peksag set pull_requests: + <pull%5Frequest1669>
2017-03-25 17:05:16 steve.dower set messages: +
2017-03-25 07:42:54 eryksun set messages: +
2017-03-24 23:34:25 steve.dower set nosy: + docs@pythonmessages: + assignee: docs@pythoncomponents: + Documentation
2017-03-24 22:34:03 eryksun create