From 2a379aa216e893ec11816316a628962f3246c4d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Wed, 25 Oct 2023 13:41:26 +0200 Subject: [PATCH 1/3] 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 --- Doc/library/locale.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst index afd5677deac3f8..6ae63119bf0e1d 100644 --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -454,11 +454,16 @@ The :mod:`locale` module defines the following exception and functions: .. data:: LC_CTYPE - .. index:: pair: module; string - - Locale category for the character type functions. Depending on the settings of - this category, the functions of module :mod:`string` dealing with case change - their behaviour. + Locale category for the character type functions. Most importantly, this + category defines the text encoding, i.e. how bytes are interpreted as + Unicode codepoints. See :pep:`538` and :pep:`540` for how this variable + might be automatically coerced to ``C.UTF-8`` to avoid issues created by + invalid settings in containers or incompatible settings passed over remote + SSH connections. + + Python doesn't internally use locale-dependent character transformation functions + from ``ctype.h``. Instead, an internal ``pyctype.h`` provides locale-independent + equivalents like :c:macro:`Py_TOLOWER`. .. data:: LC_COLLATE From 9dd3451c22905e119e6feee1c70826b8489da300 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Wed, 25 Oct 2023 14:12:09 +0200 Subject: [PATCH 2/3] Stop misinforming about "INFO".lower() != "info" --- Lib/logging/handlers.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py index e75da9b7b1de64..9840b7b0aeba88 100644 --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -830,10 +830,8 @@ class SysLogHandler(logging.Handler): "local7": LOG_LOCAL7, } - #The map below appears to be trivially lowercasing the key. However, - #there's more to it than meets the eye - in some locales, lowercasing - #gives unexpected results. See SF #1524081: in the Turkish locale, - #"INFO".lower() != "info" + # Originally added to work around GH-43683. Unnecessary since GH-50043 but kept + # for backwards compatibility. priority_map = { "DEBUG" : "debug", "INFO" : "info", From 362204cffaab5aaf8098c7daa843e7bb36897302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Wed, 25 Oct 2023 19:05:03 +0200 Subject: [PATCH 3/3] Ignore undocumented reference Co-authored-by: Hugo van Kemenade --- Doc/library/locale.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst index 6ae63119bf0e1d..66ffede44f66fa 100644 --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -463,7 +463,7 @@ The :mod:`locale` module defines the following exception and functions: Python doesn't internally use locale-dependent character transformation functions from ``ctype.h``. Instead, an internal ``pyctype.h`` provides locale-independent - equivalents like :c:macro:`Py_TOLOWER`. + equivalents like :c:macro:`!Py_TOLOWER`. .. data:: LC_COLLATE