summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-03-23 21:25:15 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-03-23 21:25:15 (GMT)
commit797eaf305a1e4cbaf2041e9b28b125398e2c235a (patch)
tree63056f632ff30eaa74c412f080969922ac51af58 /Lib
parent3e6c335ae0a9d7dc9eaffe8c372571d098ccba39 (diff)
downloadcpython-797eaf305a1e4cbaf2041e9b28b125398e2c235a.zip
cpython-797eaf305a1e4cbaf2041e9b28b125398e2c235a.tar.gz
cpython-797eaf305a1e4cbaf2041e9b28b125398e2c235a.tar.bz2
complain when there's no last exception
Diffstat (limited to 'Lib')
-rw-r--r--Lib/traceback.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index 3d877ee..b06fcea 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -241,6 +241,8 @@ def format_exc(limit=None):
def print_last(limit=None, file=None):
"""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,