python / python/cpython

sys.stdin.read() exits the REPL process when stdin is set to be non-blocking on 3.14

Open
#121,662 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:
import sys
import os

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

Just a weird side effect I found while ckecking out #109523 on Python 3.14 using the new REPL.
Running the code mentioned in #109523 raises a BlockingIOError and exits the REPL process.
Running the code from a script produces an error that is consistent with the previous report.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs
  • gh-121689

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the snippet in the new Python 3.14 REPL on Linux and compare it with running the same code as a script. Review the work linked as gh-121689 and verify that a BlockingIOError no longer exits the REPL process while script behavior remains consistent with the earlier report.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.