From: Markus Armbruster Date: Fri, 27 Sep 2019 13:46:26 +0000 (+0200) Subject: qapi: Make check_type()'s array case a bit more obvious X-Git-Tag: v4.2.0-rc0~74^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=88112488cf228df8b7588c8aa38e16ecd0dff48e;p=thirdparty%2Fqemu.git qapi: Make check_type()'s array case a bit more obvious check_type() checks the array's contents, then peels off the array and falls through to the "not array" code without resetting allow_array and allow_dict to False. Works because the peeled value is a string, and allow_array and allow_dict aren't used then. Tidy up anyway: recurse instead, defaulting allow_array and allow_dict to False. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <20190927134639.4284-14-armbru@redhat.com> --- diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 111a4bbe559..870d8b0ecbe 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -795,7 +795,8 @@ def check_type(value, info, source, raise QAPISemError(info, "%s: array type must contain single type name" % source) - value = value[0] + check_type(value[0], info, source, allow_metas=allow_metas) + return # Check if type name for value is okay if isinstance(value, str):