Skip to content

[3.11] gh-111187: Postpone removal version for locale.getdefaultlocale() to 3.15 (GH-111188) #111326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/locale.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`.)
Expand Down
9 changes: 5 additions & 4 deletions Lib/locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Postpone removal version for locale.getdefaultlocale() to Python 3.15.