Issue 1106316. post_mortem()'s parameter, traceback, is now
optional: it defaults to the traceback of the exception that is currently
being handled.
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 8da23d8..82b52a3 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -1198,7 +1198,16 @@
# 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: