[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 13/25] qapi: Make check_type()'s array case a bit more obviou
From: |
Eric Blake |
Subject: |
Re: [PATCH 13/25] qapi: Make check_type()'s array case a bit more obvious |
Date: |
Tue, 24 Sep 2019 10:57:25 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 9/24/19 8:28 AM, Markus Armbruster wrote:
> 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>
> ---
> scripts/qapi/common.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Eric Blake <address@hidden>
>
> diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
> index 5e708c3b45..07cf72e72c 100644
> --- a/scripts/qapi/common.py
> +++ b/scripts/qapi/common.py
> @@ -794,7 +794,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):
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [PATCH 17/25] qapi: Move context-free checking to the proper place, (continued)
- [PATCH 11/25] qapi: Report invalid '*' prefix like any other invalid name, Markus Armbruster, 2019/09/24
- [PATCH 24/25] qapi: Improve reporting of redefinition, Markus Armbruster, 2019/09/24
- [PATCH 15/25] qapi: Inline check_name() into check_union(), Markus Armbruster, 2019/09/24
- [PATCH 07/25] qapi: Improve reporting of member name clashes, Markus Armbruster, 2019/09/24
- [PATCH 13/25] qapi: Make check_type()'s array case a bit more obvious, Markus Armbruster, 2019/09/24
- Re: [PATCH 13/25] qapi: Make check_type()'s array case a bit more obvious,
Eric Blake <=
- [PATCH 18/25] qapi: Improve reporting of invalid 'if' errors, Markus Armbruster, 2019/09/24
- [PATCH 12/25] qapi: Move check for reserved names out of add_name(), Markus Armbruster, 2019/09/24
- [PATCH 22/25] qapi: Eliminate check_keys(), rename check_known_keys(), Markus Armbruster, 2019/09/24
- [PATCH 19/25] qapi: Improve reporting of invalid flags, Markus Armbruster, 2019/09/24