From ae009318b2faa4b5f043b6f87353de7123a43409 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 4 Jun 2013 13:20:59 +0200 Subject: Fix #2299 (invalid characters causing a TB) any character beyond 0x110000 does not exist and should be dropped --- src/keyboard.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/keyboard.py b/src/keyboard.py index ffc7dd60..240cc2c8 100644 --- a/src/keyboard.py +++ b/src/keyboard.py @@ -92,6 +92,9 @@ def get_char_list_new(s): except curses.error: # No input, this means a timeout occurs. return ret_list + except ValueError: # invalid input + log.debug('Invalid character entered.') + return ret_list s.timeout(0) if isinstance(key, int): ret_list.append(curses.keyname(key).decode()) @@ -104,6 +107,9 @@ def get_char_list_new(s): part = s.get_wch() except curses.error: pass + except ValueError: # invalid input + log.debug('Invalid character entered.') + pass else: key = 'M-%s' % part # and an even more special case for keys like @@ -114,6 +120,9 @@ def get_char_list_new(s): part = s.get_wch() except curses.error: pass + except ValueError: + log.debug('Invalid character entered.') + pass else: key = '%s-%s' % (key, part) if key == '\x7f' or key == '\x08': -- cgit v1.2.3