]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-127960 Fix the REPL to set the correct namespace by setting the correct...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 22 May 2025 01:33:35 +0000 (03:33 +0200)
committerGitHub <noreply@github.com>
Thu, 22 May 2025 01:33:35 +0000 (03:33 +0200)
commit998991513b3300c3c6627857df92db81a40355c9
treeee1309c8a5b81d847d4bb040601b0266ad01f89f
parent93ab55bd703f1238cc93327a1a285921b47fa8a3
[3.14] gh-127960 Fix the REPL to set the correct namespace by setting the correct `__main__` module (gh-134275) (gh-134473)

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 b1b8962443e7d418601658a4b05347a5a9161910)

Co-authored-by: Yuichiro Tachibana (Tsuchiya) <t.yic.yt@gmail.com>
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Lib/_pyrepl/_module_completer.py
Lib/_pyrepl/main.py
Lib/_pyrepl/readline.py
Lib/test/support/__init__.py
Lib/test/test_pyrepl/test_pyrepl.py
Misc/NEWS.d/next/Core_and_Builtins/2025-05-21-18-02-56.gh-issue-127960.W3J_2X.rst [new file with mode: 0644]
Modules/main.c