]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
qapi/introspect.py: Unify return type of _make_tree()
authorJohn Snow <jsnow@redhat.com>
Tue, 16 Feb 2021 02:17:56 +0000 (21:17 -0500)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 18 Feb 2021 18:37:41 +0000 (19:37 +0100)
Returning two different types conditionally can be complicated to
type. Return one type for consistency.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210216021809.134886-7-jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
scripts/qapi/introspect.py

index a111cec7258d8d1dc3887bb0f3053492bacbbc5a..7cce0de97552089453a1472c882877da7a80411e 100644 (file)
@@ -29,9 +29,7 @@ def _make_tree(obj, ifcond, extra=None):
         extra = {}
     if ifcond:
         extra['if'] = ifcond
-    if extra:
-        return (obj, extra)
-    return obj
+    return (obj, extra)
 
 
 def _tree_to_qlit(obj, level=0, dict_value=False):