STINNER Victor <vstin...@redhat.com> added the comment:

> I'd strongly prefer to just go back to the PEP 538 design. It's much simpler 
> to implement, we don't actually want anyone turning off locale coercion 
> except for debugging purposes (unlike UTF-8 mode), and the only argument 
> against doing this the way PEP 538 describes is a purist one, not a practical 
> one (which was already resolved in favour of practicality when PEP 538 was 
> accepted).
> (...)
> That's quite a bit of code to add for the sake of a flag we don't really want 
> anyone to ever use, though. (If it hadn't been for the 
> debugging-CentOS-7-problems-on-Fedora issue, I doubt I would have included 
> the off switch in PEP 538 at all)

Why did you add PYTHONCOERCECLOCALE=warn if you don't want that people use it?

> The actual functional error is that the following will currently give 
> different outputs on Fedora and CentOS 7, whereas in the original PEP 538 
> implementation it would always print "C", even if locale coercion would 
> otherwise normally work on your current platform:
>
>    LC_CTYPE=C PYTHONCOERCECLOCALE=0 python3 -E -c 'import os; 
> print(os.env["LC_CTYPE"])'

You wrote that we need PYTHONCOERCECLOCALE=0 and then that we don't need it, I 
don't understand :-)

IMHO there are use cases where PYTHONCOERCECLOCALE=0 is important, that's why I 
propose to add -X coerce_c_locale=0.

There are also cases where you want the warning, so -X coerce_c_locale=warn 
would help as well, when -E or -I is needed.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34589>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to