8000 [3.12] gh-111187: Postpone removal version for locale.getdefaultlocal… · python/cpython@7d22e85 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7d22e85

Browse files
authored
[3.12] gh-111187: Postpone removal version for locale.getdefaultlocale() to 3.15 (GH-111188) (#111323)
1 parent 307ca78 commit 7d22e85

File tree

5 files changed

+21
-7
lines changed

5 files changed

+21
-7
lines changed

Doc/library/locale.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ The :mod:`locale` module defines the following exception and functions:
303303
*language code* and *encoding* may be ``None`` if their values cannot be
304304
determined.
305305

306-
.. deprecated-removed:: 3.11 3.13
306+
.. deprecated-removed:: 3.11 3.15
307307

308308

309309
.. function:: getlocale(category=LC_CTYPE)

Doc/whatsnew/3.11.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,7 @@ Standard Library
17981798
* :func:`importlib.resources.path`
17991799

18001800
* The :func:`locale.getdefaultlocale` function is deprecated and will be
1801-
removed in Python 3.13. Use :func:`locale.setlocale`,
1801+
removed in Python 3.15. Use :func:`locale.setlocale`,
18021802
:func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>` and
18031803
:func:`locale.getlocale` functions instead.
18041804
(Contributed by Victor Stinner in :gh:`90817`.)

Doc/whatsnew/3.12.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ Other modules:
13601360
APIs:
13611361

13621362
* :class:`!configparser.LegacyInterpolation` (:gh:`90765`)
1363-
* :func:`locale.getdefaultlocale` (:gh:`90817`)
1363+
* ``locale.resetlocale()`` (:gh:`90817`)
13641364
* :meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)
13651365
* :func:`!unittest.findTestCases` (:gh:`50096`)
13661366
* :func:`!unittest.getTestCaseNames` (:gh:`50096`)
@@ -1429,6 +1429,17 @@ and will be removed in Python 3.14.
14291429

14301430
* The ``co_lnotab`` attribute of code objects.
14311431

1432+
Pending Removal in Python 3.15
1433+
------------------------------
1434+
1435+
The following APIs have been deprecated
1436+
and will be removed in Python 3.15.
1437+
1438+
APIs:
1439+
1440+
* :func:`locale.getdefaultlocale` (:gh:`90817`)
1441+
1442+
14321443
Pending Removal in Future Versions
14331444
----------------------------------
14341445

Lib/locale.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,14 @@ def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
541541
"""
542542

543543
import warnings
544-
warnings.warn(
545-
"Use setlocale(), getencoding() and getlocale() instead",
546-
DeprecationWarning, stacklevel=2
547-
)
544+
warnings._deprecated(
545+
"locale.getdefaultlocale",
546+
"{name!r} is deprecated and slated for removal in Python {remove}. "
547+
"Use setlocale(), getencoding() and getlocale() instead.",
548+
remove=(3, 15))
548549
return _getdefaultlocale(envvars)
549550

551+
550552
def _getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
551553
try:
552554
# check if it's supported by the _locale module
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Postpone removal version for locale.getdefaultlocale() to Python 3.15.

0 commit comments

Comments
 (0)
0