Repository navigation
Overriding SIGINT doesn't work as expected in the new REPL #120221
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes
on Jun 7, 2024 CC: @lysnikolaou @ambv
- addedtopic-replRelated to the interactive shellRelated to the interactive shell
on Jun 7, 2024 This will be fixed by #120234
I noticed the problem when trying to debug Python in gdb. CTRL+C doesn't go into gdb anymore. For now, I'm using a bash alias:
alias gdb='PYTHON_BASIC_REPL=1 gdb'- added a commit that references this issue
on Jun 11, 2024 1 remaining item
Thank you. CTRL+C is gdb stops again the process as expected :)
Reacted by Pablo Galindo SalgadoThis could have been addressed by changing
default_keymapin "Lib/_pyepl/reader.py" to map(r"\x03", "interrupt")instead of mapping it to thectrl_ccommand. Theinterruptcommand callsos.kill(os.getpid(), signal.SIGINT), which works fine for overriding theSIGINThandler and supporting gdb. That said, the decision to let the terminal send the signal makes it equivalent to how it's currently implemented on Windows, and consistency is a plus.This could have been addressed by changing
default_keymapin "Lib/_pyepl/reader.py" to map(r"\x03", "interrupt")instead of mapping it to thectrl_ccommand. Theinterruptcommand callsos.kill(os.getpid(), signal.SIGINT), which works fine for overriding theSIGINThandler and supporting gdb. That said, the decision to let the terminal send the signal makes it equivalent to how it's currently implemented on Windows, and consistency is a plus.The problem of that approach is that if you paste a huge buffer and then want to cancel because pasting it's too slow then you need to wait until you get the key press for Ctrl-C to send the signal, which will happen after all the buffer is processed, while using signals directly allows us to cancel almost immediately
Reacted by Eryk SunThis broke CTRL-C in the asyncio REPL. Now the
interruptandctrl_ccommands are never executed. I need some more time to investigate what happens on Windows to not break that when fixing Linux/Mac.Fixed by #123799.
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Bug report
In the old REPL, overriding SIGINT and pressing Ctrl-C works as expected:
but in the new REPL it doesn't trigger the signal handler:
Linked PRs