From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZ94G-0004Vq-Qc for qemu-devel@nongnu.org; Mon, 07 Sep 2015 22:55:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZ94B-0005pf-Or for qemu-devel@nongnu.org; Mon, 07 Sep 2015 22:55:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZ94B-0005nX-4T for qemu-devel@nongnu.org; Mon, 07 Sep 2015 22:55:27 -0400 References: <1441640755-23902-1-git-send-email-armbru@redhat.com> From: Eric Blake Message-ID: <55EE4E18.9030008@redhat.com> Date: Mon, 7 Sep 2015 20:55:20 -0600 MIME-Version: 1.0 In-Reply-To: <1441640755-23902-1-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a5TsamolqT6jIIO8MMiwJdmBxpEL0vXLL" Subject: Re: [Qemu-devel] [PATCH] qapi: Fix cgen() for Python older than 2.7 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: laurent.desnogues@gmail.com, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --a5TsamolqT6jIIO8MMiwJdmBxpEL0vXLL Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/07/2015 09:45 AM, Markus Armbruster wrote: > A feature new in Python 2.7 crept into commit 77e703b: re.subn()'s > fifth argument. Avoid that, use re.compile(). >=20 > Reported-by: Laurent Desnogues > Signed-off-by: Markus Armbruster > --- > scripts/qapi.py | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Reviewed-by: Eric Blake >=20 > diff --git a/scripts/qapi.py b/scripts/qapi.py > index 817d824..88fa073 100644 > --- a/scripts/qapi.py > +++ b/scripts/qapi.py > @@ -944,7 +944,9 @@ def cgen(code, **kwds): > raw =3D code % kwds > if indent_level: > indent =3D genindent(indent_level) > - raw =3D re.subn("^.", indent + r'\g<0>', raw, 0, re.MULTILINE)= > + # re.subn() lacks flags support before Python 2.7, use re.comp= ile() > + raw =3D re.subn(re.compile("^.", re.MULTILINE), > + indent + r'\g<0>', raw) > raw =3D raw[0] > return re.sub(re.escape(eatspace) + ' *', '', raw) > =20 >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --a5TsamolqT6jIIO8MMiwJdmBxpEL0vXLL 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/ iQEcBAEBCAAGBQJV7k4cAAoJEKeha0olJ0NqNHAIAKeVZOxxQcWnDmDfURxjArBz GJmzvgK6M7LUXe3ppji8mrhqSDaPWTgTwMxuDgbsz0Y58kQSUHXTKMMee4r6jkrC L06uXpRX30ZPJsyBjh0sNxLBp0eGnP1rANMZ1Vp3b8h3kKXvwrpMfid2wFvwqBv7 GTmgMpM+C6YQkOXy2pEv/17t4eNr6bdc0PG50AHavZYulsH5XLn5avYdllrlodJm 91DqwW8MNGDlAqwrx0OrA1y208Zeb4m89UuLN4OLxOC7m7bn5SucQyxde0+bFTY6 pKLV8KTZmiDMCBaJLPY3MNuG8P1/o2ZE8l+Bma78NwQEukeQ7m3XqmuWmhnCl64= =Cjvn -----END PGP SIGNATURE----- --a5TsamolqT6jIIO8MMiwJdmBxpEL0vXLL--