[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] qapi: Fix code generation with Python 3.5
From: |
Alex Bennée |
Subject: |
Re: [PATCH] qapi: Fix code generation with Python 3.5 |
Date: |
Mon, 20 Jan 2020 10:52:44 +0000 |
User-agent: |
mu4e 1.3.6; emacs 28.0.50 |
Markus Armbruster <address@hidden> writes:
> 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 <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Tested-by: Alex Bennée <address@hidden>
Well that certainly clears up a bunch of red. Can we apply it directly
as a build fix?
> ---
> 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)
--
Alex Bennée
- Re: [PATCH] qapi: Fix code generation with Python 3.5, (continued)
Re: [PATCH] qapi: Fix code generation with Python 3.5, Thomas Huth, 2020/01/17
Re: [PATCH] qapi: Fix code generation with Python 3.5,
Alex Bennée <=
Re: [PATCH] qapi: Fix code generation with Python 3.5, Peter Maydell, 2020/01/20