From 5253f7c0214f598bdc8b96e0e90e9dd459a96b25 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Fri, 17 Dec 2021 15:04:05 -0800 Subject: [PATCH] curses.tigetstr() can return None (#11781) 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)