Received: from eggs.gnu.org ([2001:4830:134:3::10]:46617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKlqK-0004GU-UC for qemu-devel@nongnu.org; Fri, 22 Aug 2014 06:13:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKlqF-0007Dp-EQ for qemu-devel@nongnu.org; Fri, 22 Aug 2014 06:13:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKlqF-0007Dk-5i for qemu-devel@nongnu.org; Fri, 22 Aug 2014 06:13:07 -0400 Date: Fri, 22 Aug 2014 11:13:02 +0100 From: Stefan Hajnoczi Message-ID: <20140822101302.GC11330@stefanha-thinkpad.redhat.com> References: <1408399224-9834-1-git-send-email-maria.k@catit.be> <20140819093854.GB25538@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="69pVuxX8awAiJ7fD" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] image-fuzzer: Trivial readability and formatting improvements List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "M.Kustova" Cc: Kevin Wolf , Fam Zheng , qemu-devel@nongnu.org --69pVuxX8awAiJ7fD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 19, 2014 at 01:50:27PM +0400, M.Kustova wrote: > On Tue, Aug 19, 2014 at 1:38 PM, Stefan Hajnoczi wr= ote: > > 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/qco= w2/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=3Dint_validator): > >> +def selector(current, constraints, validate=3DNone): > >> """Select one value from all defined by constraints. > >> > >> Each constraint produces one random value satisfying to it. The f= unction > >> @@ -131,6 +131,9 @@ def selector(current, constraints, validate=3Dint_= validator): > >> constraints overlaps). > >> """ > >> > >> + if validate is None: > >> + validate =3D 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. >=20 > 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 --69pVuxX8awAiJ7fD Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJT9xeuAAoJEJykq7OBq3PIgmwH/2NBJDm215CxSP3erXzaVynx p61JbJbTRhjJS6m5Tx3IRTu8blGg+Tp3aDh0lmue9T1M2RjcqDpoQxRHDqm/sGSh jZF34xKmjJA6o3R7GjA7q1q4CiSZc8Lucr/FTAPa0IERMH+3rf768ppJKUSg1BTQ RS3yfQY2fZJBTbnnbENlX/6Fb0t5vuOxdnVjYQje1gw9FXKBXqIiqwLwLNow+IYf hzDUL2kCqHR6M0Cy/qzSFLbtMF/tzlqvxsy70YHASwFetb3a9k+ryh0QkF6gnbvG QllrnShj2UiSlSO+wxbLKfUkuxhYgX5CybUR0HZ8Czam9c91H/BZDuh//1mhRMA= =X6Hw -----END PGP SIGNATURE----- --69pVuxX8awAiJ7fD--