gh-156186: Fix PyREPL bracketed paste consuming the following newline - #157270
Open
vasiliyk wants to merge 1 commit into
Open
gh-156186: Fix PyREPL bracketed paste consuming the following newline#157270vasiliyk wants to merge 1 commit into
vasiliyk wants to merge 1 commit into
Conversation
vasiliyk
requested review from
ambv,
lysnikolaou and
pablogsal
as code owners
September 10, 2026 14:08
maurycy
reviewed
Sep 10, 2026
| def test_bracketed_paste_newline_after_end_marker(self): | ||
| # A newline arriving in the same read as the closing marker must | ||
| # execute the pasted block instead of being inserted as text. | ||
| # See #156186. |
Contributor
There was a problem hiding this comment.
nit
Suggested change
| # See #156186. | |
| # See gh-156186. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A newline sent right after a bracketed paste was inserted into the buffer instead of running the block, because
perform_bracketed_pastedrains all pending input and inserts everything, including what follows the closing marker.PR implements the fix proposed by @pablogsal in the issue:
perform_bracketed_pastenow accumulatesevent.raw, splits at the first closing marker, inserts the prefix, pushes the suffix back through the console.Windows needed two changes to make it work:
getpending()now fillsraw, andpush_char()is implemented on the event queue so the suffix path works there too.