Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0cb6b9b

Browse files
authored
gh-104783: Remove locale.resetlocale() function (#104784)
1 parentc7bf74b commit0cb6b9b

File tree

5 files changed

+8
-42
lines changed

5 files changed

+8
-42
lines changed

‎Doc/library/locale.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,6 @@ The :mod:`locale` module defines the following exception and functions:
370370
encoding for the locale code just like:func:`setlocale`.
371371

372372

373-
..function::resetlocale(category=LC_ALL)
374-
375-
Sets the locale for *category* to the default setting.
376-
377-
The default setting is determined by calling:func:`getdefaultlocale`.
378-
*category* defaults to:const:`LC_ALL`.
379-
380-
..deprecated-removed::3.11 3.13
381-
382-
383373
..function::strcoll(string1, string2)
384374

385375
Compares two strings according to the current:const:`LC_COLLATE` setting. As

‎Doc/whatsnew/3.12.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,7 @@ APIs:
10791079

10801080
*:class:`!configparser.LegacyInterpolation` (:gh:`90765`)
10811081
*:func:`locale.getdefaultlocale` (:gh:`90817`)
1082+
* ``locale.resetlocale()`` (:gh:`90817`)
10821083
*:meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)
10831084
*:func:`!unittest.findTestCases` (:gh:`50096`)
10841085
*:func:`!unittest.getTestCaseNames` (:gh:`50096`)

‎Doc/whatsnew/3.13.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ Removed
306306
added in Python 3.8 and the old macros were deprecated in Python 3.11.
307307
(Contributed by Irit Katriel in:gh:`105111`.)
308308

309+
* Remove ``locale.resetlocale()`` function deprecated in Python 3.11:
310+
use ``locale.setlocale(locale.LC_ALL, "")`` instead.
311+
(Contributed by Victor Stinner in:gh:`104783`.)
312+
309313

310314
Porting to Python 3.13
311315
======================

‎Lib/locale.py

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before
2626
# trying the import. So __all__ is also fiddled at the end of the file.
2727
__all__= ["getlocale","getdefaultlocale","getpreferredencoding","Error",
28-
"setlocale","resetlocale","localeconv","strcoll","strxfrm",
28+
"setlocale","localeconv","strcoll","strxfrm",
2929
"str","atof","atoi","format_string","currency",
3030
"normalize","LC_CTYPE","LC_COLLATE","LC_TIME","LC_MONETARY",
3131
"LC_NUMERIC","LC_ALL","CHAR_MAX","getencoding"]
@@ -612,26 +612,6 @@ def setlocale(category, locale=None):
612612
locale=normalize(_build_localename(locale))
613613
return_setlocale(category,locale)
614614

615-
defresetlocale(category=LC_ALL):
616-
617-
""" Sets the locale for category to the default setting.
618-
619-
The default setting is determined by calling
620-
getdefaultlocale(). category defaults to LC_ALL.
621-
622-
"""
623-
importwarnings
624-
warnings.warn(
625-
'Use locale.setlocale(locale.LC_ALL, "") instead',
626-
DeprecationWarning,stacklevel=2
627-
)
628-
629-
withwarnings.catch_warnings():
630-
warnings.simplefilter('ignore',category=DeprecationWarning)
631-
loc=getdefaultlocale()
632-
633-
_setlocale(category,_build_localename(loc))
634-
635615

636616
try:
637617
from_localeimportgetencoding
@@ -1729,17 +1709,6 @@ def _init_categories(categories=categories):
17291709
print(' Encoding: ',encor'(undefined)')
17301710
print()
17311711

1732-
print()
1733-
print('Locale settings after calling resetlocale():')
1734-
print('-'*72)
1735-
resetlocale()
1736-
forname,categoryincategories.items():
1737-
print(name,'...')
1738-
lang,enc=getlocale(category)
1739-
print(' Language: ',langor'(undefined)')
1740-
print(' Encoding: ',encor'(undefined)')
1741-
print()
1742-
17431712
try:
17441713
setlocale(LC_ALL,"")
17451714
except:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove ``locale.resetlocale()`` function deprecated in Python 3.11.
2+
Patch by Victor Stinner.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp