From f16bc2a26e204536d477cddceaeeb5d6d9657c9e Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 10 Jan 2007 16:19:56 +0000 Subject: SF patch 1631942 by Collin Winter: (a) "except E, V" -> "except E as V" (b) V is now limited to a simple name (local variable) (c) V is now deleted at the end of the except block --- Lib/trace.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Lib/trace.py') diff --git a/Lib/trace.py b/Lib/trace.py index c7ed0a58a7..ca44eae927 100644 --- a/Lib/trace.py +++ b/Lib/trace.py @@ -220,7 +220,7 @@ class CoverageResults: counts, calledfuncs, callers = \ pickle.load(open(self.infile, 'rb')) self.update(self.__class__(counts, calledfuncs, callers)) - except (IOError, EOFError, ValueError), err: + except (IOError, EOFError, ValueError) as err: print >> sys.stderr, ("Skipping counts file %r: %s" % (self.infile, err)) @@ -328,7 +328,7 @@ class CoverageResults: try: pickle.dump((self.counts, self.calledfuncs, self.callers), open(self.outfile, 'wb'), 1) - except IOError, err: + except IOError as err: print >> sys.stderr, "Can't save counts files because %s" % err def write_results_file(self, path, lines, lnotab, lines_hit): @@ -336,7 +336,7 @@ class CoverageResults: try: outfile = open(path, "w") - except IOError, err: + except IOError as err: print >> sys.stderr, ("trace: Could not open %r for writing: %s" "- skipping" % (path, err)) return 0, 0 @@ -422,7 +422,7 @@ def find_executable_linenos(filename): """Return dict where keys are line numbers in the line number table.""" try: prog = open(filename, "rU").read() - except IOError, err: + except IOError as err: print >> sys.stderr, ("Not printing coverage data for %r: %s" % (filename, err)) return {} @@ -658,7 +658,7 @@ def main(argv=None): "coverdir=", "listfuncs", "trackcalls"]) - except getopt.error, msg: + except getopt.error as msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0]) @@ -778,7 +778,7 @@ def main(argv=None): outfile=counts_file) try: t.run('execfile(%r)' % (progname,)) - except IOError, err: + except IOError as err: _err_exit("Cannot run file %r because: %s" % (sys.argv[0], err)) except SystemExit: pass -- cgit v1.2.1