Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding >1 new line within a codeblock doesn't correctly match the indentation #119356

Closed
aelsayed95 opened this issue May 21, 2024 · 2 comments
Closed
Labels
topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error

Comments

@aelsayed95
Copy link
Contributor

aelsayed95 commented May 21, 2024

Bug report

Bug description:

Adding more than one new line within a codeblock doesn't correctly match the indentation the previous line's indentation:

For example if I start with the following codeblock:

>>> def f():
...     
...     a = 1
>>>

and modify it to add two additional new lines in-block, I end up with the following:

>>> def f():
...     
... 
... 
...     a = 1
...     
>>>

Note that now, lines 2,5 have indentation, but lines 3 and 4 have no indentation.
This doesn't match IPython's behaviour.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

@savannahostrowski
Copy link
Member

In case it's helpful, this is also reproducible on Fedora, using the Devcontainer configuration in the repo.

@lysnikolaou
Copy link
Contributor

Thanks for the issue @aelsayed95 and the confirmation @savannahostrowski!

This was fixed in #119606. Feel free to reopen in case you encounter this again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-repl Related to the interactive shell type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants