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:
Guido van Rossum 2007-01-10 16:19:56 +00:00
parent 893523e80a
commit b940e113bf
295 changed files with 817 additions and 743 deletions

View file

@ -370,7 +370,7 @@ class Folder:
count = len(all)
try:
anchor = self._parseindex(head, all)
except Error, msg:
except Error as msg:
seqs = self.getsequences()
if not head in seqs:
if not msg:
@ -407,7 +407,7 @@ class Folder:
# Neither X:Y nor X-Y; must be a number or a (pseudo-)sequence
try:
n = self._parseindex(seq, all)
except Error, msg:
except Error as msg:
seqs = self.getsequences()
if not seq in seqs:
if not msg:
@ -471,7 +471,7 @@ class Folder:
pass
try:
os.rename(path, commapath)
except os.error, msg:
except os.error as msg:
errors.append(msg)
else:
deleted.append(n)
@ -499,7 +499,7 @@ class Folder:
try:
shutil.copy2(path, topath)
os.unlink(path)
except (IOError, os.error), msg:
except (IOError, os.error) as msg:
errors.append(msg)
try:
os.unlink(topath)
@ -989,7 +989,7 @@ def test():
'all'):
try:
do('f.parsesequence(%r)' % (seq,))
except Error, msg:
except Error as msg:
print "Error:", msg
stuff = os.popen("pick %r 2>/dev/null" % (seq,)).read()
list = map(int, stuff.split())