Skip to content

gh-71136: Fix IDLE Shell hang after KeyboardInterrupt under the debugger - #157566

Merged
terryjreedy merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-71136-debugger-interrupt
Sep 26, 2026
Merged

terryjreedy merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-71136-debugger-interrupt

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Code run under the debugger goes through IdbAdapter.run(), not Executive.runcode(), so a KeyboardInterrupt (raised by the code, or Ctrl-C while paused) reached the request loop in run.main(), which dropped it without replying. The GUI then waited forever.

Now it is reported, as without the debugger, and replied to — but only if a request was being executed, unlike #1711/#141328, which reply unconditionally and print nothing.

The Shell restart on SystemExit under the debugger, the other half of gh-71136, has the same origin and can be fixed separately.

🤖 Generated with Claude Code

… debugger

Code run under the debugger bypasses Executive.runcode(), so the
KeyboardInterrupt reached the request loop in run.main(), which
did not reply to the request. Report it and reply, but only if a
request was being executed.

Co-authored-by: Louie Lu <git@louie.lu>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@terryjreedy terryjreedy left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see any issue with raise SystemExit in debugged code, so I think this finishes issue.
EDIT add below:
It does not hang, but restarts, so not same as usual. Fix might not be same. Less critical, other issues more important.

Keyboard Control-C does not have bad effect for me even on 3.15. So changed message above a bit.

There is a separate issue about [DEBUG ON] being on line with prompt. Maybe move to status bar.

@terryjreedy
terryjreedy merged commit ee1bbf0 into python:main Sep 26, 2026
112 of 113 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Sep 26, 2026

Copy link
Copy Markdown

GH-158204 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Sep 26, 2026
@bedevere-app

bedevere-app Bot commented Sep 26, 2026

Copy link
Copy Markdown

GH-158205 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 26, 2026
@bedevere-app

bedevere-app Bot commented Sep 26, 2026

Copy link
Copy Markdown

GH-158206 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Sep 26, 2026
terryjreedy pushed a commit that referenced this pull request Sep 26, 2026
…e debugger (GH-157566) (#158206)

gh-71136: Fix IDLE Shell hang after KeyboardInterrupt under the debugger (GH-157566)

Debugging 'raise KeyboardInterrupt' in debugged code no longer hangs IDLE forever.  The response is similar to without the debugger.

---------


(cherry picked from commit ee1bbf0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
terryjreedy pushed a commit that referenced this pull request Sep 26, 2026
…e debugger (GH-157566) (#158205)

gh-71136: Fix IDLE Shell hang after KeyboardInterrupt under the debugger (GH-157566)

Debugging 'raise KeyboardInterrupt' in debugged code no longer hangs IDLE forever.  The response is similar to without the debugger.

---------


(cherry picked from commit ee1bbf0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@python python deleted a comment from bedevere-bot Sep 26, 2026
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.

2 participants