GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — PyREPL: Different Completion Behavior with GNU Readline · Issue #145392 · python/cpython

PyREPL: Different Completion Behavior with GNU Readline #145392

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
PyREPL: Different Completion Behavior with GNU Readline#145392
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shellRelated to the interactive shelltype-featureA feature request or enhancementA feature request or enhancement

Description

@tanloong
tanloong
opened on Mar 1, 2026
Issue body actions

Bug report

Bug description:

The current completion logic in Lib/_pyrepl/completing_reader.py uses a suffix-insertion strategy (source code):

In the contrast, Readline completely replaces user input with the candidate (source code).

This will lead to unwanted behavior in case-insensitive completion scenario. If user input 'xy', they might get 'xyZZY' instead of the expected 'XYZZY'.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

  • gh-145392: Fix _pyrepl completion to replace input stem instead of appending #145393

Activity

  1. tanloong
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Mar 1, 2026
  2. picnixz
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    topic-replRelated to the interactive shellRelated to the interactive shell
    on Mar 1, 2026
  3. tanloong
    changed the title [-]PyREPL: Different Completion Behavior Between with GNU Readline[/-] [+]PyREPL: Different Completion Behavior with GNU Readline[/+] on Mar 5, 2026
  4. encukou commented on Apr 1, 2026

    @encukou
    encukou
    on Apr 1, 2026
    Member
    More actions

    Do you have a reproducer?
    Is this needed/helpful for SQLite?

  5. tanloong commented on Apr 1, 2026

    @tanloong
    tanloong
    on Apr 1, 2026
    ContributorAuthor
    More actions

    Yes, this will be helpful for SQLite.

    After seeing #145379, I wondered if the SQLite CLI could also use PyREPL. That would greatly improve the experience on Windows. I had an LLM create a quick demo of the SQLite CLI using PyREPL.

    In that demo, when I type sel and press Tab, it completes to selECT instead of the correct SELECT.
    I will push the demo branch as a reproducer soon.

    The demo is far from ready-to-use, and there are also syntax highlighting issues (maybe could not solved until #141619 is merged). But I believe the SQLite CLI will eventually move to PyREPL (we might not need to modify the sqlite module directly but instead update the underlying code module to use PyREPL). Changing the completion to use a replace-strategy instead of suffix-insertion will help with this. I'm fine with pausing this issue until the SQLite CLI moves to PyREPL, and then treat it as a SQLite bug only after that.

  6. tanloong commented on Apr 1, 2026

    @tanloong
    tanloong
    on Apr 1, 2026
    ContributorAuthor
    More actions

    This is the demo branch as a reproducer: https://github.com/tanloong/cpython/tree/sqlite-pyrepl

    In the screen recording, when typing sel and press Tab, it completes to selECT instead of SELECT.

    simplescreenrecorder-2026-04-01_21.46.35.mp4
  7. encukou commented on Apr 7, 2026

    @encukou
    encukou
    on Apr 7, 2026
    Member
    More actions

    Thanks! That makes sense.

    I'm fine with pausing this issue until the SQLite CLI moves to PyREPL, and then treat it as a SQLite bug only after that.

    Let's do that. There is no issue in current use of pyrepl, and if sqlite3 starts using it, it'll only be a small inconvenience.

    Reacted by Tan Long
  8. encukou
    added
    type-featureA feature request or enhancementA feature request or enhancement
    and removed
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Apr 8, 2026
  9. encukou commented on Apr 8, 2026

    @encukou
    encukou
    on Apr 8, 2026
    Member
    More actions

    I'll close for now; let's reopen when this becomes helpful.

  10. encukou
    closed this as not plannedon Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-replRelated to the interactive shellRelated to the interactive shelltype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.