summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2024-03-15 16:22:49 +0100
committerMarkus Armbruster <armbru@redhat.com>2024-04-24 10:03:54 +0200
commit8c91329ff09cec94dac22b459cc9914a7f49c54a (patch)
tree6f473b3d1e6b9fff95342e25b26803248a01cbd4
parent7191400a44c4eef49d2af356e0744bfb5d273046 (diff)
downloadfocaccia-qemu-8c91329ff09cec94dac22b459cc9914a7f49c54a.tar.gz
focaccia-qemu-8c91329ff09cec94dac22b459cc9914a7f49c54a.zip
qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type
Adjust the expression at the callsite to work around mypy's weak type
introspection that believes this expression can resolve to
QAPISourceInfo; it cannot.

(Fundamentally: self.info only resolves to false in a boolean expression
when it is None; therefore this expression may only ever produce
Optional[str]. mypy does not know that 'info', when it is a
QAPISourceInfo object, cannot ever be false.)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-14-armbru@redhat.com>
-rw-r--r--scripts/qapi/schema.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 0ef9b3398a..087c6e9366 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -395,7 +395,7 @@ class QAPISchemaArrayType(QAPISchemaType):
         super().check(schema)
         self.element_type = schema.resolve_type(
             self._element_type_name, self.info,
-            self.info and self.info.defn_meta)
+            self.info.defn_meta if self.info else None)
         assert not isinstance(self.element_type, QAPISchemaArrayType)
 
     def set_module(self, schema):