mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-90817: Deprecate explicitly locale.resetlocale() (GH-93196)
The function was already deprecated in Python 3.11 since it calls
locale.getdefaultlocale() which was deprecated in Python 3.11.
(cherry picked from commit bf58cd01b3
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
37a7f1b099
commit
83940c0766
4 changed files with 21 additions and 2 deletions
|
@ -633,7 +633,17 @@ def resetlocale(category=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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue