aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 cf0045f..cfb574c 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"