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
diff --git a/Tools/scripts/checkappend.py b/Tools/scripts/checkappend.py
index a8714d9..2025ba9 100755
--- a/Tools/scripts/checkappend.py
+++ b/Tools/scripts/checkappend.py
@@ -50,7 +50,7 @@
global verbose
try:
opts, args = getopt.getopt(sys.argv[1:], "v")
- except getopt.error, msg:
+ except getopt.error as msg:
errprint(str(msg) + "\n\n" + __doc__)
return
for opt, optarg in opts:
@@ -77,7 +77,7 @@
try:
f = open(file)
- except IOError, msg:
+ except IOError as msg:
errprint("%r: I/O Error: %s" % (file, msg))
return
@@ -104,7 +104,7 @@
def run(self):
try:
tokenize.tokenize(self.file.readline, self.tokeneater)
- except tokenize.TokenError, msg:
+ except tokenize.TokenError as msg:
errprint("%r: Token Error: %s" % (self.fname, msg))
self.nerrors = self.nerrors + 1
return self.nerrors == 0