From: Markus Armbruster Date: Thu, 16 Mar 2023 07:13:17 +0000 (+0100) Subject: qapi: Simplify code a bit after previous commits X-Git-Tag: qemu-xen-4.20.0~784^2~11 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7c4075190da24a01d9c02f5f59cf0651611bd40f;p=qemu-xen.git qapi: Simplify code a bit after previous commits Signed-off-by: Markus Armbruster Message-Id: <20230316071325.492471-7-armbru@redhat.com> Reviewed-by: Eric Blake [Commit message corrected] --- 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):