File tree Expand file tree Collapse file tree 4 files changed +21
-2
lines changed
Expand file tree Collapse file tree 4 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,8 @@ The :mod:`locale` module defines the following exception and functions:
375375 The default setting is determined by calling :func: `getdefaultlocale `.
376376 *category * defaults to :const: `LC_ALL `.
377377
378+ .. deprecated :: 3.11 3.13
379+
378380
379381.. function :: strcoll(string1, string2)
380382
Original file line number Diff line number Diff line change @@ -1221,7 +1221,11 @@ Deprecated
12211221 removed in Python 3.13. Use :func: `locale.setlocale `,
12221222 :func: `locale.getpreferredencoding(False) <locale.getpreferredencoding> ` and
12231223 :func: `locale.getlocale ` functions instead.
1224- (Contributed by Victor Stinner in :issue: `46659 `.)
1224+ (Contributed by Victor Stinner in :gh: `90817 `.)
1225+
1226+ * The :func: `locale.resetlocale ` function is deprecated and will be
1227+ removed in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, "") `` instead.
1228+ (Contributed by Victor Stinner in :gh: `90817 `.)
12251229
12261230* The :mod: `asynchat `, :mod: `asyncore ` and :mod: `smtpd ` modules have been
12271231 deprecated since at least Python 3.6. Their documentation and deprecation
Original file line number Diff line number Diff line change @@ -633,7 +633,17 @@ def resetlocale(category=LC_ALL):
633633 getdefaultlocale(). category defaults to LC_ALL.
634634
635635 """
636- _setlocale (category , _build_localename (getdefaultlocale ()))
636+ import warnings
637+ warnings .warn (
638+ 'Use locale.setlocale(locale.LC_ALL, "") instead' ,
639+ DeprecationWarning , stacklevel = 2
640+ )
641+
642+ with warnings .catch_warnings ():
643+ warnings .simplefilter ('ignore' , category = DeprecationWarning )
644+ loc = getdefaultlocale ()
645+
646+ _setlocale (category , _build_localename (loc ))
637647
638648
639649try :
Original file line number Diff line number Diff line change 1+ The :func: `locale.resetlocale ` function is deprecated and will be removed in
2+ Python 3.13. Use ``locale.setlocale(locale.LC_ALL, "") `` instead. Patch by
3+ Victor Stinner.
You can’t perform that action at this time.
0 commit comments