From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2jhb-00072q-PF for qemu-devel@nongnu.org; Fri, 26 Jul 2013 11:13:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2jhX-00056m-AP for qemu-devel@nongnu.org; Fri, 26 Jul 2013 11:13:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2jhX-00056Y-2X for qemu-devel@nongnu.org; Fri, 26 Jul 2013 11:13:03 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6QFD2CU004267 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 26 Jul 2013 11:13:02 -0400 Message-ID: <51F291FD.8080208@redhat.com> Date: Fri, 26 Jul 2013 09:13:01 -0600 From: Eric Blake MIME-Version: 1.0 References: <1374584606-5615-1-git-send-email-kwolf@redhat.com> <1374584606-5615-8-git-send-email-kwolf@redhat.com> <51F27C38.4020501@redhat.com> <20130726150146.GB18446@dhcp-200-207.str.redhat.com> In-Reply-To: <20130726150146.GB18446@dhcp-200-207.str.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="E8bkVnwiMc0o7blLnJon1lKEXt3A7Pr0I" Subject: Re: [Qemu-devel] [PATCH 07/18] qapi: Flat unions with arbitrary discriminator List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: armbru@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --E8bkVnwiMc0o7blLnJon1lKEXt3A7Pr0I Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/26/2013 09:01 AM, Kevin Wolf wrote: >>> if base: >>> struct =3D find_struct(base) >>> + if discriminator: >>> + del struct['data'][discriminator] >> >> I asked before, but didn't get an answer; my question may just show my= >> unfamiliarity with python. Is this modifying the original 'struct', >> such that other uses of the struct after this point will no longer >> contain the discriminator key? Or is it only modifying a copy of >> 'struct', with the original left intact? But based on the rest of you= r >> patch... >=20 > Sorry, this is in fact my own unfamiliarity with Python, combined with > failure to fix all cases when you pointed it out. The only reason I > didn't reply to that part of your review was that I thought it would be= > obvious when I send a fixed version. Well, except if I don't. Ah, so this is a case of the blind leading the blind... >=20 > I've changed this hunk now to match the other one: >=20 > @@ -184,8 +186,13 @@ struct %(name)s > ''') > =20 > if base: > - struct =3D find_struct(base) > - ret +=3D generate_struct_fields(struct['data']) > + base_fields =3D find_struct(base)['data'] > + if discriminator: > + base_fields =3D base_fields.copy() > + del base_fields[discriminator] > + ret +=3D generate_struct_fields(base_fields) > + else: > + assert not discriminator Yes, that makes more sense. >> I think my findings are easy fixes; so I'm okay if you fix them and th= en >> add: >> >> Reviewed-by: Eric Blake Which means this is indeed a valid review. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --E8bkVnwiMc0o7blLnJon1lKEXt3A7Pr0I Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR8pH9AAoJEKeha0olJ0NqkzMH/2KLI9e3WcslzUgtTkcvShfN akWT05r3t3TjC8y2LgCIj3pQmW1fMiiLASpaSYGCC64vUtGNBUHZcyQhVetwdX7Y rKDKHctKounBe2GqCqFULO1REDWNnRijI0nJJ1wdtACxvKIj4fzt8VHEpRCOR9+Q KcLGS1XsCD7KkKeD4Gu4eevYL6/DjAwda8Qa+x/uTUaagkYv2ti+VJS4U731Hp2V FZjgsBZp29Qp8Ox65ktGxkIz+ZgFK+nifR7IRZanPvyeUDcpXKjKX0mgb4GH1xkw RC1HyS4PjOVfRZXAUjeUNFEqX6eBnS3YXL1DTbc45hxSyQVGDAZZvglOpw/YrJs= =EQjH -----END PGP SIGNATURE----- --E8bkVnwiMc0o7blLnJon1lKEXt3A7Pr0I--