cpython icon indicating copy to clipboard operation
cpython copied to clipboard

sys.stdin.read() throws a TypeError when stdin is set to be non-blocking

Open MartinHHProbst opened this issue 2 years ago • 2 comments

Bug report

Bug description:

sys.stdin.read() throws a TypeError if stdin has been set to be non-blocking. The code below should just exit without issue. It throws a TypeError if no input is provided.

#!/usr/bin/python3

import sys
import os

os.set_blocking(sys.stdin.fileno(), False)
sys.stdin.read()

CPython versions tested on:

3.11

Operating systems tested on:

Linux

Linked PRs

  • gh-121739

MartinHHProbst avatar Sep 17 '23 19:09 MartinHHProbst