Merge pull request #539 from michael-lazar/null_byte_error_py2
Fixing invalid null byte handling for python 2
This commit is contained in:
@@ -275,8 +275,10 @@ class Terminal(object):
|
|||||||
text = self.clean(text, n_cols)
|
text = self.clean(text, n_cols)
|
||||||
params = [] if attr is None else [attr]
|
params = [] if attr is None else [attr]
|
||||||
window.addstr(row, col, text, *params)
|
window.addstr(row, col, text, *params)
|
||||||
except (curses.error, ValueError) as e:
|
except (curses.error, ValueError, TypeError) as e:
|
||||||
# window.addstr could raise "ValueError: embedded null byte"
|
# Curses handling of strings with invalid null bytes (b'\00')
|
||||||
|
# python 2: TypeError: "int,int,str"
|
||||||
|
# python 3: ValueError: "embedded null byte"
|
||||||
_logger.warning('add_line raised an exception')
|
_logger.warning('add_line raised an exception')
|
||||||
_logger.exception(str(e))
|
_logger.exception(str(e))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user