]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-111201: Remove readline dependency from the PyREPL (GH-119262) (#119403)
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Wed, 22 May 2024 15:45:11 +0000 (11:45 -0400)
committerGitHub <noreply@github.com>
Wed, 22 May 2024 15:45:11 +0000 (11:45 -0400)
(cherry picked from commit 561ff1fa710493dee8c6482f990bd17535b27040)

Lib/_pyrepl/readline.py
Lib/test/test_pyrepl/__init__.py
Misc/NEWS.d/next/Library/2024-05-20-20-30-57.gh-issue-111201.DAA5lC.rst [new file with mode: 0644]

index d28a7f3779f3021e2a83b1002e09702cc45156d7..8de60ffd2bd025e2dcfae122cfbf17ab7ffa5b6e 100644 (file)
@@ -31,9 +31,9 @@ from __future__ import annotations
 from dataclasses import dataclass, field
 
 import os
-import readline
 from site import gethistoryfile   # type: ignore[attr-defined]
 import sys
+from rlcompleter import Completer as RLCompleter
 
 from . import commands, historical_reader
 from .completing_reader import CompletingReader
@@ -81,7 +81,7 @@ __all__ = [
 
 @dataclass
 class ReadlineConfig:
-    readline_completer: Completer | None = readline.get_completer()
+    readline_completer: Completer | None = RLCompleter().complete
     completer_delims: frozenset[str] = frozenset(" \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?")
 
 
index a9bc41f4d39f60b66f83f32d078d42ff415b449a..fa38b86b847dd98547a4226c7cf2078ba06c3262 100644 (file)
@@ -7,7 +7,6 @@ from test.support.import_helper import import_module
 # option.  Additionally, we need to attempt to import curses and readline.
 requires("curses")
 curses = import_module("curses")
-readline = import_module("readline")
 
 
 def load_tests(*args):
diff --git a/Misc/NEWS.d/next/Library/2024-05-20-20-30-57.gh-issue-111201.DAA5lC.rst b/Misc/NEWS.d/next/Library/2024-05-20-20-30-57.gh-issue-111201.DAA5lC.rst
new file mode 100644 (file)
index 0000000..15cd79d
--- /dev/null
@@ -0,0 +1 @@
+Remove dependency to :mod:`readline` from the new Python REPL.