mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
[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:
parent
0794220a69
commit
5b718e7fc7
6 changed files with 85 additions and 42 deletions
|
@ -27,12 +27,9 @@ from __future__ import annotations
|
|||
|
||||
import _sitebuiltins
|
||||
import linecache
|
||||
import builtins
|
||||
import sys
|
||||
import code
|
||||
from types import ModuleType
|
||||
|
||||
from .console import InteractiveColoredConsole
|
||||
from .readline import _get_reader, multiline_input
|
||||
|
||||
TYPE_CHECKING = False
|
||||
|
@ -82,17 +79,12 @@ REPL_COMMANDS = {
|
|||
|
||||
|
||||
def run_multiline_interactive_console(
|
||||
namespace: dict[str, Any],
|
||||
console: code.InteractiveConsole,
|
||||
*,
|
||||
future_flags: int = 0,
|
||||
console: code.InteractiveConsole | None = None,
|
||||
) -> None:
|
||||
from .readline import _setup
|
||||
_setup(namespace)
|
||||
|
||||
if console is None:
|
||||
console = InteractiveColoredConsole(
|
||||
namespace, filename="<stdin>"
|
||||
)
|
||||
_setup(console.locals)
|
||||
if future_flags:
|
||||
console.compile.compiler.flags |= future_flags
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue