]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-111187: Postpone removal version for locale.getdefaultlocale() to 3.15...
authorHugo van Kemenade <hugovk@users.noreply.github.com>
Fri, 27 Oct 2023 13:08:53 +0000 (16:08 +0300)
committerGitHub <noreply@github.com>
Fri, 27 Oct 2023 13:08:53 +0000 (16:08 +0300)
Doc/library/locale.rst
Doc/whatsnew/3.11.rst
Lib/locale.py
Misc/NEWS.d/next/Library/2023-10-22-21-28-05.gh-issue-111187._W11Ab.rst [new file with mode: 0644]

index 2948105d2925c418057efad2e2f4e9bc7d619cf8..6b9f1d3391997eb8f2cbeee31e46484423e7371f 100644 (file)
@@ -303,7 +303,7 @@ The :mod:`locale` module defines the following exception and functions:
    *language code* and *encoding* may be ``None`` if their values cannot be
    determined.
 
-   .. deprecated-removed:: 3.11 3.13
+   .. deprecated-removed:: 3.11 3.15
 
 
 .. function:: getlocale(category=LC_CTYPE)
index fda4fbcb122dcf9435fe902ff8eb19c04cdb44ca..698df284c9fd4a61d5317f3cda696860545b98f9 100644 (file)
@@ -1798,7 +1798,7 @@ Standard Library
   * :func:`importlib.resources.path`
 
 * The :func:`locale.getdefaultlocale` function is deprecated and will be
-  removed in Python 3.13. Use :func:`locale.setlocale`,
+  removed in Python 3.15. Use :func:`locale.setlocale`,
   :func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>` and
   :func:`locale.getlocale` functions instead.
   (Contributed by Victor Stinner in :gh:`90817`.)
index 7a7694e1bfb71cc5a84e6f9df1eae67549a094d4..f45841ed629e3ad79679e7539502db3200962e69 100644 (file)
@@ -556,10 +556,11 @@ def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
     """
 
     import warnings
-    warnings.warn(
-        "Use setlocale(), getencoding() and getlocale() instead",
-        DeprecationWarning, stacklevel=2
-    )
+    warnings._deprecated(
+        "locale.getdefaultlocale",
+        "{name!r} is deprecated and slated for removal in Python {remove}. "
+        "Use setlocale(), getencoding() and getlocale() instead.",
+        remove=(3, 15))
 
     try:
         # check if it's supported by the _locale module
diff --git a/Misc/NEWS.d/next/Library/2023-10-22-21-28-05.gh-issue-111187._W11Ab.rst b/Misc/NEWS.d/next/Library/2023-10-22-21-28-05.gh-issue-111187._W11Ab.rst
new file mode 100644 (file)
index 0000000..dc24243
--- /dev/null
@@ -0,0 +1 @@
+Postpone removal version for locale.getdefaultlocale() to Python 3.15.