python / python/cpython

Basic REPL hangs when ioctls can't be written to TTY

Open
#139,027 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

This is related to #134466, but is regarding the basic REPL.

If you remove the ability to write ioctls to tty stdio, for example on macOS by doing

PYTHON_BASIC_REPL=1 sandbox-exec -p '(version 1) (import "system.sb") (allow process-exec) (allow file-read* (subpath "/"))' python3.13

then the REPL never shows the prompt and doesn't allow interaction, but hangs forever.

Linked PRs
  • gh-139989

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

Start by running the supplied macOS sandbox command with PYTHON_BASIC_REPL=1 and observe that the basic REPL never displays a prompt. Trace the basic REPL's TTY ioctl handling and compare it with the related issue #134466; done means the REPL remains interactive when ioctl writes are unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.