aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-03-16 08:13:18 +0100
committerMarkus Armbruster <armbru@redhat.com>2023-04-24 15:21:39 +0200
commit6f2ab6090de993988f7345e449852821ffc75f4e (patch)
treed9c9d1f9c6cb65f5fdb754f9bd16d0e926ff1d08 /scripts/qapi
parent7c4075190da24a01d9c02f5f59cf0651611bd40f (diff)
downloadqemu-6f2ab6090de993988f7345e449852821ffc75f4e.zip
qemu-6f2ab6090de993988f7345e449852821ffc75f4e.tar.gz
qemu-6f2ab6090de993988f7345e449852821ffc75f4e.tar.bz2
qapi: Fix error message when type name or array is expected
We incorrectly report "FOO should be a type name" when it could also be an array. Fix that. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20230316071325.492471-8-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts/qapi')
-rw-r--r--scripts/qapi/expr.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py
index 8a8de9e..9bae500 100644
--- a/scripts/qapi/expr.py
+++ b/scripts/qapi/expr.py
@@ -344,15 +344,14 @@ def check_type_name_or_array(value: Optional[object],
if value is None or isinstance(value, str):
return
- if isinstance(value, list):
- if len(value) != 1 or not isinstance(value[0], str):
- raise QAPISemError(info,
- "%s: array type must contain single type name" %
- source)
- return
+ if not isinstance(value, list):
+ raise QAPISemError(info,
+ "%s should be a type name or array" % source)
- raise QAPISemError(info,
- "%s should be a type name" % source)
+ if len(value) != 1 or not isinstance(value[0], str):
+ raise QAPISemError(info,
+ "%s: array type must contain single type name" %
+ source)
def check_type_name_or_implicit(value: Optional[object],