All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: "M.Kustova" <maxa@catit.be>
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] image-fuzzer: Trivial readability and formatting improvements
Date: Fri, 22 Aug 2014 11:13:02 +0100	[thread overview]
Message-ID: <20140822101302.GC11330@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <CALKf6DG=LX+T7-+_jWDc-yg-N1M9UtU4KE42aSc4y+RjWQ9-xA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1818 bytes --]

On Tue, Aug 19, 2014 at 01:50:27PM +0400, M.Kustova wrote:
> On Tue, Aug 19, 2014 at 1:38 PM, Stefan Hajnoczi <stefanha@redhat.com> 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.

I don't think that is necessary.  This is not a stable API that cannot
change.

Also, what exactly creates an API commitment here?  Hiding int_validator
doesn't hide anything.

Stefan

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2014-08-22 10:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 22:00 [Qemu-devel] [PATCH] image-fuzzer: Trivial readability and formatting improvements Maria Kustova
2014-08-19  9:38 ` Stefan Hajnoczi
2014-08-19  9:50   ` M.Kustova
2014-08-22 10:13     ` Stefan Hajnoczi [this message]
2014-08-19  9:44 ` Fam Zheng
2014-08-19  9:55   ` M.Kustova
2014-08-19 10:57     ` Markus Armbruster
2014-08-19 16:04       ` M.Kustova

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140822101302.GC11330@stefanha-thinkpad.redhat.com \
    --to=stefanha@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=maxa@catit.be \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.