summaryrefslogtreecommitdiffstats
path: root/Lib/locale.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-06-06 12:55:50 (GMT)
committerGitHub <noreply@github.com>2023-06-06 12:55:50 (GMT)
commit0cb6b9b0db5df6b3f902e86eb3d4a1e504afb851 (patch)
tree15dda3f872ff33b3d58148f0ebef1533904f48f3 /Lib/locale.py
parentc7bf74bacd2b2db308e80e532153ffaf6dbca851 (diff)
downloadcpython-0cb6b9b0db5df6b3f902e86eb3d4a1e504afb851.zip
cpython-0cb6b9b0db5df6b3f902e86eb3d4a1e504afb851.tar.gz
cpython-0cb6b9b0db5df6b3f902e86eb3d4a1e504afb851.tar.bz2
gh-104783: Remove locale.resetlocale() function (#104784)
Diffstat (limited to 'Lib/locale.py')
-rw-r--r--Lib/locale.py33
1 files changed, 1 insertions, 32 deletions
diff --git a/Lib/locale.py b/Lib/locale.py
index e94f0d1..0197967 100644
--- a/Lib/locale.py
+++ b/Lib/locale.py
@@ -25,7 +25,7 @@ import functools
# Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before
# trying the import. So __all__ is also fiddled at the end of the file.
__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
- "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",
+ "setlocale", "localeconv", "strcoll", "strxfrm",
"str", "atof", "atoi", "format_string", "currency",
"normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
"LC_NUMERIC", "LC_ALL", "CHAR_MAX", "getencoding"]
@@ -612,26 +612,6 @@ def setlocale(category, locale=None):
locale = normalize(_build_localename(locale))
return _setlocale(category, locale)
-def resetlocale(category=LC_ALL):
-
- """ Sets the locale for category to the default setting.
-
- The default setting is determined by calling
- getdefaultlocale(). category defaults to LC_ALL.
-
- """
- import warnings
- warnings.warn(
- 'Use locale.setlocale(locale.LC_ALL, "") instead',
- DeprecationWarning, stacklevel=2
- )
-
- with warnings.catch_warnings():
- warnings.simplefilter('ignore', category=DeprecationWarning)
- loc = getdefaultlocale()
-
- _setlocale(category, _build_localename(loc))
-
try:
from _locale import getencoding
@@ -1729,17 +1709,6 @@ def _print_locale():
print(' Encoding: ', enc or '(undefined)')
print()
- print()
- print('Locale settings after calling resetlocale():')
- print('-'*72)
- resetlocale()
- for name,category in categories.items():
- print(name, '...')
- lang, enc = getlocale(category)
- print(' Language: ', lang or '(undefined)')
- print(' Encoding: ', enc or '(undefined)')
- print()
-
try:
setlocale(LC_ALL, "")
except: