gh-121790: Fix interactive console initialization (#121793)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Milan Oberkirch 2024-07-16 00:24:18 +02:00 committed by GitHub
parent d23be3947c
commit e5c7216f37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 85 additions and 42 deletions

View file

@ -23,7 +23,7 @@ else:
def interactive_console(mainmodule=None, quiet=False, pythonstartup=False):
if not CAN_USE_PYREPL:
if not os.environ.get('PYTHON_BASIC_REPL', None) and FAIL_REASON:
if not os.getenv('PYTHON_BASIC_REPL') and FAIL_REASON:
from .trace import trace
trace(FAIL_REASON)
print(FAIL_REASON, file=sys.stderr)
@ -51,5 +51,7 @@ def interactive_console(mainmodule=None, quiet=False, pythonstartup=False):
if not hasattr(sys, "ps2"):
sys.ps2 = "... "
from .console import InteractiveColoredConsole
from .simple_interact import run_multiline_interactive_console
run_multiline_interactive_console(namespace)
console = InteractiveColoredConsole(namespace, filename="<stdin>")
run_multiline_interactive_console(console)