Skip to content

Commit 473788d

Browse files
Handle curses.tigetstr() returning None
Found with python/typeshed#6620
1 parent 208672f commit 473788d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tornado/log.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ def __init__(
151151
self._colors[levelno] = unicode_type(
152152
curses.tparm(fg_color, code), "ascii"
153153
)
154-
self._normal = unicode_type(curses.tigetstr("sgr0"), "ascii")
154+
normal = curses.tigetstr("sgr0")
155+
if normal is not None:
156+
self._normal = unicode_type(normal, "ascii")
157+
else:
158+
self._normal = ""
155159
else:
156160
# If curses is not present (currently we'll only get here for
157161
# colorama on windows), assume hard-coded ANSI color codes.

0 commit comments

Comments
 (0)