-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Pdb loops endlessly on non-interactive scripts #100141
Comments
I believe this happens because the keyboard interrupt puts you in post-mortem debugging mode, so the subsequent This infinite loop also happens with an empty file or one containing no statements (but not "noninteractive scripts" that contain at least one statement), so the trace function that powers the debugger never fires. I'm not sure why/how the older versions started with a prompt even when no statements are present, though. |
I've had a closer look at this, the change in behavior between 3.10 and 3.11 appears to be caused by #94552, although I don't really understand which part of |
I found the bug and wrote a PR, core dev feedback needed :-) |
Do we know where this Bug is? Do we all know the test of: python3 -m pdb /dev/null Exact same cause as before, or a new escape, while none of us add this test? Three examples => 1 ) macOS latest fails this test
Calling -m pdb to check Python Syntax hangs in this same way on a File of nothing but Comments and Line Breaks
But go wander into the right corner of the Python world, and this problem does not repro out there. For example
Am I helping? Can I help? |
Leaving this corner untested made it worse eventually Python 3.13 came out in Oct/2024, so I reran our tests there. I've now reported the process exit return code gone wrong on Syntax Error's, but also mentioned our infinite spam observations here, up now into
These corner weren't quite so broken till after Python 3.12 |
cc @gaogaotiantian as the pdb expert |
(cherry picked from commit bb9604b) Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
(cherry picked from commit bb9604b) Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Fixed in #125425 |
Bug report
Pdb (as of 3.11.0, 3.11.1 and
main
branch, run from the command line) loops endlessly on non-interactive scripts.To reproduce, run
python -m pdb /dev/null
from the command line. This loops, endlessly printingThe program finished and will be restarted
to the terminal. PressingCtrl + C
drops you into the debugger shell, but enteringquit
only drops you back into that endless loop, I had to kill the process directly to make it quit.With Python 3.10, it looks like this:
Your environment
main
branchLinked PRs
The text was updated successfully, but these errors were encountered: