From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi0zT-0006Mj-Ee for qemu-devel@nongnu.org; Fri, 02 Oct 2015 10:07:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zi0zN-0002kc-Gq for qemu-devel@nongnu.org; Fri, 02 Oct 2015 10:07:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34762) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi0zN-0002kV-9A for qemu-devel@nongnu.org; Fri, 02 Oct 2015 10:07:09 -0400 References: <1443760312-656-1-git-send-email-eblake@redhat.com> <1443760312-656-6-git-send-email-eblake@redhat.com> <87eghdfy5m.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <560E8F86.7060305@redhat.com> Date: Fri, 2 Oct 2015 08:07:02 -0600 MIME-Version: 1.0 In-Reply-To: <87eghdfy5m.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ETFNqFlnK9VEOtS7CpDbxJ1XfIxOQCptQ" Subject: Re: [Qemu-devel] [PATCH v6 05/12] qapi: Track location that created an implicit type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: marcandre.lureau@redhat.com, qemu-devel@nongnu.org, ehabkost@redhat.com, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ETFNqFlnK9VEOtS7CpDbxJ1XfIxOQCptQ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/02/2015 02:54 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> A future patch will enable deferred error detection in the >> various QAPISchema*.check() methods (rather than the current >> ad hoc parse checks). >=20 > What's "deferred" about them? With ad hoc parse checks, we validate the .json before calling QAPISchemaEntity constructors. With QAPISchemaEntity.check(), the constructor is called on various strings, but the strings may not resolve; we don't know about the problem until check() is called. >=20 > Perhaps simply: A future patch will move error checking into the variou= s > QAPISchema*.check() methods. >=20 >> But that means the user can request >> a QAPI entity that will only fail validation after it has >> been initialized. >=20 > I'm not sure I get this sentence. Trying to point out that while pre-patch, the check() method was only run on well-formed entities, now post-patch it can raise errors that we chose not to detect prior to __init__ time. >> RFC: I used a class-level static flag to track whether we expected >> 'info is None' when creating a QAPISchemaEntity. This is gross, >> because the flag will only be set on the first QAPISchema() instance >> (it works because none of our client scripts ever instantiate more >> than one schema). But the only other thing I could think of would >> be passing the QAPISchema instance into the constructor for each >> QAPISchemaEntity, which is a lot of churn. Any better ideas on how >> best to do the assertion, or should I just drop it? >> >> Signed-off-by: Eric Blake >=20 > I'd check in QAPISchema._def_entity(). Ah, instead of an assert in QAPISchemaEntity.__init__() (which requires a leaky abstraction), instead write the assert into QAPISchema (so the flag can now be instance-local). Makes sense; I'll play with the idea. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --ETFNqFlnK9VEOtS7CpDbxJ1XfIxOQCptQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWDo+GAAoJEKeha0olJ0Nqj0EIAJSvGPrOQllHNe/d+0WpCfTv Cfq0UAw7F5AKAYDU8hW9D5uno1KyP4wKVkBdcmqB1ggqHWzs4TqGQNbH9tUgmqV2 X1rtQZ2kFfmpJka4MP47HnMK4gLakz2pY659px48FsFJYTzYqnTgvKZcm0PIb7r1 vvDdrfPKpYJ9bX7A5jBLMjoWerPhGF8XPjlLAdRd+tTTXjhoShp/jrl3ldwpVDN4 kJy+ESlmZSNODVU3ZbFSaQZubTsKSQdam92bYdaczB918ZDz61ADdqWIrACLn7kW E2Dgq9TUrDrtKANgeQ29+PMlt0MltKV8RJinHtOE53a5bSTUIc+lHGJKJslCytk= =Au2o -----END PGP SIGNATURE----- --ETFNqFlnK9VEOtS7CpDbxJ1XfIxOQCptQ--