qapi: Fix to .check() empty structs just once

QAPISchemaObjectType.check() does nothing for types that have been
checked already.  Except the "has been checked" predicate is broken
for empty types: self.members is [] then, which isn't true.  The bug
is harmless, but fix it anyway: use self.member is not None instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190914153506.2151-18-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Markus Armbruster 2019-09-14 17:35:04 +02:00
parent e31fe1266c
commit b1bc31f4b7

View File

@ -1406,7 +1406,7 @@ class QAPISchemaObjectType(QAPISchemaType):
if self.members is False: # check for cycles
raise QAPISemError(self.info,
"Object %s contains itself" % self.name)
if self.members:
if self.members is not None: # already checked
return
self.members = False # mark as being checked
seen = OrderedDict()