aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Lib/locale.py
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-02-12 07:53:52 +0300
committerDaniil Cherednik <dcherednik@ydb.tech>2024-02-14 14:26:16 +0000
commit31f2a419764a8ba77c2a970cfc80056c6cd06756 (patch)
treec1995d239eba8571cefc640f6648e1d5dd4ce9e2 /contrib/tools/python3/src/Lib/locale.py
parentfe2ef02b38d9c85d80060963b265a1df9f38c3bb (diff)
downloadydb-31f2a419764a8ba77c2a970cfc80056c6cd06756.tar.gz
Update Python from 3.11.8 to 3.12.2
Diffstat (limited to 'contrib/tools/python3/src/Lib/locale.py')
-rw-r--r--contrib/tools/python3/src/Lib/locale.py24
1 files changed, 6 insertions, 18 deletions
diff --git a/contrib/tools/python3/src/Lib/locale.py b/contrib/tools/python3/src/Lib/locale.py
index f45841ed62..4965c97307 100644
--- a/contrib/tools/python3/src/Lib/locale.py
+++ b/contrib/tools/python3/src/Lib/locale.py
@@ -26,7 +26,7 @@ import functools
# trying the import. So __all__ is also fiddled at the end of the file.
__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
"setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",
- "str", "atof", "atoi", "format", "format_string", "currency",
+ "str", "atof", "atoi", "format_string", "currency",
"normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
"LC_NUMERIC", "LC_ALL", "CHAR_MAX", "getencoding"]
@@ -247,21 +247,6 @@ def format_string(f, val, grouping=False, monetary=False):
return new_f % val
-def format(percent, value, grouping=False, monetary=False, *additional):
- """Deprecated, use format_string instead."""
- import warnings
- warnings.warn(
- "This method will be removed in a future version of Python. "
- "Use 'locale.format_string()' instead.",
- DeprecationWarning, stacklevel=2
- )
-
- match = _percent_re.match(percent)
- if not match or len(match.group())!= len(percent):
- raise ValueError(("format() must be given exactly one %%char "
- "format specifier, %s not valid") % repr(percent))
- return _format(percent, value, grouping, monetary, *additional)
-
def currency(val, symbol=True, grouping=False, international=False):
"""Formats val according to the currency settings
in the current locale."""
@@ -561,7 +546,10 @@ def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
"{name!r} is deprecated and slated for removal in Python {remove}. "
"Use setlocale(), getencoding() and getlocale() instead.",
remove=(3, 15))
+ return _getdefaultlocale(envvars)
+
+def _getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
try:
# check if it's supported by the _locale module
import _locale
@@ -655,7 +643,7 @@ except ImportError:
# On Android langinfo.h and CODESET are missing, and UTF-8 is
# always used in mbstowcs() and wcstombs().
return 'utf-8'
- encoding = getdefaultlocale()[1]
+ encoding = _getdefaultlocale()[1]
if encoding is None:
# LANG not set, default to UTF-8
encoding = 'utf-8'
@@ -976,7 +964,7 @@ locale_alias = {
'c.ascii': 'C',
'c.en': 'C',
'c.iso88591': 'en_US.ISO8859-1',
- 'c.utf8': 'en_US.UTF-8',
+ 'c.utf8': 'C.UTF-8',
'c_c': 'C',
'c_c.c': 'C',
'ca': 'ca_ES.ISO8859-1',