python / python/cpython

Documentation for `PYTHONUNBUFFERED` is not correct

Open
#128,392 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Documentation

Follow up on: https://github.com/python/cpython/issues/128377

According to docs, PYTHONUNBUFFERED is true if set as a non-empty string. Setting it to "0" (which is non-empty string) has effect of disabling it though.
Related C code:
https://github.com/python/cpython/blob/d903b17499b1a3bfb3ea848f6a1b6da02eac3328/Python/initconfig.c#L1786-L1790
https://github.com/python/cpython/blob/d903b17499b1a3bfb3ea848f6a1b6da02eac3328/Python/preconfig.c#L563-L578
https://github.com/python/cpython/blob/d903b17499b1a3bfb3ea848f6a1b6da02eac3328/Python/preconfig.c#L545-L560

We should probably rephrase it from:
If this is set to a non-empty string...
to:
If this is set...

Linked PRs
  • gh-128393

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

Open the PYTHONUNBUFFERED entry in the Python command-line environment-variable documentation and compare its wording with the cited logic in Python/initconfig.c and Python/preconfig.c. Update the description so it accurately reflects the documented behavior, then verify the resulting documentation wording; note that linked PR gh-128393 indicates work is already underway.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.