From 630b56b4a2483ecc9c7a2429a887e3d52e517991 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 19 Feb 2018 16:30:47 -0500 Subject: [PATCH] qapi: Fix errors for non-string, non-dictionary members Backports commit c6b71e5ae73802057d700e2419b80aef1651f213 from qemu --- qemu/scripts/qapi.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/qemu/scripts/qapi.py b/qemu/scripts/qapi.py index 7a4a28f0..d4475949 100644 --- a/qemu/scripts/qapi.py +++ b/qemu/scripts/qapi.py @@ -462,13 +462,14 @@ def check_type(expr_info, source, value, allow_array = False, % (source, all_names[value], orig_value)) return - # value is a dictionary, check that each member is okay - if not isinstance(value, OrderedDict): - raise QAPIExprError(expr_info, - "%s should be a dictionary" % source) if not allow_dict: raise QAPIExprError(expr_info, "%s should be a type name" % source) + if not isinstance(value, OrderedDict): + raise QAPIExprError(expr_info, + "%s should be a dictionary or type name" % source) + + # value is a dictionary, check that each member is okay for (key, arg) in value.items(): check_name(expr_info, "Member of %s" % source, key, allow_optional=allow_optional)