Skip to content

Commit 3fe5f44

Browse files
committed
gh-157581: Handle exceptions in can_colorize
Handle unexpected exceptions in can_colorize instead of surfacing them in the REPL
1 parent 82952e3 commit 3fe5f44

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎Lib/_colorize.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,8 @@ def _safe_getenv(k: str, fallback: str | None = None) -> str | None:
603603
return os.isatty(file.fileno())
604604
except OSError:
605605
return hasattr(file, "isatty") and file.isatty()
606+
except Exception:
607+
return False
606608

607609

608610
default_theme = Theme()

0 commit comments

Comments
 (0)