Skip to contentSkip to conversation

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

PATCH In review Luiz Capitulino 2 participants 2 messages May 20, 2014 – May 21, 2014

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.

---
 scripts/qapi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qapi.py +1 -1
index 0265b40..86e9608 100644
@@ -116,7 +116,7 @@ class QAPISchema:
                     continue
                 try:
                     fobj = open(include_path, 'r')
-                except IOError as e:
+                except IOError, e:
                     raise QAPIExprError(expr_info,
                                         '%s: %s' % (e.strerror, include))
                 exprs_include = QAPISchema(fobj, include, self.include_hist,
Signature · 1 line
1.9.0
Tested-by on v1 1/1
#1 lore raw

Am 20.05.2014 20:29, schrieb Luiz Capitulino:

Quoted 16 lines

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.

---
 scripts/qapi.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qapi.py +0 -0
index 0265b40..86e9608 100644

scripts/qapi.py class QAPISchema: · line 122

Quoted 8 lines
scripts/qapi.py +1 -1
@@ -116,7 +116,7 @@ class QAPISchema:
                     continue
                 try:
                     fobj = open(include_path, 'r')
-                except IOError as e:
+                except IOError, e:
                     raise QAPIExprError(expr_info,
                                         '%s: %s' % (e.strerror, include))
                 exprs_include = QAPISchema(fobj, include, self.include_hist,

I have the same change applied locally, so

Thanks,
Andreas