qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] image-fuzzer: Trivial readability and formattin


From: M.Kustova
Subject: Re: [Qemu-devel] [PATCH] image-fuzzer: Trivial readability and formatting improvements
Date: Tue, 19 Aug 2014 13:50:27 +0400

On Tue, Aug 19, 2014 at 1:38 PM, Stefan Hajnoczi <address@hidden> wrote:
> On Tue, Aug 19, 2014 at 02:00:24AM +0400, Maria Kustova wrote:
>> diff --git a/tests/image-fuzzer/qcow2/fuzz.py 
>> b/tests/image-fuzzer/qcow2/fuzz.py
>> index 6e272c6..c652dc9 100644
>> --- a/tests/image-fuzzer/qcow2/fuzz.py
>> +++ b/tests/image-fuzzer/qcow2/fuzz.py
>> @@ -123,7 +123,7 @@ def string_validator(current, strings):
>>      return validator(current, random.choice, strings)
>>
>>
>> -def selector(current, constraints, validate=int_validator):
>> +def selector(current, constraints, validate=None):
>>      """Select one value from all defined by constraints.
>>
>>      Each constraint produces one random value satisfying to it. The function
>> @@ -131,6 +131,9 @@ def selector(current, constraints, 
>> validate=int_validator):
>>      constraints overlaps).
>>      """
>>
>> +    if validate is None:
>> +        validate = int_validator
>> +
>>      def iter_validate(c):
>>          """Apply validate() only to constraints represented as lists.
>>
>
> I don't understand the benefit of this change.  The default initializer
> syntax did what was intended, now it has been made more complicated with
> a None value that gets converted to int_validator later.

It's a convention rule that allows keep the function signature
unchanged in case of modified function internals.
In other words, wrapper functions should not change in response of the
internal function change.

Maria.



reply via email to

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