aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2021-05-19 14:39:41 -0400
committerMarkus Armbruster <armbru@redhat.com>2021-05-20 11:28:27 +0200
commit7c610ce6a9950a49148fc3d37ed353958ca8d776 (patch)
tree4e5af55a52a26bd9805334c41e07d2aeb7a1e643 /scripts
parent16ff40acc9c1fc871c2c835b3b20e374d6daed98 (diff)
downloadqemu-7c610ce6a9950a49148fc3d37ed353958ca8d776.zip
qemu-7c610ce6a9950a49148fc3d37ed353958ca8d776.tar.gz
qemu-7c610ce6a9950a49148fc3d37ed353958ca8d776.tar.bz2
qapi/parser: Assert lexer value is a string
The type checker can't narrow the type of the token value to string, because it's only loosely correlated with the return token. We know that a token of '#' should always have a "str" value. Add an assertion. Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210519183951.3946870-6-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi/parser.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index d620706..0bc852e 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -304,6 +304,7 @@ class QAPISchemaParser:
cur_doc = QAPIDoc(self, info)
self.accept(False)
while self.tok == '#':
+ assert isinstance(self.val, str)
if self.val.startswith('##'):
# End of doc comment
if self.val != '##':