[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/31] qapi: Use Python 2.6 "except E as ..." syntax
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 01/31] qapi: Use Python 2.6 "except E as ..." syntax |
Date: |
Tue, 9 Feb 2016 12:37:33 +0100 |
PEP 8 calls for it, because it's forward compatible with Python 3.
Supported since Python 2.6, which we require (commit fec2103).
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Acked-by: Stefan Hajnoczi <address@hidden>
Message-Id: <address@hidden>
---
scripts/qapi.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index 7dec611..645dcf1 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -167,7 +167,7 @@ class QAPISchemaParser(object):
continue
try:
fobj = open(incl_abs_fname, 'r')
- except IOError, e:
+ except IOError as e:
raise QAPIExprError(expr_info,
'%s: %s' % (e.strerror, include))
exprs_include = QAPISchemaParser(fobj, previously_included,
@@ -1189,7 +1189,7 @@ class QAPISchema(object):
self._predefining = False
self._def_exprs()
self.check()
- except (QAPISchemaError, QAPIExprError), err:
+ except (QAPISchemaError, QAPIExprError) as err:
print >>sys.stderr, err
exit(1)
@@ -1686,7 +1686,7 @@ def parse_command_line(extra_options="",
extra_long_options=[]):
"chp:o:" + extra_options,
["source", "header", "prefix=",
"output-dir="] + extra_long_options)
- except getopt.GetoptError, err:
+ except getopt.GetoptError as err:
print >>sys.stderr, "%s: %s" % (sys.argv[0], str(err))
sys.exit(1)
@@ -1740,7 +1740,7 @@ def open_output(output_dir, do_c, do_h, prefix, c_file,
h_file,
if output_dir:
try:
os.makedirs(output_dir)
- except os.error, e:
+ except os.error as e:
if e.errno != errno.EEXIST:
raise
--
2.4.3
- [Qemu-devel] [PULL 00/31] QAPI patches for 2016-02-09, Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 09/31] qapi: Drop dead parameter in gen_params(), Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 03/31] Revert "tracetool: use Python 2.4-compatible exception handling syntax", Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 02/31] scripts/qmp: Use Python 2.6 "except E as ..." syntax, Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 01/31] qapi: Use Python 2.6 "except E as ..." syntax,
Markus Armbruster <=
- [Qemu-devel] [PULL 07/31] qapi: Drop dead dealloc visitor variable, Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 05/31] qobject: Document more shortcomings in our number handling, Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 10/31] hmp: Drop pointless allocation during qapi visit, Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 20/31] qapi: Don't cast Enum* to int*, Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 26/31] qapi: Tighten qmp_input_end_list(), Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 30/31] qapi: Fix compilation failure on MIPS and SPARC, Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 28/31] qmp: Fix reference-counting of qnull on empty output visit, Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 29/31] qmp: Don't abuse stack to track qmp-output root, Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 08/31] qapi: Dealloc visitor does not need a type_size(), Markus Armbruster, 2016/02/09
- [Qemu-devel] [PULL 12/31] vl: Ensure qapi visitor properly ends struct visit, Markus Armbruster, 2016/02/09