mirror of
https://github.com/python/cpython.git
synced 2025-08-29 13:15:11 +00:00
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
This commit is contained in:
parent
893523e80a
commit
b940e113bf
295 changed files with 817 additions and 743 deletions
|
@ -43,7 +43,7 @@ def sum(*files):
|
|||
def printsum(filename, out=sys.stdout):
|
||||
try:
|
||||
fp = open(filename, rmode)
|
||||
except IOError, msg:
|
||||
except IOError as msg:
|
||||
sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg))
|
||||
return 1
|
||||
if fnfilter:
|
||||
|
@ -60,7 +60,7 @@ def printsumfp(fp, filename, out=sys.stdout):
|
|||
if not data:
|
||||
break
|
||||
m.update(data)
|
||||
except IOError, msg:
|
||||
except IOError as msg:
|
||||
sys.stderr.write('%s: I/O error: %s\n' % (filename, msg))
|
||||
return 1
|
||||
out.write('%s %s\n' % (m.hexdigest(), filename))
|
||||
|
@ -70,7 +70,7 @@ def main(args = sys.argv[1:], out=sys.stdout):
|
|||
global fnfilter, rmode, bufsize
|
||||
try:
|
||||
opts, args = getopt.getopt(args, 'blts:')
|
||||
except getopt.error, msg:
|
||||
except getopt.error as msg:
|
||||
sys.stderr.write('%s: %s\n%s' % (sys.argv[0], msg, usage))
|
||||
return 2
|
||||
for o, a in opts:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue