Skip to content

New REPL and readline's vi editing-mode #118840

@tmontes

Description

@tmontes

Bug report

Bug description:

Hi Python devs,

Trying out the new 3.13 REPL(love the improvement!) I faced a behaviour bump on my setup: I configure readline to be in vi editing mode, having a single set editing-mode vi line on my ~/.inputrc -- I'm running macOS 12.7.4 but the same behaviour is observed on Linux.

Observed behaviour:

  1. Launch python REPL with python.
  2. Prompt is coloured, as expected.
  3. Type in import sys.
  4. Hit ESC then k -- the equivalent of "give me the previous line".
  5. Nothing happens.
  6. Hit the up arrow, instead.
  7. This time the previous line, import sys, is restored.

Expected behaviour -- hitting ESC then k should restore the previous line and, in general, hitting ESC should go into "vi command mode" (not sure how this will work with multi-line history entries, but that is yet to be explored).

However:

  • When running with PYTHON_BASIC_REPL=1 the vi mode line editing works.

Since I'm running macOS and it does not ship readline, I figured I needed a better diagnostic (not sure if www.python.org's macOS Python bundles it -- it seems so, but I digged deeper).
On a Rocky Linux 9 host:

  • Cloned the git repo.
  • Checked out the 3.13 branch.
  • Installed all lib dependencies including readline-devel.
  • Built commit c4b853f2a5a4601806f503f1833dce3a4e8d2b58:
    $ ./configure --with-pydebug
    $ make -s -j2
    
  • The resulting ./python executable shows the same behaviour -- readline's vi editing mode does not seem to be respected.

I did not look deeper into the code but I will be glad to assist in the diagnostic/fixing of this -- hoping that going forward, with a more powerful REPL, I can still leverage my finger memory from years of using vi.

Thanks again.

CPython versions tested on:

3.13

Operating systems tested on:

Linux, macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixestopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy