[Python-checkins] r70554 - python/trunk/Lib/traceback.py

benjamin.peterson python-checkins at python.org
Mon Mar 23 22:25:16 CET 2009


Author: benjamin.peterson
Date: Mon Mar 23 22:25:15 2009
New Revision: 70554
Log:
complain when there's no last exception
Modified:
 python/trunk/Lib/traceback.py
Modified: python/trunk/Lib/traceback.py
==============================================================================
--- python/trunk/Lib/traceback.py	(original)
+++ python/trunk/Lib/traceback.py	Mon Mar 23 22:25:15 2009
@@ -241,6 +241,8 @@
 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,


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /