summaryrefslogtreecommitdiffstats
path: root/Lib/pdb.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pdb.py')
-rwxr-xr-xLib/pdb.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 57a2b45..29746d7 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -1193,7 +1193,16 @@ def set_trace():
# Post-Mortem interface
-def post_mortem(t):
+def post_mortem(t=None):
+ # handling the default
+ if t is None:
+ # sys.exc_info() returns (type, value, traceback) if an exception is
+ # being handled, otherwise it returns None
+ t = sys.exc_info()[2]
+ if t is None:
+ raise ValueError("A valid traceback must be passed if no "
+ "exception is being handled")
+
p = Pdb()
p.reset()
while t.tb_next is not None: