From: Oleg Broytman Date: Thu, 10 Aug 2023 14:20:16 +0000 (+0300) Subject: Fix(locale): Do not call `locale.getdefaultlocale()` under Python 3.11+ X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=88c359c7bb71a3dbc81440ec74e3d1685c65a3f2;p=m_lib.defenc.git Fix(locale): Do not call `locale.getdefaultlocale()` under Python 3.11+ The call is deprecated. --- diff --git a/m_lib/defenc.py b/m_lib/defenc.py index 776b78d..22cd21b 100755 --- a/m_lib/defenc.py +++ b/m_lib/defenc.py @@ -15,7 +15,10 @@ __all__ = ['default_encoding'] if use_locale: # Get the default charset. try: - lcAll = locale.getdefaultlocale() + if sys.version_info[:2] < (3, 11): + lcAll = locale.getdefaultlocale() + else: + lcAll = [] except locale.Error as err: print("WARNING:", err, file=sys.stderr) lcAll = []