From 2991740817adbf7fe01e296561b1c145aa0b9bb3 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:43:41 +0200 Subject: [PATCH] sys.flags.ignore_environment means ignore only PYTHON* env vars --- Lib/_colorize.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Lib/_colorize.py b/Lib/_colorize.py index 845fb57a90abb8e..139b7f5da0926c9 100644 --- a/Lib/_colorize.py +++ b/Lib/_colorize.py @@ -49,11 +49,10 @@ def can_colorize() -> bool: return False if not COLORIZE: return False - if not sys.flags.ignore_environment: - if "FORCE_COLOR" in os.environ: - return True - if os.environ.get("TERM") == "dumb": - return False + if "FORCE_COLOR" in os.environ: + return True + if os.environ.get("TERM") == "dumb": + return False if not hasattr(sys.stderr, "fileno"): return False