Skip to content

A daemon Thread calling input() can prevent a program from exiting #144892

@asr1875

Description

@asr1875

Bug report

Bug description:

from threading import Thread
from time import sleep

def get_input():
    while True:
        input()

Thread(target=get_input, daemon=True).start()
sleep(0.001)

This issue might be related to #112585

The above python script does not exit until input is given, despite input being called from a daemon Thread. Replacing input() with sys.stdin.read() or sys.stdin.readline() does not cause this issue, despite their similar function.

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions