diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-05-31 15:18:28 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-31 15:18:28 (GMT) |
| commit | d6faac6d1f825405398158272286aaed94eb51fc (patch) | |
| tree | 3b06fc114183c3185556756f3d36172f2b06fc08 /Lib/_pyrepl/readline.py | |
| parent | 6e57bd01e00d40dfe7c9344d0b528d9059b1fa93 (diff) | |
| download | cpython-d6faac6d1f825405398158272286aaed94eb51fc.zip cpython-d6faac6d1f825405398158272286aaed94eb51fc.tar.gz cpython-d6faac6d1f825405398158272286aaed94eb51fc.tar.bz2 | |
[3.13] gh-111201: Support pyrepl on Windows (GH-119559) (GH-119850)
(cherry picked from commit 0d07182821fad7b95a043d006f1ce13a2d22edcb)
Co-authored-by: Dino Viehland <dinoviehland@gmail.com>
Co-authored-by: Anthony Shaw <anthony.p.shaw@gmail.com>
Co-authored-by: Ćukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Lib/_pyrepl/readline.py')
| -rw-r--r-- | Lib/_pyrepl/readline.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/_pyrepl/readline.py b/Lib/_pyrepl/readline.py index 01da926..7d811bf 100644 --- a/Lib/_pyrepl/readline.py +++ b/Lib/_pyrepl/readline.py @@ -38,7 +38,14 @@ from rlcompleter import Completer as RLCompleter from . import commands, historical_reader from .completing_reader import CompletingReader -from .unix_console import UnixConsole, _error +from .console import Console as ConsoleType + +Console: type[ConsoleType] +_error: tuple[type[Exception], ...] | type[Exception] +try: + from .unix_console import UnixConsole as Console, _error +except ImportError: + from .windows_console import WindowsConsole as Console, _error ENCODING = sys.getdefaultencoding() or "latin1" @@ -339,7 +346,7 @@ class _ReadlineWrapper: def get_reader(self) -> ReadlineAlikeReader: if self.reader is None: - console = UnixConsole(self.f_in, self.f_out, encoding=ENCODING) + console = Console(self.f_in, self.f_out, encoding=ENCODING) self.reader = ReadlineAlikeReader(console=console, config=self.config) return self.reader |
