-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Description
Bug report
Bug description:
With the new REPL implementation on Windows, I'm getting an error from code that mistakenly tries to suspend the current process via os.kill(os.getpid(), signal.SIGSTOP)
when exiting via Ctrl+Z, Enter. This raises the following AttributeError
:
os.kill(os.getpid(), signal.SIGSTOP)
^^^^^^^^^^^^^^
AttributeError: module 'signal' has no attribute 'SIGSTOP'
This is due to Ctrl+Z getting mapped to the "suspend" command. This key sequence has always been supported for exiting the REPL on Windows. It's also supported when reading from io._WindowsConsoleIO
console-input files. Anything after Ctrl+Z at the start of a line gets ignored, yielding an empty read.
Note that the kernel on Windows has no support for POSIX signals. There's just a basic emulation of a few signals in the C runtime library. There's no support for SIGSTOP
. It could be emulated, but it's not, and the GUI task manager hasn't implemented support for suspending and resuming processes. Thus on Windows you could just map Ctrl+Z to the "delete" command, and update the delete
class to also exit the REPL if the raw event character is "\x1a"
.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows