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

This commit is contained in:
Hugo van Kemenade 2023-10-27 16:08:53 +03:00 committed by GitHub
parent 22cde39fbf
commit e7cdcccd26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 6 deletions

View 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)

View 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`.)

View 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

View file

@ -0,0 +1 @@
Postpone removal version for locale.getdefaultlocale() to Python 3.15.