[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 11/19] qapi/schema: fix QAPISchemaArrayType.check's call to r
|
From: |
Markus Armbruster |
|
Subject: |
Re: [PATCH 11/19] qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type |
|
Date: |
Wed, 22 Nov 2023 13:59:31 +0100 |
|
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
John Snow <jsnow@redhat.com> writes:
> There's more conditionals in here than we can reasonably pack into a
> terse little statement, so break it apart into something more explicit.
>
> (When would a built-in array ever cause a QAPISemError? I don't know,
> maybe never - but the type system wasn't happy all the same.)
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> scripts/qapi/schema.py | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
> index 462acb2bb61..164d86c4064 100644
> --- a/scripts/qapi/schema.py
> +++ b/scripts/qapi/schema.py
> @@ -384,9 +384,16 @@ def need_has_if_optional(self):
>
> def check(self, schema):
> super().check(schema)
> +
> + if self.info:
> + assert self.info.defn_meta # guaranteed to be set by expr.py
> + what = self.info.defn_meta
> + else:
> + what = 'built-in array'
> +
> self._element_type = schema.resolve_type(
> - self._element_type_name, self.info,
> - self.info and self.info.defn_meta)
> + self._element_type_name, self.info, what
> + )
> assert not isinstance(self.element_type, QAPISchemaArrayType)
>
> def set_module(self, schema):
What problem are you solving here?
- Re: [PATCH 05/19] qapi/schema: make c_type() and json_type() abstract methods, (continued)
- Re: [PATCH 05/19] qapi/schema: make c_type() and json_type() abstract methods, Philippe Mathieu-Daudé, 2023/11/16
- Re: [PATCH 05/19] qapi/schema: make c_type() and json_type() abstract methods, Markus Armbruster, 2023/11/21
- Re: [PATCH 05/19] qapi/schema: make c_type() and json_type() abstract methods, Daniel P . Berrangé, 2023/11/21
- Re: [PATCH 05/19] qapi/schema: make c_type() and json_type() abstract methods, John Snow, 2023/11/21
- Re: [PATCH 05/19] qapi/schema: make c_type() and json_type() abstract methods, Daniel P . Berrangé, 2023/11/21
- Re: [PATCH 05/19] qapi/schema: make c_type() and json_type() abstract methods, Markus Armbruster, 2023/11/22
- Re: [PATCH 05/19] qapi/schema: make c_type() and json_type() abstract methods, Daniel P . Berrangé, 2023/11/22
[PATCH 09/19] qapi/schema: assert info is present when necessary, John Snow, 2023/11/15
[PATCH 11/19] qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type, John Snow, 2023/11/15
- Re: [PATCH 11/19] qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type,
Markus Armbruster <=
[PATCH 14/19] qapi/schema: assert QAPISchemaVariants are QAPISchemaObjectType, John Snow, 2023/11/15
[PATCH 13/19] qapi/schema: fix typing for QAPISchemaVariants.tag_member, John Snow, 2023/11/15
[PATCH 17/19] qapi/schema: turn on mypy strictness, John Snow, 2023/11/15
[PATCH 19/19] qapi/schema: refactor entity lookup helpers, John Snow, 2023/11/15