Skip to content

gh-128720: Fix doc inacurracy about __main__.__file__ existence in the REPL - #128721

Merged
pablogsal merged 1 commit into
python:mainfrom
wimglenn:__main__.__file__
Jan 21, 2025
Merged

gh-128720: Fix doc inacurracy about __main__.__file__ existence in the REPL#128721
pablogsal merged 1 commit into
python:mainfrom
wimglenn:__main__.__file__

Conversation

@wimglenn

@wimglenn wimglenn commented Jan 10, 2025

Copy link
Copy Markdown
Contributor

I opted to just remove the confusing conditional.

If the example needs a "check for REPL" conditional, I'd suggest checking sys.ps1, however I think that could be scope creep and the example script is better off without that condition at all.


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

Comment thread Doc/library/__main__.rst
Comment on lines -364 to -366
Note that in this case the ``__main__`` scope doesn't contain a ``__file__``
attribute as it's interactive.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We may want to keep this line, depending on the resolution of the issue. I agree with the changes above.

@pablogsal
pablogsal merged commit a4760ef into python:main Jan 21, 2025
@pablogsal

Copy link
Copy Markdown
Member

Thanks a lot for the contribution @wimglenn and @AA-Turner for the review!

@wimglenn
wimglenn deleted the __main__.__file__ branch January 21, 2025 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants