Skip to content

gh-162197: Fix yank-pop tracking in PyREPL - #162252

Open
edvilme wants to merge 4 commits into
python:mainfrom
edvilme:pyrepl-yank
Open

edvilme wants to merge 4 commits into
python:mainfrom
edvilme:pyrepl-yank

Conversation

@edvilme

@edvilme edvilme commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Failed yank-pop commands are still recorded as valid yank-pop operations. So the next yank-pop command attempts to replace text that had not been inserted. This causes a negative cursor position calculation (and hence a traceback).

Instead, it should also report previous command was not a yank and return.

Failed `yank-pop` commands are still recorded as valid `yank-pop`
operations. So the next `yank-pop` command attempts to replace text that
had not been inserted. This causes a negative cursor position
calculation (and hence a traceback).

Instead, it should also report `previous command was not a yank` and
return.
Comment thread Lib/_pyrepl/commands.py
start = r.pos
r.insert(r.kill_ring[-1])

r.yank_span = (start, r.pos)

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.

Can we make this a bool? The code only checks whether the last yank or yank-pop succeeded.

@bedevere-app

bedevere-app Bot commented Nov 26, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants