Skip to content

Commit e1a355e

Browse files
author
Sebastian Ramacher
committed
Merged in acdha/bpython (pull request #3)
2 parents 1732f4b + 846ea9c commit e1a355e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

bpdb/__init__.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,22 @@ def set_trace():
3434
a debugger instance and sets the trace. """
3535
debugger = BPdb()
3636
debugger.set_trace(sys._getframe().f_back)
37+
38+
# Adopted verbatim from pdb for completeness:
39+
40+
def post_mortem(t=None):
41+
# handling the default
42+
if t is None:
43+
# sys.exc_info() returns (type, value, traceback) if an exception is
44+
# being handled, otherwise it returns None
45+
t = sys.exc_info()[2]
46+
if t is None:
47+
raise ValueError("A valid traceback must be passed if no "
48+
"exception is being handled")
49+
50+
p = BPdb()
51+
p.reset()
52+
p.interaction(None, t)
53+
54+
def pm():
55+
post_mortem(getattr(sys, "last_traceback", None))

0 commit comments

Comments
 (0)