cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-142474: Clarify -i interaction with PYTHONSTARTUP

Open Joshua-Ward1 opened this issue 1 month ago • 2 comments

Summary

Clarify the documentation for the -i command-line option so that it accurately reflects how it interacts with PYTHONSTARTUP.

The updated text distinguishes the two distinct behaviors of -i:

  • When -i is used with a script or with -c, Python executes the script or command and then enters interactive mode. In these “execute then interact” cases, PYTHONSTARTUP is not read.

  • When -i is used solely to force interactive mode even if stdin is not a terminal (for example with redirected standard input), the interpreter enters interactive mode directly and PYTHONSTARTUP is read as usual. The previous documentation implied it was never read when using -i.

Issue number

Closes gh-142474.

Type of change

  • [x] Documentation change only.

Testing

  • [x] Built documentation locally (make html) to confirm RST formatting.
  • [x] Verified that the updated wording matches the current behavior of -i and PYTHONSTARTUP.

Notes

  • Per .github/CONTRIBUTING.rst, no NEWS entry is required for this small documentation clarification.

📚 Documentation preview 📚: https://cpython-previews--142502.org.readthedocs.build/

Joshua-Ward1 avatar Dec 10 '25 06:12 Joshua-Ward1

All commit authors signed the Contributor License Agreement.

CLA signed

python-cla-bot[bot] avatar Dec 10 '25 06:12 python-cla-bot[bot]

@vstinner, would you mind giving this a look?

FFY00 avatar Dec 10 '25 11:12 FFY00