qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qapi: Fix code generation with Python 3.5
@ 2020-01-16 20:25 Markus Armbruster
  2020-01-16 21:17 ` John Snow
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Markus Armbruster @ 2020-01-16 20:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth, mdroth

Recent commit 3e7fb5811b "qapi: Fix code generation for empty modules"
modules" switched QAPISchema.visit() from

    for entity in self._entity_list:

effectively to

    for mod in self._module_dict.values():
        for entity in mod._entity_list:

Visits in the same order as long as .values() is in insertion order.
That's the case only for Python 3.6 and later.  Before, it's in some
arbitrary order, which results in broken generated code.

Fix by making self._module_dict an OrderedDict rather than a dict.

Fixes: 3e7fb5811baab213dcc7149c3aa69442d683c26c
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 scripts/qapi/schema.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py
index 0bfc5256fb..5100110fa2 100644
--- a/scripts/qapi/schema.py
+++ b/scripts/qapi/schema.py
@@ -795,7 +795,7 @@ class QAPISchema(object):
         self.docs = parser.docs
         self._entity_list = []
         self._entity_dict = {}
-        self._module_dict = {}
+        self._module_dict = OrderedDict()
         self._schema_dir = os.path.dirname(fname)
         self._make_module(None) # built-ins
         self._make_module(fname)
-- 
2.21.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-02-07 21:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16 20:25 [PATCH] qapi: Fix code generation with Python 3.5 Markus Armbruster
2020-01-16 21:17 ` John Snow
2020-01-17  7:07   ` Markus Armbruster
2020-01-17 19:41     ` John Snow
2020-01-18  6:54       ` Markus Armbruster
2020-02-07 21:54         ` Eduardo Habkost
2020-01-18  8:29       ` Philippe Mathieu-Daudé
2020-01-20  5:46         ` [Qemu-devel] Xenial in Travis (was: qapi: Fix code generation with Python 3.5) Thomas Huth
2020-01-17  9:34 ` [PATCH] qapi: Fix code generation with Python 3.5 Thomas Huth
2020-01-17 10:49   ` Markus Armbruster
2020-01-18  8:33     ` Philippe Mathieu-Daudé
2020-01-19 11:23       ` Philippe Mathieu-Daudé
2020-01-20 10:52 ` Alex Bennée
2020-01-20 12:53 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).