Skip to content

Ctrl+C has unusual behaviour while Python waits on input() #1130

Open
@cloudrac3r

Description

@cloudrac3r

I ran this file in these builds of Python:

input("hello! ")

print("looping")
a = 0
for i in range(200_000_000):
    a += 1

print("goodbye")
Build Ctrl+C in loop Ctrl+C in input()
Debian Python 3.11.2
Expected behaviour
Print ^C and traceback Print ^C and traceback
Cosmopolitan A.P.P. 3.6.14+
make o//third_party/python/python.com
Print ^C and traceback Press once: No effect
Press twice: Traceback
cosmo.zip Python 3.11.2
https://cosmo.zip/pub/cosmos/bin/python
Print ^C and traceback Press once: No effect
Press repeatedly: No effect
Press Ctrl+C and Enter: Print ^C and traceback

I tested on Linux and macOS and it seems to be the same in both.

I would expect Ctrl+C to traceback straight away regardless of whether the program is running or waiting for input. Is it possible to change this behaviour in Cosmopolitan Python?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions