summaryrefslogtreecommitdiff
path: root/Lib/traceback.py
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2015-03-05 15:45:01 +1300
committerRobert Collins <rbtcollins@hp.com>2015-03-05 15:45:01 +1300
commit2f0441f03f71c658148bff60be46585f56670d1f (patch)
treed02581d83fa5628fd8e2ec474d1b58747438f365 /Lib/traceback.py
parent3737e600f444b230ef2284fa326443990903b25e (diff)
downloadcpython-git-2f0441f03f71c658148bff60be46585f56670d1f.tar.gz
Remaining fallout from 17911
The code module was using a private function from traceback in order to skip a frame - used the direct interface to do that instead, The decimal module suffered minor fallout from formatting changes ('None' as a value is now not printed by traceback, the same as None was not before). The cgitb module was passing a bogus exception type (type.__name__) into format_exception, which uncovered that format_exception and print_exception had been ignoring the etype for some time, so the compatibility thunk to the new code now does the same thing.
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index 22544acd18..72e1e2a9f9 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -89,10 +89,13 @@ def print_exception(etype, value, tb, limit=None, file=None, chain=True):
occurred with a caret on the next line indicating the approximate
position of the error.
"""
+ # format_exception has ignored etype for some time, and code such as cgitb
+ # passes in bogus values as a result. For compatibility with such code we
+ # ignore it here (rather than in the new TracebackException API).
if file is None:
file = sys.stderr
for line in TracebackException(
- etype, value, tb, limit=limit).format(chain=chain):
+ type(value), value, tb, limit=limit).format(chain=chain):
print(line, file=file, end="")
@@ -105,8 +108,11 @@ def format_exception(etype, value, tb, limit=None, chain=True):
these lines are concatenated and printed, exactly the same text is
printed as does print_exception().
"""
+ # format_exception has ignored etype for some time, and code such as cgitb
+ # passes in bogus values as a result. For compatibility with such code we
+ # ignore it here (rather than in the new TracebackException API).
return list(TracebackException(
- etype, value, tb, limit=limit).format(chain=chain))
+ type(value), value, tb, limit=limit).format(chain=chain))
def format_exception_only(etype, value):