[issue1524081] logging using the SysLog handler fails if locale is set

Greg Price report at bugs.python.org
Mon Aug 17 19:38:43 EDT 2020


Greg Price <gnprice at gmail.com> added the comment:

For the record because this issue is mentioned in a comment in logging/handlers.py and people are sometimes confused by it today:

> This happens because in that particular locale,
> "INFO".lower() != "info"

Since Python 3, this no longer happens: str.lower() and friends do not depend on the current locale.

Specifically, the lower() and similar methods on Unicode strings (now "str", previously "unicode") were always independent of the current locale.  The corresponding methods on byte strings (now "bytes", previously "str") did have this locale-dependent behavior, but that was replaced in commit 6ccd3f2dbcb98b33a71ffa6eae949deae797c09c, in 2007.

See also #37848, for a 2019 discussion of potentially adding an optional parameter to use an *explicit* locale.

----------
nosy: +Greg Price

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue1524081>
_______________________________________


More information about the Python-bugs-list mailing list