Skip to content

[3.14] gh-127960 Fix the REPL to set the correct namespace by setting the correct __main__ module (gh-134275) #134473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented May 22, 2025

The __main__ module imported in the _pyrepl module points to the _pyrepl module itself when the interpreter was launched without -m option and didn't execute a module,
while it's an unexpected behavior that __main__ can be _pyrepl and relative imports such as from . import * works based on the _pyrepl module.
(cherry picked from commit b1b8962)

Co-authored-by: Yuichiro Tachibana (Tsuchiya) t.yic.yt@gmail.com
Co-authored-by: Łukasz Langa lukasz@langa.pl

…the correct `__main__` module (pythongh-134275)

The `__main__` module imported in the `_pyrepl` module points to the `_pyrepl` module itself when the interpreter was launched without `-m` option and didn't execute a module,
while it's an unexpected behavior that `__main__` can be `_pyrepl` and relative imports such as `from . import *` works based on the `_pyrepl` module.
(cherry picked from commit b1b8962)

Co-authored-by: Yuichiro Tachibana (Tsuchiya) <t.yic.yt@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants