You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-python/urwid/files/urwid-2.1.1-ignore-resettin...

33 lines
998 B

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