summaryrefslogtreecommitdiffstats
path: root/scripts/qapi/main.py
diff options
context:
space:
mode:
authorJohn Snow2021-02-01 20:37:34 +0100
committerMarkus Armbruster2021-02-08 14:15:58 +0100
commitad1218086efb469d292f5cdd3e8299e5d2e7d8d6 (patch)
tree5394e93603280b11d3966833d287dc5bab79e998 /scripts/qapi/main.py
parentqapi/events: fix visit_event typing (diff)
downloadqemu-ad1218086efb469d292f5cdd3e8299e5d2e7d8d6.tar.gz
qemu-ad1218086efb469d292f5cdd3e8299e5d2e7d8d6.tar.xz
qemu-ad1218086efb469d292f5cdd3e8299e5d2e7d8d6.zip
qapi/main: handle theoretical None-return from re.match()
Mypy cannot understand that this match can never be None, so help it along. Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210201193747.2169670-4-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/main.py')
-rw-r--r--scripts/qapi/main.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/qapi/main.py b/scripts/qapi/main.py
index 42517210b8..703e7ed1ed 100644
--- a/scripts/qapi/main.py
+++ b/scripts/qapi/main.py
@@ -23,6 +23,8 @@ from .visit import gen_visit
def invalid_prefix_char(prefix: str) -> Optional[str]:
match = re.match(r'([A-Za-z_.-][A-Za-z0-9_.-]*)?', prefix)
+ # match cannot be None, but mypy cannot infer that.
+ assert match is not None
if match.end() != len(prefix):
return prefix[match.end()]
return None