From 21446e36c1620c2911c3ee9a9d1361b3c31b7227 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 4 Apr 2022 20:01:01 +0530 Subject: [PATCH] Restore invalid LANG after trying to get python to set the locale without it --- kitty/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kitty/main.py b/kitty/main.py index 0a607956e..df553db7c 100644 --- a/kitty/main.py +++ b/kitty/main.py @@ -338,11 +338,13 @@ def set_locale() -> None: locale.setlocale(locale.LC_ALL, '') except Exception: log_error('Failed to set locale with LANG:', os.environ.get('LANG')) - if os.environ.pop('LANG', None) is not None: + old_lang = os.environ.pop('LANG', None) + if old_lang is not None: try: locale.setlocale(locale.LC_ALL, '') except Exception: log_error('Failed to set locale with no LANG') + os.environ['LANG'] = old_lang def _main() -> None: