-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LC_CTYPE incorrectly references case sensitivity of "the functions of module string
"
#111276
Comments
string
"string
"
Indeed, the As for the logging bug workaround (original issue: GH-43683), you're also correct that in Python 3 that is no longer applicable: LC_CTYPE=tr_TR.UTF-8 python3 13:50
Python 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getlocale()
('tr_TR', 'UTF-8')
>>> assert "INFO".lower() == "info"
>>> assert "info".upper() == "INFO"
>>> info_l = "info"
>>> assert info_l.upper().lower() == info_l
>>> This changed for Python 2.7+ in GH-50043 where Py_TOLOWER, etc. were defined. In fact, in Python 3.13 Similar issues kept creeping up before Python gave up on I pushed a PR to fix the docs and the comment. |
Thanks a ton @ambv ! Glad to see this obscure little corner get cleaned up. |
) Fix locale.LC_CTYPE documentation to no longer mention string.lower() et al. Those functions were removed in Python 3.0: https://docs.python.org/2/library/string.html#deprecated-string-functions Also, fix a comment in logging about locale-specific behavior of `str.lower()`. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
…pythonGH-111319) Fix locale.LC_CTYPE documentation to no longer mention string.lower() et al. Those functions were removed in Python 3.0: https://docs.python.org/2/library/string.htmlGH-deprecated-string-functions Also, fix a comment in logging about locale-specific behavior of `str.lower()`. (cherry picked from commit 6d42759) Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
…pythonGH-111319) Fix locale.LC_CTYPE documentation to no longer mention string.lower() et al. Those functions were removed in Python 3.0: https://docs.python.org/2/library/string.htmlGH-deprecated-string-functions Also, fix a comment in logging about locale-specific behavior of `str.lower()`. (cherry picked from commit 6d42759) Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
GH-111319) (#111391) Fix locale.LC_CTYPE documentation to no longer mention string.lower() et al. Those functions were removed in Python 3.0: https://docs.python.org/2/library/string.htmlGH-deprecated-string-functions Also, fix a comment in logging about locale-specific behavior of `str.lower()`. (cherry picked from commit 6d42759) Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
GH-111319) (#111392) Fix locale.LC_CTYPE documentation to no longer mention string.lower() et al. Those functions were removed in Python 3.0: https://docs.python.org/2/library/string.htmlGH-deprecated-string-functions Also, fix a comment in logging about locale-specific behavior of `str.lower()`. (cherry picked from commit 6d42759) Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Closing because the PRs have been merged. Thanks for the report! |
…python#111319) Fix locale.LC_CTYPE documentation to no longer mention string.lower() et al. Those functions were removed in Python 3.0: https://docs.python.org/2/library/string.html#deprecated-string-functions Also, fix a comment in logging about locale-specific behavior of `str.lower()`. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
…python#111319) Fix locale.LC_CTYPE documentation to no longer mention string.lower() et al. Those functions were removed in Python 3.0: https://docs.python.org/2/library/string.html#deprecated-string-functions Also, fix a comment in logging about locale-specific behavior of `str.lower()`. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Documentation
https://docs.python.org/3.12/library/locale.html#locale.LC_CTYPE says:
I believe this is referring to Python 2.7's '
string.lower
et. al., which have been gone for quite some time. I think since Python 3.3 unicode case-conversion functions have quite intentionally been locale-independent.Confusion about this issue seems pervasive, even in CPython itself; consider this bit of code with a somewhat misleading comment:
cpython/Lib/logging/handlers.py
Lines 836 to 847 in b180120
So it would be good to clean up the docs. Earlier in the same document it does say:
Linked PRs
The text was updated successfully, but these errors were encountered: