]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
qapi: ensure stable sort ordering when checking QAPI entities
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 16 Jan 2018 13:42:10 +0000 (13:42 +0000)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 21 Jun 2018 01:45:07 +0000 (20:45 -0500)
Some early python 3.x versions will have different default
ordering when calling the 'values()' method on a dict, compared
to python 2.x and later 3.x versions. Explicitly sort the items
to get a stable ordering.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-8-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit f7a5376d4b667cf6c83c1d640e32d22456d7b5ee)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
scripts/qapi.py

index 62dc52ed6e019b6ba62b0464a37ca6fdbb70f67b..99a4cbd556936055d4ef5f6287430279d492db50 100644 (file)
@@ -1679,7 +1679,7 @@ class QAPISchema(object):
                 assert False
 
     def check(self):
-        for ent in self._entity_dict.values():
+        for (name, ent) in sorted(self._entity_dict.items()):
             ent.check(self)
 
     def visit(self, visitor):