]> git.proxmox.com Git - mirror_qemu.git/commit
qapi/schema: fix typing for QAPISchemaVariants.tag_member
authorJohn Snow <jsnow@redhat.com>
Fri, 15 Mar 2024 15:22:53 +0000 (16:22 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Wed, 24 Apr 2024 08:03:54 +0000 (10:03 +0200)
commit583f4d6fdd96f0f25f39018a9b160654e3f9aa01
tree28ee6e6e21c46ff2efa4228ccab20d0e6d0646e8
parent9beda22dcbd93150c822d651322f62e45eab25bb
qapi/schema: fix typing for QAPISchemaVariants.tag_member

There are two related changes here:

(1) We need to perform type narrowing for resolving the type of
    tag_member during check(), and

(2) tag_member is a delayed initialization field, but we can hide it
    behind a property that raises an Exception if it's called too
    early. This simplifies the typing in quite a few places and avoids
    needing to assert that the "tag_member is not None" at a dozen
    callsites, which can be confusing and suggest the wrong thing to a
    drive-by contributor.

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-18-armbru@redhat.com>
scripts/qapi/schema.py