From: Victor Stinner Date: Tue, 6 Jun 2023 18:19:40 +0000 (+0200) Subject: gh-104783: locale.getlocale() calls sys.getfilesystemencoding() (#105401) X-Git-Tag: v3.13.0a1~1873 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=221d703498d84e363070c89c28f839edceaac9b2;p=thirdparty%2FPython%2Fcpython.git gh-104783: locale.getlocale() calls sys.getfilesystemencoding() (#105401) locale.getlocale() always calls sys.getfilesystemencoding(), instead of calling it only once. --- diff --git a/Lib/locale.py b/Lib/locale.py index cd52ecd28f43..55c819ca80a1 100644 --- a/Lib/locale.py +++ b/Lib/locale.py @@ -618,9 +618,8 @@ try: except ImportError: # When _locale.getencoding() is missing, locale.getencoding() uses the # Python filesystem encoding. - _encoding = sys.getfilesystemencoding() def getencoding(): - return _encoding + return sys.getfilesystemencoding() try: