Skip to content

Commit

Permalink
Merge branch 'main' into bpo-15987
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyhylton authored May 21, 2024
2 parents bf9e403 + de8f530 commit f34dcac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Lib/_pyrepl/readline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?")


Expand Down
7 changes: 6 additions & 1 deletion Lib/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,12 @@ def register_readline():
pass

def write_history():
from _pyrepl.__main__ import CAN_USE_PYREPL
try:
# _pyrepl.__main__ is executed as the __main__ module
from __main__ import CAN_USE_PYREPL
except ImportError:
CAN_USE_PYREPL = False

try:
if os.getenv("PYTHON_BASIC_REPL") or not CAN_USE_PYREPL:
readline.write_history_file(history)
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_pyrepl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# 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):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove dependency to :mod:`readline` from the new Python REPL.

0 comments on commit f34dcac

Please sign in to comment.