From 60a2cad054e289df4e6d25e216350f3516661462 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 9 Aug 2023 21:14:21 +0300 Subject: [PATCH] Fix(locale): Do not call `locale.getdefaultlocale()` under Python 3.11+ The call is deprecated. --- torrent | 5 ++++- xml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/torrent b/torrent index 550ad72..1a3c2c1 100755 --- a/torrent +++ b/torrent @@ -56,7 +56,10 @@ except ImportError: 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 = [] diff --git a/xml b/xml index d2beb55..59144c3 100755 --- a/xml +++ b/xml @@ -86,7 +86,10 @@ except ImportError: 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 = [] -- 2.39.5