Skip to content

Commit

Permalink
qapi: Tighten check whether implicit object type already exists
Browse files Browse the repository at this point in the history
Entities with names starting with q_obj_ are implicit object types.
Therefore, QAPISchema._make_implicit_object_type()'s .lookup_entity()
can only return a QAPISchemaObjectType.  Assert that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-25-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
  • Loading branch information
Markus Armbruster committed Apr 24, 2024
1 parent 8d413db commit 99e75d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/qapi/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1297,8 +1297,9 @@ def _make_implicit_object_type(
return None
# See also QAPISchemaObjectTypeMember.describe()
name = 'q_obj_%s-%s' % (name, role)
typ = self.lookup_entity(name, QAPISchemaObjectType)
typ = self.lookup_entity(name)
if typ:
assert(isinstance(typ, QAPISchemaObjectType))
# The implicit object type has multiple users. This can
# only be a duplicate definition, which will be flagged
# later.
Expand Down

0 comments on commit 99e75d8

Please sign in to comment.