qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 21/28] qapi: Require valid names


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v5 21/28] qapi: Require valid names
Date: Fri, 27 Mar 2015 14:17:23 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 03/27/2015 11:14 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
> 
>> Previous commits demonstrated that the generator overlooked various
>> bad naming situations:
>> - types, commands, and events need a valid name
>> - union and alternate branches cannot be marked optional
>>
>> The set of valid names includes [a-zA-Z0-9._-] (where '.' is
>> useful only in downstream extensions).
>>

>>
>> +valid_characters = set(string.ascii_letters + string.digits + '.' + '-' + 
>> '_')
>> +def check_name(expr_info, source, name, allow_optional = False):
>> +    membername = name
>> +
>> +    if not isinstance(name, str):
>> +        raise QAPIExprError(expr_info,
>> +                            "%s requires a string name" % source)
>> +    if name == '**':
>> +        return
> 
> I'm afraid this conditional is superfluous or wrong.  Our schemata don't
> trigger it.

Hmm, you're right.  Given a 'name':'type' pair in a dictionary,
check_name is used on the 'name' portion; but we only use 'name':'**'
(and NOT '**':'type') in the schemata.  I'll drop it in the respin.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]