python / python/cpython

Hangup when printing empty string to unbuffered stdout

Open
#148,773 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core OS-unsupported topic-IO type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Crash report

What happened?
$ sudo python3 -u -c 'print(""); print("foo")'
Hangup

When printing an empty string to unbuffered stdout, under certain circumstances (e.g. when running on AIX under sudo, screen, tmux), the user session including the Python interpreter will terminate.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Output from running 'python -VV' on the command line:

Python 3.12.13 (main, Mar 6 2026, 03:56:12) [GCC 10.3.0]

Linked PRs
  • gh-148774

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 reproducing the reported command with unbuffered stdout, focusing on the AIX, sudo, screen, and tmux circumstances described in the issue. Review the linked PR gh-148774 and the relevant CPython stdout/write path it identifies. Done means the command no longer terminates the user session and the behavior is covered by an appropriate regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.