Message ID | 20230316071325.492471-7-armbru@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | qapi: Fix minor bugs, require boxed for conditional arguments | expand |
On Thu, Mar 16, 2023 at 08:13:17AM +0100, Markus Armbruster wrote: > Signed-off-by: Markus Armbruster <armbru@redhat.com> Looks like 'previous commit' in the subject line actually means 4/14 (two commits ago); a victim of rebasing, I'm sure. Reviewed-by: Eric Blake <eblake@redhat.com>
Eric Blake <eblake@redhat.com> writes: > On Thu, Mar 16, 2023 at 08:13:17AM +0100, Markus Armbruster wrote: >> Signed-off-by: Markus Armbruster <armbru@redhat.com> > > Looks like 'previous commit' in the subject line actually means 4/14 > (two commits ago); a victim of rebasing, I'm sure. Hmm, actually both commits matter. The first hunk simplifies check_type_name() by contracting its two conditionals. It is enabled by the previous commit, which removed the code between the two conditionals. The second hunk simplifies check_type_name_or_array() the same way, but that one has had nothing in between since PATCH 04. I'll change the title to "after previous commits". > Reviewed-by: Eric Blake <eblake@redhat.com> Thanks!
diff --git a/scripts/qapi/expr.py b/scripts/qapi/expr.py index 5abeaa19dd..8a8de9e3aa 100644 --- a/scripts/qapi/expr.py +++ b/scripts/qapi/expr.py @@ -335,21 +335,13 @@ def normalize_members(members: object) -> None: def check_type_name(value: Optional[object], info: QAPISourceInfo, source: str) -> None: - if value is None: - return - - if isinstance(value, str): - return - - raise QAPISemError(info, "%s should be a type name" % source) + if value is not None and not isinstance(value, str): + raise QAPISemError(info, "%s should be a type name" % source) def check_type_name_or_array(value: Optional[object], info: QAPISourceInfo, source: str) -> None: - if value is None: - return - - if isinstance(value, str): + if value is None or isinstance(value, str): return if isinstance(value, list):
Signed-off-by: Markus Armbruster <armbru@redhat.com> --- scripts/qapi/expr.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)