Skip to content

Commit 60e9d74

Browse files
JelleZijlstratushar-deepsource
authored andcommitted
curses.tigetstr() can return None (python#11781)
Found by python/typeshed#6620
1 parent 6b7343e commit 60e9d74

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mypy/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,12 @@ def initialize_unix_colors(self) -> bool:
566566
under = curses.tigetstr('smul')
567567
set_color = curses.tigetstr('setaf')
568568
set_eseq = curses.tigetstr('cup')
569+
normal = curses.tigetstr('sgr0')
569570

570-
if not (bold and under and set_color and set_eseq):
571+
if not (bold and under and set_color and set_eseq and normal):
571572
return False
572573

573-
self.NORMAL = curses.tigetstr('sgr0').decode()
574+
self.NORMAL = normal.decode()
574575
self.BOLD = bold.decode()
575576
self.UNDER = under.decode()
576577
self.DIM = parse_gray_color(set_eseq)

0 commit comments

Comments
 (0)