From b8a80abc7fb2c6300f57ba4eca1c032affdd55ad Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Tue, 2 Jul 2024 12:40:01 +0300 Subject: [PATCH] gh-121245: Amend d611c4c8e9 (correct import) (#121255) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Miro HronĨok --- Lib/site.py | 3 +-- .../Library/2024-07-02-11-34-06.gh-issue-121245.sSkDAr.rst | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2024-07-02-11-34-06.gh-issue-121245.sSkDAr.rst diff --git a/Lib/site.py b/Lib/site.py index 9381f6f510eb46d..daa56e158949dbd 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 000000000000000..6e9dec2545166f3 --- /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.