Skip to content

Fix crash when expanding variables in post-mortem #465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pudb/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ def __init__(self, stdin=None, stdout=None, term_size=None, steal_output=False,
for bpoint_descr in load_breakpoints():
self.set_break(*bpoint_descr)

@property
def stack(self):
if self.post_mortem:
# Return the bottom frame so the user can expand variables in post_mortem
return [(self.bottom_frame, self.bottom_frame.f_lineno)]
else:
return self._stack

# These (dispatch_line and set_continue) are copied from bdb with the
# patch from https://bugs.python.org/issue16482 applied. See
# https://github.com/inducer/pudb/pull/90.
Expand Down Expand Up @@ -401,7 +409,7 @@ def interaction(self, frame, exc_tuple=None, show_exc_dialog=True):
if not found_bottom_frame and not self.post_mortem:
return

self.stack, index = self.get_shortened_stack(frame, tb)
self._stack, index = self.get_shortened_stack(frame, tb)

if self.post_mortem:
index = len(self.stack)-1
Expand Down