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/Lib/doctest.py b/Lib/doctest.py
index 435e13b..d120a01 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -1604,8 +1604,8 @@
... {}, '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 @@
>>> 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 @@
>>> 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 @@
>>> try:
... case.debug()
- ... except DocTestFailure, failure:
- ... pass
+ ... except DocTestFailure as f:
+ ... failure = f
DocTestFailure objects provide access to the test: