[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/26] qapi: Make check_type()'s array case a bit more obvious
From: |
Markus Armbruster |
Subject: |
[PATCH v2 13/26] qapi: Make check_type()'s array case a bit more obvious |
Date: |
Fri, 27 Sep 2019 15:46:26 +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>
---
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
- [PATCH v2 00/26] qapi: Pay back some frontend technical debt, Markus Armbruster, 2019/09/27
- [PATCH v2 01/26] qapi: Tighten QAPISchemaFOO.check() assertions, Markus Armbruster, 2019/09/27
- [PATCH v2 03/26] qapi: New QAPISourceInfo, replacing dict, Markus Armbruster, 2019/09/27
- [PATCH v2 10/26] qapi: Use check_name_str() where it suffices, Markus Armbruster, 2019/09/27
- [PATCH v2 02/26] qapi: Rename .owner to .defined_in, Markus Armbruster, 2019/09/27
- [PATCH v2 22/26] qapi: Improve reporting of invalid 'if' further, Markus Armbruster, 2019/09/27
- [PATCH v2 25/26] qapi: Improve reporting of redefinition, Markus Armbruster, 2019/09/27
- [PATCH v2 13/26] qapi: Make check_type()'s array case a bit more obvious,
Markus Armbruster <=
- [PATCH v2 19/26] qapi: Improve reporting of invalid flags, Markus Armbruster, 2019/09/27
- [PATCH v2 07/26] qapi: Improve reporting of member name clashes, Markus Armbruster, 2019/09/27
- [PATCH v2 15/26] qapi: Inline check_name() into check_union(), Markus Armbruster, 2019/09/27
- [PATCH v2 11/26] qapi: Report invalid '*' prefix like any other invalid name, Markus Armbruster, 2019/09/27
- [PATCH v2 17/26] qapi: Move context-free checking to the proper place, Markus Armbruster, 2019/09/27
- [PATCH v2 09/26] qapi: Improve reporting of invalid name errors, Markus Armbruster, 2019/09/27
- [PATCH v2 12/26] qapi: Move check for reserved names out of add_name(), Markus Armbruster, 2019/09/27
- [PATCH v2 21/26] qapi: Avoid redundant definition references in error messages, Markus Armbruster, 2019/09/27
- [PATCH v2 04/26] qapi: Prefix frontend errors with an "in definition" line, Markus Armbruster, 2019/09/27