]> Git Repo - qemu.git/commitdiff
qapi/common.py: Remove python compatibility workaround
authorJohn Snow <[email protected]>
Fri, 9 Oct 2020 16:15:32 +0000 (12:15 -0400)
committerMarkus Armbruster <[email protected]>
Sat, 10 Oct 2020 09:37:47 +0000 (11:37 +0200)
Signed-off-by: John Snow <[email protected]>
Reviewed-by: Eduardo Habkost <[email protected]>
Reviewed-by: Cleber Rosa <[email protected]>
Message-Id: <20201009161558[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Markus Armbruster <[email protected]>
scripts/qapi/common.py

index ba35abea478e1647da077a2699bbf7455cead2f9..cee63eb95c717c39e2e9350a9eb2ba125caf38ea 100644 (file)
@@ -119,10 +119,7 @@ def cgen(code, **kwds):
     raw = code % kwds
     if indent_level:
         indent = genindent(indent_level)
-        # re.subn() lacks flags support before Python 2.7, use re.compile()
-        raw = re.subn(re.compile(r'^(?!(#|$))', re.MULTILINE),
-                      indent, raw)
-        raw = raw[0]
+        raw = re.sub(r'^(?!(#|$))', indent, raw, flags=re.MULTILINE)
     return re.sub(re.escape(eatspace) + r' *', '', raw)
 
 
This page took 0.027613 seconds and 4 git commands to generate.