summary refs log tree commit diff stats
path: root/scripts/qapi.py
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-08-31 17:28:52 +0200
committerMarkus Armbruster <armbru@redhat.com>2015-09-04 15:47:16 +0200
commitc6b71e5ae73802057d700e2419b80aef1651f213 (patch)
treee4d4d8726fe026754e3d731edada45c2f8013145 /scripts/qapi.py
parent10689e36eb99e99751497ac8cef2a946e9a3a850 (diff)
downloadfocaccia-qemu-c6b71e5ae73802057d700e2419b80aef1651f213.tar.gz
focaccia-qemu-c6b71e5ae73802057d700e2419b80aef1651f213.zip
qapi: Fix errors for non-string, non-dictionary members
Fixes the errors demonstrated by the previous commit.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts/qapi.py')
-rw-r--r--scripts/qapi.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 197db77a9f..36560590ba 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -462,13 +462,15 @@ 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)