summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Snow2021-04-21 20:20:24 +0200
committerMarkus Armbruster2021-04-30 12:59:54 +0200
commit538cd41065ae5e506a1a07e866b1fd40b4b53d07 (patch)
treec727cca8328cdcae9e124a776a8c00a0e48e8e9e
parentqapi/expr.py: Add casts in a few select cases (diff)
downloadqemu-538cd41065ae5e506a1a07e866b1fd40b4b53d07.tar.gz
qemu-538cd41065ae5e506a1a07e866b1fd40b4b53d07.tar.xz
qemu-538cd41065ae5e506a1a07e866b1fd40b4b53d07.zip
qapi/expr.py: Modify check_keys to accept any Collection
This is a minor adjustment that lets parameters @required and @optional take tuple arguments, in particular (). Later patches will make use of that. (Iterable would also have worked, but Iterable also includes things like generator expressions which are consumed upon iteration, which would require a rewrite to make sure that each input was only traversed once. Collection implies the "can re-iterate" property.) Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20210421182032.3521476-10-jsnow@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r--scripts/qapi/expr.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index f3a4a8536e..396c8126d6 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -102,7 +102,7 @@ def check_keys(value, info, source, required, optional):
"%s misses key%s %s"
% (source, 's' if len(missing) > 1 else '',
pprint(missing)))
- allowed = set(required + optional)
+ allowed = set(required) | set(optional)
unknown = set(value) - allowed
if unknown:
raise QAPISemError(