Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Open
@wh-timme

Description

@wh-timme
Issue body actions

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

No one assigned

    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

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.