mirror of
https://github.com/python/cpython.git
synced 2025-10-12 09:53:19 +00:00
gh-90817: Deprecate explicitly locale.resetlocale() (#93196)
The function was already deprecated in Python 3.11 since it calls locale.getdefaultlocale() which was deprecated in Python 3.11.
This commit is contained in:
parent
854db1a606
commit
bf58cd01b3
4 changed files with 21 additions and 2 deletions
|
@ -375,6 +375,8 @@ The :mod:`locale` module defines the following exception and functions:
|
||||||
The default setting is determined by calling :func:`getdefaultlocale`.
|
The default setting is determined by calling :func:`getdefaultlocale`.
|
||||||
*category* defaults to :const:`LC_ALL`.
|
*category* defaults to :const:`LC_ALL`.
|
||||||
|
|
||||||
|
.. deprecated:: 3.11 3.13
|
||||||
|
|
||||||
|
|
||||||
.. function:: strcoll(string1, string2)
|
.. function:: strcoll(string1, string2)
|
||||||
|
|
||||||
|
|
|
@ -1221,7 +1221,11 @@ Deprecated
|
||||||
removed in Python 3.13. Use :func:`locale.setlocale`,
|
removed in Python 3.13. Use :func:`locale.setlocale`,
|
||||||
:func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>` and
|
:func:`locale.getpreferredencoding(False) <locale.getpreferredencoding>` and
|
||||||
:func:`locale.getlocale` functions instead.
|
:func:`locale.getlocale` functions instead.
|
||||||
(Contributed by Victor Stinner in :issue:`46659`.)
|
(Contributed by Victor Stinner in :gh:`90817`.)
|
||||||
|
|
||||||
|
* The :func:`locale.resetlocale` function is deprecated and will be
|
||||||
|
removed in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, "")`` instead.
|
||||||
|
(Contributed by Victor Stinner in :gh:`90817`.)
|
||||||
|
|
||||||
* The :mod:`asynchat`, :mod:`asyncore` and :mod:`smtpd` modules have been
|
* The :mod:`asynchat`, :mod:`asyncore` and :mod:`smtpd` modules have been
|
||||||
deprecated since at least Python 3.6. Their documentation and deprecation
|
deprecated since at least Python 3.6. Their documentation and deprecation
|
||||||
|
|
|
@ -633,7 +633,17 @@ def resetlocale(category=LC_ALL):
|
||||||
getdefaultlocale(). category defaults to LC_ALL.
|
getdefaultlocale(). category defaults to LC_ALL.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
_setlocale(category, _build_localename(getdefaultlocale()))
|
import warnings
|
||||||
|
warnings.warn(
|
||||||
|
'Use locale.setlocale(locale.LC_ALL, "") instead',
|
||||||
|
DeprecationWarning, stacklevel=2
|
||||||
|
)
|
||||||
|
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter('ignore', category=DeprecationWarning)
|
||||||
|
loc = getdefaultlocale()
|
||||||
|
|
||||||
|
_setlocale(category, _build_localename(loc))
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
The :func:`locale.resetlocale` function is deprecated and will be removed in
|
||||||
|
Python 3.13. Use ``locale.setlocale(locale.LC_ALL, "")`` instead. Patch by
|
||||||
|
Victor Stinner.
|
Loading…
Add table
Add a link
Reference in a new issue