gh-121610: pyrepl - handle extending blocks when multi-statement blocks are pasted
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 :)
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.
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.
Thanks @saucoide for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. 🐍🍒⛏🤖
GH-121825 is a backport of this pull request to the 3.13 branch.
.startswith() takes in a tuple 🤦 TIL, thanks :)