aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2019-11-20 19:25:46 +0100
committerMarkus Armbruster <armbru@redhat.com>2020-01-14 11:01:58 +0100
commit7e9c1707e14e50d5447cc6c3d3b20a641331ad18 (patch)
tree89ff23c34de39bd5eb9ccce4a62224fe19e6d87c /scripts/qapi
parentdc65a5bdc9fa543690a775b50d4ffbeb22c56d6d (diff)
qapi: Tweak "command returns a nice type" check for clarity
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191120182551.23795-2-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts/qapi')
-rw-r--r--scripts/qapi/schema.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index cf0045f34e..cfb574c85d 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -711,10 +711,11 @@ class QAPISchemaCommand(QAPISchemaEntity):
self.ret_type = schema.resolve_type(
self._ret_type_name, self.info, "command's 'returns'")
if self.name not in self.info.pragma.returns_whitelist:
- if not (isinstance(self.ret_type, QAPISchemaObjectType)
- or (isinstance(self.ret_type, QAPISchemaArrayType)
- and isinstance(self.ret_type.element_type,
- QAPISchemaObjectType))):
+ typ = self.ret_type
+ if isinstance(typ, QAPISchemaArrayType):
+ typ = self.ret_type.element_type
+ assert typ
+ if not isinstance(typ, QAPISchemaObjectType):
raise QAPISemError(
self.info,
"command's 'returns' cannot take %s"