python / cpython

The Python programming language
https://www.python.org
Other
63.21k stars 30.27k forks source link

Python 3.13: gnureadline appears to no longer be used #125924

Open milosivanovic opened 2 days ago

milosivanovic commented 2 days ago

Bug report

Bug description:

Tested in 3.12: In the <=3.12 Python REPL on Linux, pressing CTRL+R invokes gnureadline and shows:

(reverse-i-search)`':

Tested in 3.13: In the 3.13 Python REPL on Linux, pressing CTRL+R does not appear to invoke gnureadline and shows:

(r-search `')

Additionally, with nothing in the command history, typing a few characters in the 3.13 REPL (without pressing enter) and then using the up/down arrow keys moves the cursor to the start and end of the line. In 3.12 (any in any other software that uses gnureadline), pressing up/down in this scenario did nothing and is the expected behaviour.

Was gnureadline removed in 3.13 in favour of an in-house implementation that doesn't mirror the featureset? If so, is it possible to restore the previous behaviour from <=3.12? This used to be able to be done with https://github.com/ludwigschwardt/python-gnureadline/issues/62 but this no longer appears to work in 3.13.

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

Linux, macOS

nineteendo commented 2 days ago

The old REPL can still be activated: https://docs.python.org/3/using/cmdline.html#envvar-PYTHON_BASIC_REPL

ludwigschwardt commented 2 days ago

Out of interest, how much does the new REPL still depend on readline?

It is explicitly mentioned as a dependency in the docs linked above, and I see that the code in Lib/_pyrepl still imports rlcompleter but I can't tell at a glance how much functionality has been reimplemented in Python. Is there a summary somewhere?