]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] 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:45 +0000 (16:08 +0300)
committerGitHub <noreply@github.com>
Fri, 27 Oct 2023 13:08:45 +0000 (16:08 +0300)
Doc/library/locale.rst
Doc/whatsnew/3.11.rst
Doc/whatsnew/3.12.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 f2abb3638a141f1abace140a75e6477fc5b1c538..0817ae5883ce8a6a53a41a0c5990ce06fa72c2ab 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 88eaee9791415b7b02e554498ed3da820103f3fd..c28093ac193eaf8cac498ec45f6d825cd2f08c05 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 18fca00c9d5a7b4e0134e015f6018c500d174784..99e566f7d253c82913f6a6f22d9a34fc0813f5d2 100644 (file)
@@ -1360,7 +1360,7 @@ Other modules:
 APIs:
 
 * :class:`!configparser.LegacyInterpolation` (:gh:`90765`)
-* :func:`locale.getdefaultlocale` (:gh:`90817`)
+* ``locale.resetlocale()`` (:gh:`90817`)
 * :meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)
 * :func:`!unittest.findTestCases` (:gh:`50096`)
 * :func:`!unittest.getTestCaseNames` (:gh:`50096`)
@@ -1429,6 +1429,17 @@ and will be removed in Python 3.14.
 
 * The ``co_lnotab`` attribute of code objects.
 
+Pending Removal in Python 3.15
+------------------------------
+
+The following APIs have been deprecated
+and will be removed in Python 3.15.
+
+APIs:
+
+* :func:`locale.getdefaultlocale` (:gh:`90817`)
+
+
 Pending Removal in Future Versions
 ----------------------------------
 
index e94f0d1acbaa7d2189ee7f802db44ef80cafe568..4965c9730740cc947d162e0998aae40552d9dc32 100644 (file)
@@ -541,12 +541,14 @@ 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))
     return _getdefaultlocale(envvars)
 
+
 def _getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
     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.