summaryrefslogtreecommitdiff
path: root/Lib/trace.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-10 16:19:56 +0000
committerGuido van Rossum <guido@python.org>2007-01-10 16:19:56 +0000
commitf16bc2a26e204536d477cddceaeeb5d6d9657c9e (patch)
treed08fadf5b04b876fa35cfd64d34764cc3e4241a7 /Lib/trace.py
parent6f516b70819184e9cf97cf4c6bbc8abfdea7133f (diff)
downloadcpython-f16bc2a26e204536d477cddceaeeb5d6d9657c9e.tar.gz
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
Diffstat (limited to 'Lib/trace.py')
-rw-r--r--Lib/trace.py12
1 files changed, 6 insertions, 6 deletions
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