gh-104783: locale.getlocale() calls sys.getfilesystemencoding() (#105401)

locale.getlocale() always calls sys.getfilesystemencoding(), instead
of calling it only once.
This commit is contained in:
Victor Stinner 2023-06-06 20:19:40 +02:00 committed by GitHub
parent 2b8e6e5712
commit 221d703498
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -618,9 +618,8 @@ def setlocale(category, locale=None):
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: