Skip to content

gh-69605: Disable PyREPL module autocomplete fallback on regular completion - #134181

Merged
ambv merged 7 commits into
python:mainfrom
loic-simon:pyrepl-module-completion-dont-fallback
May 25, 2025
Merged

gh-69605: Disable PyREPL module autocomplete fallback on regular completion#134181
ambv merged 7 commits into
python:mainfrom
loic-simon:pyrepl-module-completion-dont-fallback

Conversation

@loic-simon

@loic-simonloic-simon commented May 18, 2025

Copy link
Copy Markdown
Contributor

When no module completions are available, do not fallback on completions from current namespace, as there are not relevant.

Before:

>>> import pri<TAB>
>>> importprint(
>>>
>>> from typing import Na<TAB>
>>> from typing importNameError(

After:

>>> import pri<TAB>
>>> import pri
>>>
>>> from typing import Na<TAB>
>>> from typing import Na

cc @tomasr8

When no module completions are available, do not fallback to completions from current namespace
@bedevere-app

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@tomasr8tomasr8 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Overall approach looks good, I just have some nitpicks 🙂

Comment threadLib/test/test_pyrepl/test_pyrepl.py Outdated
Comment threadLib/_pyrepl/readline.py Outdated

@tomasr8tomasr8 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment threadLib/_pyrepl/_module_completer.py Outdated
@ambv
ambv merged commit 0e3bc96 into python:mainMay 25, 2025
@ambvambv added the needs backport to 3.14 bugs and security fixes label May 25, 2025
@miss-islington-app

Copy link
Copy Markdown

Thanks @loic-simon for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 25, 2025
…r completion (pythongh-134181)
(cherry picked from commit 0e3bc96)
Co-authored-by: Loïc Simon <loic.pano@gmail.com>
Co-authored-by: Loïc Simon <loic.simon@napta.io>
@bedevere-app

Copy link
Copy Markdown

GH-134680 is a backport of this pull request to the 3.14 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.14 bugs and security fixes label May 25, 2025
ambv pushed a commit that referenced this pull request May 25, 2025
…ar completion (gh-134181) (gh-134680)
(cherry picked from commit 0e3bc96)
Co-authored-by: Loïc Simon <loic.simon@napta.io>
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
…r completion (pythongh-134181)
Co-authored-by: Loïc Simon <loic.simon@napta.io>
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
…r completion (pythongh-134181)
Co-authored-by: Loïc Simon <loic.simon@napta.io>
gostak-dd pushed a commit to gostak-dd/cpython that referenced this pull request Jun 2, 2026
…r completion (pythongh-134181)
Co-authored-by: Loïc Simon <loic.simon@napta.io>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@loic-simon@tomasr8@ambv