# Buggy code
def _match_count(self, sequence, dry_run):
    """Try to match a key as count."""
    txt = str(sequence[-1])  # To account for sequences changed above.
    if txt.isdigit() and self._supports_count and not (not self._count and txt == "0"):
        self._debug_log("Trying match as count")
        assert len(txt) == 1, txt
        if not dry_run:
            self._count += txt
            self.keystring_updated.emit(self._count + str(self._sequence))
        return True
    return False


# Traceback (ValueError)
15:47:41 DEBUG    keyboard   basekeyparser:_debug_log:89 Got key: 0xb2 / modifiers: 0x0 / text: '²' / dry_run True
15:47:41 DEBUG    modes      modeman:_handle_keypress:194 match: 2, forward_unbound_keys: auto, passthrough: False, is_non_alnum: False, dry_run: True --> filter: True (focused: <PyQt5.QtWidgets.QWidget object at 0x7fd8c03af438>)
15:47:41 DEBUG    modes      modeman:_handle_keypress:167 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
15:47:41 DEBUG    keyboard   basekeyparser:_debug_log:89 Got key: 0xb2 / modifiers: 0x0 / text: '²' / dry_run False
15:47:41 DEBUG    modes      modeman:_handle_keypress:194 match: 2, forward_unbound_keys: auto, passthrough: False, is_non_alnum: False, dry_run: False --> filter: True (focused: <PyQt5.QtWidgets.QWidget object at 0x7fd8c03af438>)
15:47:41 DEBUG    modes      modeman:_handle_keyrelease:214 filter: True
15:47:41 DEBUG    modes      modeman:_handle_keypress:167 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
15:47:41 DEBUG    keyboard   basekeyparser:_debug_log:89 Got key: 0x4f / modifiers: 0x0 / text: 'o' / dry_run True
15:47:41 DEBUG    modes      modeman:_handle_keypress:194 match: 2, forward_unbound_keys: auto, passthrough: False, is_non_alnum: False, dry_run: True --> filter: True (focused: <PyQt5.QtWidgets.QWidget object at 0x7fd8c03af438>)
15:47:41 DEBUG    modes      modeman:_handle_keypress:167 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
15:47:41 DEBUG    keyboard   basekeyparser:_debug_log:89 Got key: 0x4f / modifiers: 0x0 / text: 'o' / dry_run False
15:47:41 DEBUG    keyboard   basekeyparser:_debug_log:89 Definitive match for 'o'.
15:47:41 ERROR    misc       crashsignal:exception_hook:216 Uncaught exception
Traceback (most recent call last):
File "/usr/lib64/python3.6/site-packages/qutebrowser/app.py", line 933, in eventFilter
return handler(event)
File "/usr/lib64/python3.6/site-packages/qutebrowser/app.py", line 906, in _handle_key_event
return man.handle_event(event)
File "/usr/lib64/python3.6/site-packages/qutebrowser/keyinput/modeman.py", line 335, in handle_event
return handler(event)
File "/usr/lib64/python3.6/site-packages/qutebrowser/keyinput/modeman.py", line 168, in _handle_keypress
match = parser.handle(event, dry_run=dry_run)
File "/usr/lib64/python3.6/site-packages/qutebrowser/keyinput/modeparsers.py", line 98, in handle
match = super().handle(e, dry_run=dry_run)
File "/usr/lib64/python3.6/site-packages/qutebrowser/keyinput/basekeyparser.py", line 180, in handle
count = int(self._count) if self._count else None
ValueError: invalid literal for int() with base 10: '²'

# Fixed code
def _match_count(self, sequence, dry_run):
    """Try to match a key as count."""
    txt = str(sequence[-1])  # To account for sequences changed above.
    if (
        txt in string.digits
        and self._supports_count
        and not (not self._count and txt == "0")
    ):
        self._debug_log("Trying match as count")
        assert len(txt) == 1, txt
        if not dry_run:
            self._count += txt
            self.keystring_updated.emit(self._count + str(self._sequence))
        return True
    return False