Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-104783: locale.getlocale() calls sys.getfilesystemencoding()
locale.getlocale() always calls sys.getfilesystemencoding(), instead
of calling it only once.
  • Loading branch information
vstinner committed Jun 6, 2023
commit eed65ea6fddb94528bfef765e8190b7a561ea97a
3 changes: 1 addition & 2 deletions Lib/locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down