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

@ -1604,8 +1604,8 @@ class DebugRunner(DocTestRunner):
... {}, 'foo', 'foo.py', 0)
>>> try:
... runner.run(test)
... except UnexpectedException, failure:
... pass
... except UnexpectedException as f:
... failure = f
>>> failure.test is test
True
@ -1632,8 +1632,8 @@ class DebugRunner(DocTestRunner):
>>> try:
... runner.run(test)
... except DocTestFailure, failure:
... pass
... except DocTestFailure as f:
... failure = f
DocTestFailure objects provide access to the test:
@ -2141,8 +2141,8 @@ class DocTestCase(unittest.TestCase):
>>> case = DocTestCase(test)
>>> try:
... case.debug()
... except UnexpectedException, failure:
... pass
... except UnexpectedException as f:
... failure = f
The UnexpectedException contains the test, the example, and
the original exception:
@ -2170,8 +2170,8 @@ class DocTestCase(unittest.TestCase):
>>> try:
... case.debug()
... except DocTestFailure, failure:
... pass
... except DocTestFailure as f:
... failure = f
DocTestFailure objects provide access to the test: