https://github.com/python/cpython/commit/78e96bdf2417414c3d8aadc9a5f75702b94... commit: 78e96bdf2417414c3d8aadc9a5f75702b94968fc branch: 3.13 author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> committer: lysnikolaou <lisandrosnik@gmail.com> date: 2024-07-02T13:40:05+02:00 summary: [3.13] gh-121245: Correct pyrepl import in site.py (GH-121255) (#121261) (cherry picked from commit 7a807c3efaa83f1e4fb9b791579b47a0a1fd47de) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Miro HronĨok <miro@hroncok.cz> files: A Misc/NEWS.d/next/Library/2024-07-02-11-34-06.gh-issue-121245.sSkDAr.rst M Lib/site.py diff --git a/Lib/site.py b/Lib/site.py index 7eace190f5ab21..95c7ebf2fdf146 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -526,8 +526,7 @@ def register_readline(): def write_history(): try: - # _pyrepl.__main__ is executed as the __main__ module - from __main__ import CAN_USE_PYREPL + from _pyrepl.main import CAN_USE_PYREPL except ImportError: CAN_USE_PYREPL = False diff --git a/Misc/NEWS.d/next/Library/2024-07-02-11-34-06.gh-issue-121245.sSkDAr.rst b/Misc/NEWS.d/next/Library/2024-07-02-11-34-06.gh-issue-121245.sSkDAr.rst new file mode 100644 index 00000000000000..6e9dec2545166f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-07-02-11-34-06.gh-issue-121245.sSkDAr.rst @@ -0,0 +1,2 @@ +Fix a bug in the handling of the command history of the new :term:`REPL` that caused +the history file to be wiped at REPL exit.