Skip to content

Conversation

@Joshua-Ward1
Copy link

@Joshua-Ward1 Joshua-Ward1 commented Dec 10, 2025

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

  • Documentation change only.

Testing

  • Built documentation locally (make html) to confirm RST formatting.
  • 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/

@bedevere-app bedevere-app bot added docs Documentation in the Doc dir skip news labels Dec 10, 2025
@python-cla-bot
Copy link

python-cla-bot bot commented Dec 10, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

Comment on lines +305 to +306
Enter interactive mode after execution, or force interactive mode even when
:data:`sys.stdin` does not appear to be a terminal.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably rewrite it as it is worded in python --help.

forces a prompt even if stdin does not appear to be a terminal

Saying "interactive" is not quite correct, "prompt" better describes it.

@FFY00
Copy link
Member

FFY00 commented Dec 10, 2025

@vstinner, would you mind giving this a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Incorrect docs for -i flag and PYTHONSTARTUP

2 participants