You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression in 9.0.1 from 8.33.0 - No longer dedents inputs. #14818
Running ipython in the terminal if I copy and paste this block of code:
# Commentx=1
with the leading indentation on both lines, in 8.33.0 it works fine. IPython recognizes the code has consistent leading whitespace, presumably dedents it under the hood, and executes it.
In [1]: # Comment
...: x=1In [2]:
However, in 9.0.1
In [1]: # Comment
...: x=1
...:
CellIn[1], line2x=1^IndentationError: unexpectedindent
I'm not sure if this was intentional or not, but this is a major usability issue for me. My entire workflow is based around copy/pasting chunks of code. I've been working this way for 15 years. I've written libraries around it. There is a PR awaiting merge in CPython to add this dedent feature to "python -c".
If this is intentional, I beg the maintainers to reconsider. Otherwise, this is a major bug.
Tested on Ubuntu 24.04 on CPython 3.13.2 and 3.11.2
Activity
Carreau commentedon Mar 5, 2025
This is not intentional.
I'm not sure I'll have the time to bisect though.
Erotemic commentedon Mar 5, 2025
I can help with that.
The bad commit is: 2d3f2c6
I will see if it is an easy fix.
Interestingly the indentation needs to start with a comment for the bug to trigger:
The offending MR is: #14721 and corresponding issue is: #14242
Looking into this, it looks that the test added in the offending MR isn't being run correctly: https://github.com/ipython/ipython/blob/main/tests/test_inputtransformer2_line.py#L185
They define a new test case, but don't actually test it.
fix: transform inputs with dedent (#14822)