Skip to content
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

prevent Pdb from setting a break point with the "step" command after the last line #1

Open
TaiSakuma opened this issue May 5, 2021 · 2 comments

Comments

@TaiSakuma
Copy link
Member

If the Pdb command step is used after the last line of the script, Pdb will set the trace_dispath function as the trace function of the caller's frame. Consequently, the trace_dispath function will be called at line 48 after the script execution has finished.

try:
exec(cmd)
finally:
sys.settrace(trace_org)
threading.settrace(trace_org)

The trace_dispath function is set in Bdb.set_trace()

https://github.com/python/cpython/blob/v3.9.5/Lib/bdb.py#L298-L308

@TaiSakuma
Copy link
Member Author

Bdb.set_trace() should be intervened when the command step is used on the event return at the last line of the script.

TaiSakuma added a commit that referenced this issue Feb 18, 2022
@TaiSakuma
Copy link
Member Author

The commit c93e93f is a quick fix.

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

No branches or pull requests

1 participant