Remove usage of deprecated method locale.getdefaultlocale()

Fixes the following deprecation warning:

powerline/lib/encoding.py:49: DeprecationWarning: 'locale.getdefaultlocale' is deprecated and slated for removal in Python 3.15. Use setlocale(), getencoding() and getlocale() instead.
  or locale.getdefaultlocale()[1]
This commit is contained in:
Carl Smedstad 2024-08-24 14:51:15 +02:00
parent f4f5c61337
commit dcc4e0e44b
No known key found for this signature in database
GPG Key ID: 49C93367BA86290E

View File

@ -46,12 +46,12 @@ def get_preferred_output_encoding():
if hasattr(locale, 'LC_MESSAGES'):
return (
locale.getlocale(locale.LC_MESSAGES)[1]
or locale.getdefaultlocale()[1]
or locale.getlocale()[1]
or 'ascii'
)
return (
locale.getdefaultlocale()[1]
locale.getlocale()[1]
or 'ascii'
)
@ -66,12 +66,12 @@ def get_preferred_input_encoding():
if hasattr(locale, 'LC_MESSAGES'):
return (
locale.getlocale(locale.LC_MESSAGES)[1]
or locale.getdefaultlocale()[1]
or locale.getlocale()[1]
or 'latin1'
)
return (
locale.getdefaultlocale()[1]
locale.getlocale()[1]
or 'latin1'
)
@ -86,7 +86,7 @@ def get_preferred_arguments_encoding():
a problem.
'''
return (
locale.getdefaultlocale()[1]
locale.getlocale()[1]
or 'latin1'
)