[3.13] gh-121790: Fix interactive console initialization (GH-121793) (GH-121822)

(cherry picked from commit e5c7216f37)

Co-authored-by: Milan Oberkirch <milan.oberkirch@geops.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Miss Islington (bot) 2024-07-16 00:49:41 +02:00 committed by GitHub
parent 0794220a69
commit 5b718e7fc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 85 additions and 42 deletions

View file

@ -517,10 +517,7 @@ def register_readline():
pass
if readline.get_current_history_length() == 0:
try:
from _pyrepl.main import CAN_USE_PYREPL
except ImportError:
CAN_USE_PYREPL = False
from _pyrepl.main import CAN_USE_PYREPL
# If no history was loaded, default to .python_history,
# or PYTHON_HISTORY.
# The guard is necessary to avoid doubling history size at