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

IndentationError can hide unmatched ')' #13099

Open
markkong opened this issue Aug 19, 2021 · 1 comment
Open

IndentationError can hide unmatched ')' #13099

markkong opened this issue Aug 19, 2021 · 1 comment

Comments

@markkong
Copy link

Here is a small working example: Paste (either using a keyboard shortcut or %paste, but you can't type it in line by line because it returns on the first line on which the total number of close parentheses so far equals the number of open parentheses so far, so it won't let you type past "(spam,") the following into an ipython shell:

)
(spam,
  ham)
(eggs,
 beans)

I expect it to give me a SyntaxError showing the unmatched ')', but instead I get

IndentationError: unindent does not match any outer indentation level

(and it points to the last line).

(A slightly smaller working example is

)
(spam,
  ham)
(eggs,
 beans

)

@MrMino
Copy link
Member

MrMino commented Aug 31, 2021

Indeed, this is IPython-specific behavior. It's undesirable, so I'll mark it as a bug.

For people who'd like to fix it: to see what happens, you can call %debug right afterwards, and it should point you right at the place where the unwanted behavior stems from (IPython.core.inputtransformer2).

Reproducible on current master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants