summaryrefslogtreecommitdiffstats
path: root/Lib/locale.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-02-22 21:06:43 (GMT)
committerGitHub <noreply@github.com>2022-02-22 21:06:43 (GMT)
commitb899126094731bc49fecb61f2c1b7557d74ca839 (patch)
tree0fcb5dbe42994f32e7caf03514cbfd11fdca825b /Lib/locale.py
parentccbe8045faf6e63d36229ea4e1b9298572cda126 (diff)
downloadcpython-b899126094731bc49fecb61f2c1b7557d74ca839.zip
cpython-b899126094731bc49fecb61f2c1b7557d74ca839.tar.gz
cpython-b899126094731bc49fecb61f2c1b7557d74ca839.tar.bz2
bpo-46659: Deprecate locale.getdefaultlocale() (GH-31206)
The locale.getdefaultlocale() function is deprecated and will be removed in Python 3.13. Use locale.setlocale(), locale.getpreferredencoding(False) and locale.getlocale() functions instead.
Diffstat (limited to 'Lib/locale.py')
-rw-r--r--Lib/locale.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/locale.py b/Lib/locale.py
index 4bd31c9..a710f27 100644
--- a/Lib/locale.py
+++ b/Lib/locale.py
@@ -555,6 +555,12 @@ def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
"""
+ import warnings
+ warnings.warn(
+ "Use setlocale(), getpreferredencoding(False) and getlocale() instead",
+ DeprecationWarning, stacklevel=2
+ )
+
try:
# check if it's supported by the _locale module
import _locale