qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 1/6] qapi: Tweak "command returns a nice type" check for clarity
Date: Tue, 14 Jan 2020 11:20:50 +0100	[thread overview]
Message-ID: <20200114102055.24058-2-armbru@redhat.com> (raw)
In-Reply-To: <20200114102055.24058-1-armbru@redhat.com>

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20191120182551.23795-2-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 scripts/qapi/schema.py | 9 +++++----
 1 file 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"
-- 
2.21.1



  reply	other threads:[~2020-01-14 10:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 10:20 [PULL 0/6] QAPI patches for 2020-01-14 Markus Armbruster
2020-01-14 10:20 ` Markus Armbruster [this message]
2020-01-14 10:20 ` [PULL 2/6] tests/Makefile.include: Fix missing test-qapi-emit-events.[ch] Markus Armbruster
2020-01-14 10:20 ` [PULL 3/6] qapi: Generate command registration stuff into separate files Markus Armbruster
2020-01-14 10:20 ` [PULL 4/6] qapi: Proper intermediate representation for modules Markus Armbruster
2020-01-14 10:20 ` [PULL 5/6] qapi: Fix code generation for empty modules Markus Armbruster
2020-01-14 10:20 ` [PULL 6/6] qapi: Simplify QAPISchemaModularCVisitor Markus Armbruster
2020-01-16 14:03 ` [PULL 0/6] QAPI patches for 2020-01-14 Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2019-12-17  8:14 [PULL 0/6] QAPI patches for 2019-12-17 Markus Armbruster
2019-12-17  8:14 ` [PULL 1/6] qapi: Tweak "command returns a nice type" check for clarity Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200114102055.24058-2-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).