Fix a bug that emptied the command history of the Python REPL (~/.python_history)

This commit is contained in:
Miro Hrončok 2024-07-02 11:33:00 +02:00
commit 1fc17cc898
2 changed files with 45 additions and 1 deletions

View file

@ -0,0 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Sergey B Kirpichev <skirpichev@gmail.com>
Date: Tue, 2 Jul 2024 12:40:01 +0300
Subject: [PATCH] 00430: 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 <miro@hroncok.cz>
---
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 8d193abfbb..7fff22328e 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -533,8 +533,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 0000000000..6e9dec2545
--- /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.

View file

@ -17,7 +17,7 @@ URL: https://www.python.org/
%global prerel b3
%global upstream_version %{general_version}%{?prerel}
Version: %{general_version}%{?prerel:~%{prerel}}
Release: 1%{?dist}
Release: 2%{?dist}
License: Python-2.0.1
@ -395,6 +395,10 @@ Patch251: 00251-change-user-install-location.patch
# Another process might have already moved jit_stencils.h.new
Patch429: 00429-gh-118943-fix-another-race-condition-when-generating-jit_stencils-h.patch
# 00430 # e6851cbe4b1043e8d99e3f3dfa9c9f286fe0d511
# gh-121245: Amend d611c4c8e9 (correct import) (#121255)
Patch430: 00430-gh-121245-amend-d611c4c8e9-correct-import.patch
# (New patches go here ^^^)
#
# When adding new patches to "python" and "python3" in Fedora, EL, etc.,
@ -1709,6 +1713,9 @@ CheckPython freethreading
# ======================================================
%changelog
* Tue Jul 02 2024 Miro Hrončok <mhroncok@redhat.com> - 3.13.0~b3-2
- Fix a bug that emptied the command history of the Python REPL (~/.python_history)
* Fri Jun 28 2024 Karolina Surma <ksurma@redhat.com> - 3.13.0~b3-1
- Update to Python 3.13.0b3