Skip to content

Commit

Permalink
curses.tigetstr() can return None (python#11781)
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored and tushar-deepsource committed Jan 20, 2022
1 parent 6b7343e commit 60e9d74
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mypy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 60e9d74

Please sign in to comment.