[Python-Dev] PEP 538 warning at startup: please remove it

Nick Coghlan ncoghlan at gmail.com
Tue Jun 13 02:51:23 EDT 2017


On 13 June 2017 at 06:58, Gregory P. Smith <greg at krypto.org> wrote:
> I guess so. It is a system environment configuration problem. But I'd still
> imagine that end users never touch their LANG or LC_* environment variables
> themselves.  (the only time I touch anything is to explicitly set LANG=C on
> occasion when I want text process shell tools to run a lot faster; but I
> hardly count as I live in ascii-land, aka the US)
>
> I'm inclined to suggest it should be silent, but I'm curious if we can get
> some linux distros testing with it enabled during the beta period to see how
> much impact it actually has on users in the real world. We could be talking
> about a minor non-issue.

It's at least affecting Fedora's build system (where we've backported
PEP 538 to the system Python in F26):
https://lists.fedorahosted.org/archives/list/python-devel@lists.fedoraproject.org/thread/VSEGOF76XMBJOAO4C2MORNK3I2VIPOTU/

However, Fedora python-devel's current view on that is that it's a
sign that the build system's configuration is outdated, and we should
be setting the locale to C.UTF-8 instead. (Ditto for the Fedora Docker
images, which are currently expecting systemd to sort out the default
locale settings, so it ends up being left as the C default when
there's no init system running inside the container).

So I think the most compelling argument in favour of making the
warning silent by default is Victor's one: so that "LANG=C python"
"just works", rather than attempting to persuade end users to change
what they've become accustomed to typing in order to get software to
emit otherwise internationalised text in English.

After all, one of the long term goals of PEP 538 is to get to the
point where at least the glibc developers, and hopefully other C
standard library implementation developers, are comfortable having
UTF-8 as the default text encoding anyway, at which point CPython's
locale coercion would essentially become a no-op (and folks would have
to type something like "LANG=C.ASCII" or "LANG=C.latin-1" to get the
old platform dependent non-UTF-8 behaviour back).

If we turned the warning off by default, but retained an easy
"on-switch" for the warning to help track places where locale coercion
is triggering unexpectedly (e.g. "PYTHONCOERCECLOCALE=warn"), that
would probably give us the best of both worlds.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list