gh-142474: Clarify -i interaction with PYTHONSTARTUP
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
-iis used with a script or with-c, Python executes the script or command and then enters interactive mode. In these “execute then interact” cases,PYTHONSTARTUPis not read. -
When
-iis used solely to force interactive mode even ifstdinis not a terminal (for example with redirected standard input), the interpreter enters interactive mode directly andPYTHONSTARTUPis 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
-iandPYTHONSTARTUP.
Notes
- Per
.github/CONTRIBUTING.rst, no NEWS entry is required for this small documentation clarification.
📚 Documentation preview 📚: https://cpython-previews--142502.org.readthedocs.build/
@vstinner, would you mind giving this a look?