qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: laurent.desnogues@gmail.com, mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH] qapi: Fix cgen() for Python older than 2.7
Date: Mon, 7 Sep 2015 20:55:20 -0600	[thread overview]
Message-ID: <55EE4E18.9030008@redhat.com> (raw)
In-Reply-To: <1441640755-23902-1-git-send-email-armbru@redhat.com>

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

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().
> 
> Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  scripts/qapi.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> 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 = code % kwds
>      if indent_level:
>          indent = genindent(indent_level)
> -        raw = re.subn("^.", indent + r'\g<0>', raw, 0, re.MULTILINE)
> +        # re.subn() lacks flags support before Python 2.7, use re.compile()
> +        raw = re.subn(re.compile("^.", re.MULTILINE),
> +                      indent + r'\g<0>', raw)
>          raw = raw[0]
>      return re.sub(re.escape(eatspace) + ' *', '', raw)
>  
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-09-08  2:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-07 15:45 [Qemu-devel] [PATCH] qapi: Fix cgen() for Python older than 2.7 Markus Armbruster
2015-09-08  2:55 ` Eric Blake [this message]
2015-09-08  5:17 ` Laurent Desnogues
2015-09-08  6:38 ` Markus Armbruster
2015-09-14 17:50   ` Peter Maydell
2015-09-08  8:20 ` Peter Maydell
2015-09-08  8:43   ` Markus Armbruster

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=55EE4E18.9030008@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=laurent.desnogues@gmail.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).