-
-
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
gh-120221: Deliver real singals on Ctrl-C and Ctrl-Z in the new REPL #120354
Conversation
pablogsal
commented
Jun 11, 2024
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Overriding SIGINT doesn't work as expected in the new REPL #120221
@lysnikolaou Unfortunately I have not found a proper way to test this since it requires a terminal that sends something on Ctrl-C (sending signals won't test that we are not intercepting ourselves Ctrl-C neither will do it writing manually Ctrl-C to the REPL because that will never arrive if this is done properly), so this needs to be manually tested. Do you mind confirming that it works on your side? |
Check #120221 (comment) for a reproducer |
Misc/NEWS.d/next/Core and Builtins/2024-06-11-17-56-12.gh-issue-120221.si9hM9.rst
Outdated
Show resolved
Hide resolved
…e-120221.si9hM9.rst Co-authored-by: devdanzin <[email protected]>
This works for me! Only weird thing is that it adds some kind of weird indentation when pressing Ctrl-C more times. ❯ ./python.exe
Python 3.14.0a0 (heads/paste:4e170a4361b, Jun 11 2024, 19:04:57) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import signal
>>> signal.signal(signal.SIGINT,\040lambda\040*x:\040print("NOOOO"))KeyboardInterrupt
>>> signal.signal(signal.SIGINT, lambda *x: print("NOOOO"))
<built-in function default_int_handler>
>>> NOOOO
NOOOO
NOOOO
NOOOO
NOOOO
NOOOO |
Yeah, but I think is because it's printing in the middle of REPL code and not informing the reader (that's expected). |
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
… REPL (pythonGH-120354) (cherry picked from commit 34e4d32) Co-authored-by: Pablo Galindo Salgado <[email protected]>
GH-120368 is a backport of this pull request to the 3.13 branch. |