Skip to content

Commit 971f387

Browse files
authored
gh-137113 docs: note readline no longer supported in REPL after 3.13 (GH-137142)
Add a note to the readline module documentation stating that Python 3.13 and later no longer supports readline in the default REPL, as per gh-118840. Includes workaround using PYTHON_BASIC_REPL. Update tutorial to remove the reference, and use a different key to test things out. Signed-off-by: Kuang Yu Heng <yuheng3107@gmail.com>
1 parent 054a565 commit 971f387

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Doc/library/readline.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,9 @@ support history save/restore. ::
403403
def save_history(self, histfile):
404404
readline.set_history_length(1000)
405405
readline.write_history_file(histfile)
406+
407+
.. note::
408+
409+
The new :term:`REPL` introduced in version 3.13 doesn't support readline.
410+
However, readline can still be used by setting the :envvar:`PYTHON_BASIC_REPL`
411+
environment variable.

Doc/tutorial/interpreter.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ status. If that doesn't work, you can exit the interpreter by typing the
3434
following command: ``quit()``.
3535

3636
The interpreter's line-editing features include interactive editing, history
37-
substitution and code completion on systems that support the `GNU Readline
38-
<https://tiswww.case.edu/php/chet/readline/rltop.html>`_ library.
37+
substitution and code completion on most systems.
3938
Perhaps the quickest check to see whether command line editing is supported is
40-
typing :kbd:`Control-P` to the first Python prompt you get. If it beeps, you
41-
have command line editing; see Appendix :ref:`tut-interacting` for an
42-
introduction to the keys. If nothing appears to happen, or if ``^P`` is
43-
echoed, command line editing isn't available; you'll only be able to use
39+
typing a word in on the Python prompt, then pressing Left arrow (or :kbd:`Control-b`).
40+
If the cursor moves, you have command line editing; see Appendix
41+
:ref:`tut-interacting` for an introduction to the keys.
42+
If nothing appears to happen, or if a sequence like ``^[[D`` or ``^B`` appears,
43+
command line editing isn't available; you'll only be able to use
4444
backspace to remove characters from the current line.
4545

4646
The interpreter operates somewhat like the Unix shell: when called with standard

0 commit comments

Comments
 (0)