Commit 88112488 authored by Markus Armbruster's avatar Markus Armbruster
Browse files

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: default avatarMarkus Armbruster <armbru@redhat.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-14-armbru@redhat.com>
parent 67fa64ce
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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):