qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qapi: Fix cgen() for Python older than 2.7
@ 2015-09-07 15:45 Markus Armbruster
  2015-09-08  2:55 ` Eric Blake
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Markus Armbruster @ 2015-09-07 15:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent.desnogues, mdroth

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(-)

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)
 
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-09-14 17:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).