On 9/14/19 10:35 AM, Markus Armbruster wrote:
> check_keys() parameter expr_elem expects a dictionary with keys 'expr'
> and 'info'.  Passing the two values separately is simpler, so do that.
> 
> Signed-off-by: Markus Armbruster <arm...@redhat.com>
> ---
>  scripts/qapi/common.py | 19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)


> -def check_keys(expr_elem, meta, required, optional=[]):
> -    expr = expr_elem['expr']
> -    info = expr_elem['info']
> +def check_keys(expr, info, meta, required, optional=[]):
>      name = expr[meta]
>      if not isinstance(name, str):
>          raise QAPISemError(info, "'%s' key must have a string value" % meta)
> @@ -1100,40 +1098,39 @@ def check_exprs(exprs):
>  
>          if 'enum' in expr:
>              meta = 'enum'
> -            check_keys(expr_elem, 'enum', ['data'], ['if', 'prefix'])
> +            check_keys(expr, info, 'enum', ['data'], ['if', 'prefix'])

Works since the caller already separated out the two values in question.

Reviewed-by: Eric Blake <ebl...@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to