Skip to contentSkip to conversation

scripts/qapi.py: Avoid syntax not supported by Python 2.4

PATCH Applied Peter Maydell 2 participants 2 messages Aug 20, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/qapi.py: Avoid syntax not supported by Python 2.4

The Python "except Foo as x" syntax was only introduced in Python 2.6, but we aim to support Python 2.4 and later. Use the old-style "except Foo, x" syntax instead, thus fixing configure/compile on systems with older Python.

---
I don't have an old python to test this on, but it works OK with 2.7 and Erik said he'd tested the equivalent change done by hand.

 scripts/qapi.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qapi.py +1 -1
index 0ebea94..1069310 100644
@@ -161,7 +161,7 @@ class QAPISchema:
 def parse_schema(fp):
     try:
         schema = QAPISchema(fp)
-    except QAPISchemaError as e:
+    except QAPISchemaError, e:
         print >>sys.stderr, e
         exit(1)
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 6 lines · On Tue, 20 Aug 2013 15:50:15 +0100 Peter Maydell <[email protected]>…

The Python "except Foo as x" syntax was only introduced in Python 2.6, but we aim to support Python 2.4 and later. Use the old-style "except Foo, x" syntax instead, thus fixing configure/compile on systems with older Python.

Applied to the qmp branch, thanks.

Quoted 21 lines

---
I don't have an old python to test this on, but it works OK with 2.7 and Erik said he'd tested the equivalent change done by hand.

 scripts/qapi.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qapi.py +1 -1
index 0ebea94..1069310 100644
@@ -161,7 +161,7 @@ class QAPISchema:
 def parse_schema(fp):
     try:
         schema = QAPISchema(fp)
-    except QAPISchemaError as e:
+    except QAPISchemaError, e:
         print >>sys.stderr, e
         exit(1)