Skip to content

[3.14] gh-69605: fix PyREPL completions inserted for import statements with spaces (GH-148629) - #162046

Open
hugovk wants to merge 1 commit into
python:3.14from
hugovk:backport-488ce0f-3.14
Open

hugovk wants to merge 1 commit into
python:3.14from
hugovk:backport-488ce0f-3.14

Conversation

@hugovk

@hugovk hugovk commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Fix from math .<tab> inserting from math .ath.integer instead of from math.integer (cherry picked from commit 488ce0f)

…tements with spaces (pythonGH-148629)

Fix `from math .<tab>` inserting `from math .ath.integer` instead of `from math.integer`
(cherry picked from commit 488ce0f)

Co-authored-by: Loïc Simon <loic.simon@napta.io>
last_word = line.split(" ")[-1]
if not last_word:
return completion
index = completion.rfind(last_word)

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.

With apkg/foofoo.py, import apkg. foo<Tab> completes to foo. rfind() picks the second occurrence. Can we use the parser's replacement boundary here? This also affects main and 3.15.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@loic-simon This is a backport of your #148629, would you like to followup here? Thanks!

@bedevere-app

bedevere-app Bot commented Nov 26, 2026

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

And if you don't make the requested changes, you will be put in the comfy chair!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants