-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
The following loop will soon stuck at some value, due to some phase of built-in input() itself is blocking exceptions and will not pass the exception to upper scope until an ENTER is hit on keyboard.
import os, signal, threading
cnt = [0]
def interrupter(cnt):
local_cnt = 0
while 1:
if local_cnt != cnt[0]:
local_cnt = cnt[0]
os.kill(os.getpid(), signal.SIGINT)
threading.Thread(target=interrupter, args=(cnt,), daemon=True).start()
while 1:
cnt[0] += 1
try:
input(">")
except KeyboardInterrupt:
print(cnt[0])
CPython versions tested on:
3.8
Operating systems tested on:
macOS
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error