Skip to content

input() is blocking exceptions at some phase during execution #112585

Description

@wh-timme

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.

importos, signal, threadingcnt= [0]
definterrupter(cnt):
local_cnt=0while1:
iflocal_cnt!=cnt[0]:
local_cnt=cnt[0]
os.kill(os.getpid(), signal.SIGINT)
threading.Thread(target=interrupter, args=(cnt,), daemon=True).start()
while1:
cnt[0] +=1try:
input(">")
exceptKeyboardInterrupt:
print(cnt[0])

CPython versions tested on:

3.8

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions