summary refs log tree commit diff stats
path: root/scripts/qapi/parser.py
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2021-05-19 14:39:43 -0400
committerMarkus Armbruster <armbru@redhat.com>2021-05-20 11:28:28 +0200
commit234dce2c2d93cfff7433c0fd244ef207c7eace2b (patch)
treebad37314860309b1c1d73704ba8f0c4566cd2e12 /scripts/qapi/parser.py
parent9cd0205d553bc27a66454782dfc5d7e8d2324e34 (diff)
downloadfocaccia-qemu-234dce2c2d93cfff7433c0fd244ef207c7eace2b.tar.gz
focaccia-qemu-234dce2c2d93cfff7433c0fd244ef207c7eace2b.zip
qapi/parser: assert object keys are strings
The single quote token implies the value is a string. Assert this to be
the case, to allow us to write an accurate return type for get_members.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210519183951.3946870-8-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/parser.py')
-rw-r--r--scripts/qapi/parser.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index ffdd4298b6..4959630ce6 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -249,6 +249,8 @@ class QAPISchemaParser:
             raise QAPIParseError(self, "expected string or '}'")
         while True:
             key = self.val
+            assert isinstance(key, str)  # Guaranteed by tok == "'"
+
             self.accept()
             if self.tok != ':':
                 raise QAPIParseError(self, "expected ':'")