summaryrefslogtreecommitdiff
path: root/Lib/traceback.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r--Lib/traceback.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index b028db0717..cb913eebae 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -274,6 +274,8 @@ def format_exc(limit=None, chain=True):
def print_last(limit=None, file=None, chain=True):
"""This is a shorthand for 'print_exception(sys.last_type,
sys.last_value, sys.last_traceback, limit, file)'."""
+ if not hasattr(sys, "last_type"):
+ raise ValueError("no last exception")
if file is None:
file = sys.stderr
print_exception(sys.last_type, sys.last_value, sys.last_traceback,