summaryrefslogtreecommitdiffstats
path: root/Lib/trace.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
committerGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
commitb940e113bf90ff71b0ef57414ea2beea9d2a4bc0 (patch)
tree0b9ea19eba1e665dac95126c3140ac2bc36326ad /Lib/trace.py
parent893523e80a2003d4a630aafb84ba016e0070cbbd (diff)
downloadcpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.zip
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.gz
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.bz2
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 c7ed0a5..ca44eae 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