cpython icon indicating copy to clipboard operation
cpython copied to clipboard

gh-121610: pyrepl - handle extending blocks when multi-statement blocks are pasted

Open saucoide opened this issue 1 year ago • 2 comments

console.compile with the "single" param throws an exception when there are multiple statements, never allowing to adding newlines to a pasted code block (gh-121610)

This add a few extra checks to allow extending when in an indented block, and tests for a few examples

I moved the function out of the outer one to be able to test it more easily, the tests check for what i think is the "expected" behavior for when to add a newline vs executing but please check me on that :)

saucoide avatar Jul 14 '24 10:07 saucoide

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.

bedevere-app[bot] avatar Jul 14 '24 10:07 bedevere-app[bot]

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.

bedevere-app[bot] avatar Jul 14 '24 11:07 bedevere-app[bot]

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

miss-islington-app[bot] avatar Jul 15 '24 23:07 miss-islington-app[bot]

GH-121825 is a backport of this pull request to the 3.13 branch.

bedevere-app[bot] avatar Jul 15 '24 23:07 bedevere-app[bot]

.startswith() takes in a tuple 🤦 TIL, thanks :)

saucoide avatar Jul 16 '24 15:07 saucoide