[Checkins] SVN: zope.testing/branches/regebro-python3/src/zope/testing/doctest.py py3: sys.exc_info() can be called only inside the except, not anytime after an except happened

Wolfgang Schnerring wosc at wosc.de
Sun Sep 13 04:31:45 EDT 2009


Log message for revision 103884:
  py3: sys.exc_info() can be called only inside the except, not anytime after an except happened
  

Changed:
  U   zope.testing/branches/regebro-python3/src/zope/testing/doctest.py

-=-
Modified: zope.testing/branches/regebro-python3/src/zope/testing/doctest.py
===================================================================
--- zope.testing/branches/regebro-python3/src/zope/testing/doctest.py	2009-09-13 08:30:29 UTC (rev 103883)
+++ zope.testing/branches/regebro-python3/src/zope/testing/doctest.py	2009-09-13 08:31:45 UTC (rev 103884)
@@ -1360,11 +1360,11 @@
                 exec compile(example.source, filename, "single",
                              compileflags, 1) in test.globs
                 self.debugger.set_continue() # ==== Example Finished ====
-                exception = None
+                exc_info = None
             except KeyboardInterrupt:
                 raise
             except:
-                exception = sys.exc_info()
+                exc_info = sys.exc_info()
                 self.debugger.set_continue() # ==== Example Finished ====
             got = self._fakeout.getvalue()  # the actual output
             self._fakeout.truncate(0)
@@ -1372,13 +1372,12 @@
 
             # If the example executed without raising any exceptions,
             # verify its output.
-            if exception is None:
+            if exc_info is None:
                 if check(example.want, got, self.optionflags):
                     outcome = SUCCESS
 
             # The example raised an exception:  check if it was expected.
             else:
-                exc_info = sys.exc_info()
                 exc_msg = traceback.format_exception_only(*exc_info[:2])[-1]
                 if not quiet:
                     got += _exception_traceback(exc_info)



More information about the checkins mailing list