Skip to content

Keep current frame when stepping into an exception - #768

Merged
inducer merged 1 commit into
inducer:mainfrom
lyn1dev:fix/exception-step-stack-562
Dec 1, 2026
Merged

inducer merged 1 commit into
inducer:mainfrom
lyn1dev:fix/exception-step-stack-562

Conversation

@lyn1dev

@lyn1dev lyn1dev commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Closes #562

Summary

  • Restrict frame = None in Debugger.get_shortened_stack to self.post_mortem (if tb is not None and self.post_mortem:).
  • Unconditionally clearing frame whenever tb is not None caused bdb.Bdb.get_stack(None, tb) to jump to the deepest traceback frame instead of keeping the caller frame when stepping (n) into a line that raises an exception via user_exception(frame, exc_info), and prevented self.bottom_frame trimming above frame.
  • Keeping frame = None in post-mortem mode preserves the duplicate-frame fix when interaction passes walk_frame alongside a traceback.

Testing

  • Added regression tests in pudb/test/test_debugger.py:
    • test_step_next_exception_keeps_caller_frame
    • test_post_mortem_avoids_duplicate_stack_frames
    • test_get_shortened_stack_trims_above_bottom_frame_with_tb
  • Ran pytest pudb/test --ignore=pudb/test/test_remote.py (39 passed; test_remote.py skipped due to Windows urwid socket input limitation), ruff check, and basedpyright.

@inducer
inducer force-pushed the fix/exception-step-stack-562 branch from 5c47fa2 to c0a4a4f Compare December 1, 2026 17:37
@inducer

inducer commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Thanks!

@inducer
inducer enabled auto-merge (rebase) December 1, 2026 17:38
@inducer
inducer merged commit 7aae06f into inducer:main Dec 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On exception pudb now jumps into the exception instead of showing it

2 participants