Skip to content

Conversation

saucoide
Copy link
Contributor

@saucoide saucoide commented Jul 14, 2024

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

This adds 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 :)

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

This add a few extra checks to allow extending when in an indented
block, and tests for a few examples
@bedevere-app
Copy link

bedevere-app bot commented Jul 14, 2024

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
Copy link

bedevere-app bot commented Jul 14, 2024

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.

@ambv ambv added skip news topic-repl Related to the interactive shell labels Jul 15, 2024
@ambv ambv merged commit 7d111da into python:main Jul 15, 2024
@ambv ambv added the needs backport to 3.13 bugs and security fixes label Jul 15, 2024
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 15, 2024
…t blocks are pasted (pythonGH-121757)

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

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

(cherry picked from commit 7d111da)

Co-authored-by: saucoide <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jul 15, 2024

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

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jul 15, 2024
ambv added a commit that referenced this pull request Jul 16, 2024
…nt blocks are pasted (GH-121757) (GH-121825)

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 adds a few extra checks to allow extending when in an indented
block, and tests for a few examples.

(cherry picked from commit 7d111da)

Co-authored-by: saucoide <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
@saucoide
Copy link
Contributor Author

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

estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
…t blocks are pasted (pythonGH-121757)

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

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

Co-authored-by: Łukasz Langa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news topic-repl Related to the interactive shell
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants