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

Terry Reedy tjreedy at udel.edu
Mon Jun 12 16:11:12 EDT 2017

On 6/12/2017 5:35 AM, INADA Naoki wrote:
> On Mon, Jun 12, 2017 at 5:56 PM, Victor Stinner
> <victor.stinner at gmail.com> wrote:
>> Hi,
>> Nick Coghlan pushed his implementation of his PEP 538: nice! Nice step
>> forward to UTF-8 everywhere ;-)
>> I would prefer to not be annoyed by warning messages about encodings
>> at startup if possible:
>> "Python detected LC_CTYPE=C: LC_CTYPE coerced to C.UTF-8 (set another
>> locale or PYTHONCOERCECLOCALE=0 to disable this locale coercion
>> behavior)."

I do not see this with my fresh 3.7 repository debug build on my Win 10 
machine.  If I did, I would be -1000.  This warning should be treated
as a deprecation warning, off by default.

> This is intentional behavior, to motivate people to use UTF-8 locale without
> coercion.

I thought the idea of the PEP was to do the right thing without making 
people do anything.

>> Note: I don't consider that 2>/dev/null is a good practice to ignore a
>> single warning, since it will ignore *all* message written into
>> stderr, including useful warnings like ResourceWarning or "Exception
>> ignored ...".
> I think "Good practice" is set `LC_CTYPE=C.UTF-8` environment variable,
> as warning says.

I do not have any locale-related env vars.  You should check whether the 
warning is off on all Win10 systems, as well as Win7 and Win8.  Many 
Windows users know nothing about ENV VARS, and even if they do, they may 
not know how (I don't know the details) or MAY NOT BE ABLE to set one 

Terry Jan Reedy

More information about the Python-Dev mailing list