]> git.phdru.name Git - extfs.d.git/commitdiff
Fix(locale): Do not call `locale.getdefaultlocale()` under Python 3.11+
authorOleg Broytman <phd@phdru.name>
Wed, 9 Aug 2023 18:14:21 +0000 (21:14 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 13 Aug 2023 13:08:26 +0000 (16:08 +0300)
The call is deprecated.

torrent
xml

diff --git a/torrent b/torrent
index 550ad72ebf9c1f459e12a5cfa7b0eccf19bb2207..1a3c2c17b302266296dc6bf1ac833d7d94bb1beb 100755 (executable)
--- 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 d2beb551219fa0cdd34c3e79cee44a4181c6b45c..59144c3752f318cb740cd2679b563838a6d3c180 100755 (executable)
--- 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 = []