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

Commit21e9de3

Browse files
authored
gh-103085: Fix python locale.getencoding not to emit deprecation warning (gh-103086)
1 parentfda95aa commit21e9de3

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

‎Lib/locale.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,9 @@ def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
545545
"Use setlocale(), getencoding() and getlocale() instead",
546546
DeprecationWarning,stacklevel=2
547547
)
548+
return_getdefaultlocale(envvars)
548549

550+
def_getdefaultlocale(envvars=('LC_ALL','LC_CTYPE','LANG','LANGUAGE')):
549551
try:
550552
# check if it's supported by the _locale module
551553
import_locale
@@ -639,7 +641,7 @@ def getencoding():
639641
# On Android langinfo.h and CODESET are missing, and UTF-8 is
640642
# always used in mbstowcs() and wcstombs().
641643
return'utf-8'
642-
encoding=getdefaultlocale()[1]
644+
encoding=_getdefaultlocale()[1]
643645
ifencodingisNone:
644646
# LANG not set, default to UTF-8
645647
encoding='utf-8'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Pure python:func:`locale.getencoding()` will not warn deprecation.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp