summaryrefslogtreecommitdiff
path: root/dev-python/urwid/files/urwid-2.1.1-ignore-resetting-to-invalid-locale.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/urwid/files/urwid-2.1.1-ignore-resetting-to-invalid-locale.patch')
-rw-r--r--dev-python/urwid/files/urwid-2.1.1-ignore-resetting-to-invalid-locale.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/dev-python/urwid/files/urwid-2.1.1-ignore-resetting-to-invalid-locale.patch b/dev-python/urwid/files/urwid-2.1.1-ignore-resetting-to-invalid-locale.patch
new file mode 100644
index 000000000000..61549a50d087
--- /dev/null
+++ b/dev-python/urwid/files/urwid-2.1.1-ignore-resetting-to-invalid-locale.patch
@@ -0,0 +1,32 @@
+From fd010f8336407ad1a42522b424d2ea7b7800ebc4 Mon Sep 17 00:00:00 2001
+From: Jochen Sprickerhof <git@jochen.sprickerhof.de>
+Date: Fri, 26 Jun 2020 22:26:23 +0200
+Subject: [PATCH] Ignore resetting to invalid locale (Closes: #377)
+
+Resetting the locale was introduced in 5dcf236, before that an invalid
+locale was ignored. Restore the old behavior insofar that only valid
+locales are restored.
+This fixes the unit tests of scottkosty/vit with unset LANG.
+---
+ urwid/util.py | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/urwid/util.py b/urwid/util.py
+index 17c049d..acd62f6 100644
+--- a/urwid/util.py
++++ b/urwid/util.py
+@@ -55,7 +55,10 @@ def detect_encoding():
+ else:
+ raise
+ finally:
+- locale.setlocale(locale.LC_ALL, initial)
++ try:
++ locale.setlocale(locale.LC_ALL, initial)
++ except locale.Error:
++ pass
+
+ if 'detected_encoding' not in locals():
+ detected_encoding = detect_encoding()
+--
+2.26.2
+