From e51dc1498856c7d4786e42c53ace104ce6e62573 Mon Sep 17 00:00:00 2001 From: Lysandros Nikolaou Date: Mon, 20 May 2024 16:28:19 -0400 Subject: [PATCH 1/2] gh-111201: Remove readline dependency from the PyREPL --- Lib/_pyrepl/readline.py | 4 ++-- Lib/test/test_pyrepl.py | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Lib/_pyrepl/readline.py b/Lib/_pyrepl/readline.py index 0adecf235a4eb4..9c85ce175fd6d6 100644 --- a/Lib/_pyrepl/readline.py +++ b/Lib/_pyrepl/readline.py @@ -31,9 +31,9 @@ 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 @@ -84,7 +84,7 @@ @dataclass class ReadlineConfig: - readline_completer: Completer | None = readline.get_completer() + readline_completer: Completer | None = RLCompleter().complete completer_delims: frozenset[str] = frozenset(" \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?") diff --git a/Lib/test/test_pyrepl.py b/Lib/test/test_pyrepl.py index 1daf3a8b498119..6a8b4d0aa368b5 100644 --- a/Lib/test/test_pyrepl.py +++ b/Lib/test/test_pyrepl.py @@ -1,7 +1,6 @@ import itertools import os import rlcompleter -import sys import tempfile import unittest from code import InteractiveConsole @@ -17,7 +16,6 @@ # option. Additionally, we need to attempt to import curses and readline. requires("curses") curses = import_module("curses") -readline = import_module("readline") from _pyrepl.console import Console, Event from _pyrepl.readline import ReadlineAlikeReader, ReadlineConfig From 184d7245e803ef574dabb9e653fdab2a7a2ac165 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 20:31:03 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2024-05-20-20-30-57.gh-issue-111201.DAA5lC.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2024-05-20-20-30-57.gh-issue-111201.DAA5lC.rst 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 index 00000000000000..15cd79dec378ee --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-05-20-20-30-57.gh-issue-111201.DAA5lC.rst @@ -0,0 +1 @@ +Remove dependency to :mod:`readline` from the new Python REPL.