Bug report
Bug description:
Ref: https://docs.python.org/3/library/__main__.html
There is a script and entry-point example which has a conditional upon __main__.__file__ and also a remark like:
Note that in this case the __main__ scope doesn’t contain a __file__ attribute as it’s interactive.
This was all working as demonstrated up to and including Python 3.12, but starting in Python 3.13 it's incorrect. The attribute now exists, and is pointing at _pyrepl/__main__.py.
The conditional demonstrated in namely.py:print_user_name now always goes into the if branch, and no longer the else branch, resulting in confusing output.
Ping also @jdevries3133 who wrote the original prose in #26883
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
Ref: https://docs.python.org/3/library/__main__.html
There is a script and entry-point example which has a conditional upon
__main__.__file__and also a remark like:This was all working as demonstrated up to and including Python 3.12, but starting in Python 3.13 it's incorrect. The attribute now exists, and is pointing at
_pyrepl/__main__.py.The conditional demonstrated in
namely.py:print_user_namenow always goes into the if branch, and no longer the else branch, resulting in confusing output.Ping also @jdevries3133 who wrote the original prose in #26883
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs