From efcd068cc99972fcf6527bcde0afb5661c9b1e1f Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 17 Dec 2021 09:23:12 -0800 Subject: [PATCH] curses.tigetstr() can return None Found by python/typeshed#6620 --- mypy/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mypy/util.py b/mypy/util.py index b25f069d845d..533e9c6bee6e 100644 --- a/mypy/util.py +++ b/mypy/util.py @@ -566,11 +566,12 @@ def initialize_unix_colors(self) -> bool: under = curses.tigetstr('smul') set_color = curses.tigetstr('setaf') set_eseq = curses.tigetstr('cup') + normal = curses.tigetstr('sgr0') - if not (bold and under and set_color and set_eseq): + if not (bold and under and set_color and set_eseq and normal): return False - self.NORMAL = curses.tigetstr('sgr0').decode() + self.NORMAL = normal.decode() self.BOLD = bold.decode() self.UNDER = under.decode() self.DIM = parse_gray_color(set_eseq)