From 221d703498d84e363070c89c28f839edceaac9b2 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 6 Jun 2023 20:19:40 +0200 Subject: [PATCH] gh-104783: locale.getlocale() calls sys.getfilesystemencoding() (#105401) locale.getlocale() always calls sys.getfilesystemencoding(), instead of calling it only once. --- Lib/locale.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/locale.py b/Lib/locale.py index cd52ecd28f4..55c819ca80a 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: