[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/27] qapi: Make check_type()'s array case a bit more obvious
From: |
Markus Armbruster |
Subject: |
[PULL 14/27] qapi: Make check_type()'s array case a bit more obvious |
Date: |
Sat, 28 Sep 2019 20:39:21 +0200 |
check_type() checks the array's contents, then peels off the array and
falls through to the "not array" code without resetting allow_array
and allow_dict to False. Works because the peeled value is a string,
and allow_array and allow_dict aren't used then. Tidy up anyway:
recurse instead, defaulting allow_array and allow_dict to False.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
---
scripts/qapi/common.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
index 111a4bbe55..870d8b0ecb 100644
--- a/scripts/qapi/common.py
+++ b/scripts/qapi/common.py
@@ -795,7 +795,8 @@ def check_type(value, info, source,
raise QAPISemError(info,
"%s: array type must contain single type name" %
source)
- value = value[0]
+ check_type(value[0], info, source, allow_metas=allow_metas)
+ return
# Check if type name for value is okay
if isinstance(value, str):
--
2.21.0
- [PULL 00/27] QAPI patches for 2019-09-28, Markus Armbruster, 2019/09/28
- [PULL 01/27] qmp-dispatch: Use CommandNotFound error for disabled commands, Markus Armbruster, 2019/09/28
- [PULL 02/27] qapi: Tighten QAPISchemaFOO.check() assertions, Markus Armbruster, 2019/09/28
- [PULL 14/27] qapi: Make check_type()'s array case a bit more obvious,
Markus Armbruster <=
- [PULL 11/27] qapi: Use check_name_str() where it suffices, Markus Armbruster, 2019/09/28
- [PULL 13/27] qapi: Move check for reserved names out of add_name(), Markus Armbruster, 2019/09/28
- [PULL 10/27] qapi: Improve reporting of invalid name errors, Markus Armbruster, 2019/09/28
- [PULL 27/27] qapi: Improve source file read error handling, Markus Armbruster, 2019/09/28
- [PULL 19/27] qapi: Improve reporting of invalid 'if' errors, Markus Armbruster, 2019/09/28
- [PULL 20/27] qapi: Improve reporting of invalid flags, Markus Armbruster, 2019/09/28
- [PULL 18/27] qapi: Move context-free checking to the proper place, Markus Armbruster, 2019/09/28
- [PULL 24/27] qapi: Eliminate check_keys(), rename check_known_keys(), Markus Armbruster, 2019/09/28
- [PULL 21/27] qapi: Improve reporting of missing / unknown definition keys, Markus Armbruster, 2019/09/28
- [PULL 23/27] qapi: Improve reporting of invalid 'if' further, Markus Armbruster, 2019/09/28