diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-12-18 08:52:41 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-02-08 17:29:54 +0100 |
commit | 291928a80f39670929fcce222acd5e21d1434692 (patch) | |
tree | 34de414694c8b9aaa6a58cb4a4b332e668f0dd6b | |
parent | e4a096b1cd4350eeca5dcdc391ab333d2083d7fd (diff) |
qapi: Use Python 2.6 "except E as ..." syntax
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 <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <1450425164-24969-2-git-send-email-armbru@redhat.com>
-rw-r--r-- | scripts/qapi.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/qapi.py b/scripts/qapi.py index 7dec611d09..645dcf1427 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 |