[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/25] qapi: Tighten check whether implicit object type already ex
|
From: |
Markus Armbruster |
|
Subject: |
[PULL 24/25] qapi: Tighten check whether implicit object type already exists |
|
Date: |
Wed, 24 Apr 2024 10:17:09 +0200 |
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>
---
scripts/qapi/schema.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index e52930a48a..a6180f93c6 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -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.
--
2.44.0
- [PULL 25/25] qapi: Dumb down QAPISchema.lookup_entity(), (continued)
- [PULL 25/25] qapi: Dumb down QAPISchema.lookup_entity(), Markus Armbruster, 2024/04/24
- [PULL 04/25] qapi/schema: add pylint suppressions, Markus Armbruster, 2024/04/24
- [PULL 12/25] qapi: Assert built-in types exist, Markus Armbruster, 2024/04/24
- [PULL 07/25] qapi/schema: declare type for QAPISchemaArrayType.element_type, Markus Armbruster, 2024/04/24
- [PULL 05/25] qapi: create QAPISchemaDefinition, Markus Armbruster, 2024/04/24
- [PULL 18/25] qapi/schema: assert inner type of QAPISchemaVariants in check_clash(), Markus Armbruster, 2024/04/24
- [PULL 08/25] qapi/schema: make c_type() and json_type() abstract methods, Markus Armbruster, 2024/04/24
- [PULL 21/25] qapi/schema: add type hints, Markus Armbruster, 2024/04/24
- [PULL 11/25] qapi/schema: assert resolve_type has 'info' and 'what' args on error, Markus Armbruster, 2024/04/24
- [PULL 19/25] qapi/parser: demote QAPIExpression to Dict[str, Any], Markus Armbruster, 2024/04/24
- [PULL 24/25] qapi: Tighten check whether implicit object type already exists,
Markus Armbruster <=
- Re: [PULL 00/25] QAPI patches patches for 2024-04-24, Richard Henderson, 2024/04/24