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

bpo-42864: Improve error messages regarding unclosed parentheses #24161

Merged
merged 5 commits into from Jan 19, 2021

Conversation

@pablogsal
Copy link
Member

@pablogsal pablogsal commented Jan 8, 2021

https://bugs.python.org/issue42864

With this PR:

❯ cat lel.py
( 1+2
❯ ./python lel.py
  File "/home/pablogsal/github/python/master/lel.py", line 1
    ( 1+2
    ^
SyntaxError: '(' was never closed
~/github/python/master parens*
❯ cat ../a.py
x = {
~/github/python/master parens*
❯ ./python ../a.py
  File "/home/pablogsal/github/python/master/../a.py", line 1
    x = {
        ^
SyntaxError: '{' was never closed
@pablogsal
Copy link
Member Author

@pablogsal pablogsal commented Jan 8, 2021

I opened this as a draft to evaluate the idea. This probably needs #24140 to be fixed first for the tests to pass

@tirkarthi
Copy link
Member

@tirkarthi tirkarthi commented Jan 8, 2021

cc: @asottile

@pablogsal pablogsal force-pushed the pablogsal:parens branch 5 times, most recently from 823ba3e to 83572fc Jan 8, 2021
@pablogsal
Copy link
Member Author

@pablogsal pablogsal commented Jan 14, 2021

@lysnikolaou Do you mind taking a look at this when you have some time? I hope we can find some way to make this work 🤞

@@ -160,7 +160,6 @@ def test_incomplete(self):
ai("","eval")
ai("\n","eval")
ai("(","eval")
ai("(\n\n\n","eval")

This comment has been minimized.

@pablogsal

pablogsal Jan 14, 2021
Author Member

The EOF was reached in a different line before but now it raises the same error as the case without newlines (because the unopen parentheses are at the same place). I think we can allow that to happen.

@pablogsal pablogsal force-pushed the pablogsal:parens branch 2 times, most recently from 2a7d535 to b5bfa50 Jan 14, 2021
@pablogsal pablogsal marked this pull request as ready for review Jan 14, 2021
pablogsal added 3 commits Jan 8, 2021
@pablogsal pablogsal force-pushed the pablogsal:parens branch from 9550097 to e8bf6b9 Jan 14, 2021
pablogsal added 2 commits Jan 14, 2021
@pablogsal pablogsal force-pushed the pablogsal:parens branch from f4b52e8 to 241807e Jan 15, 2021
@pablogsal
Copy link
Member Author

@pablogsal pablogsal commented Jan 18, 2021

I would like this PR to be exposed as soon as possible to new users testing 3.10 so we can find as many problems with this as possible (if there are any), given that this actively exercises the code added in #24140. If nobody can review this by the end of the week I would like to go ahead and land it and we can tweak it later unless someone has concerns with this.

@lysnikolaou
Copy link
Contributor

@lysnikolaou lysnikolaou commented Jan 18, 2021

I'm so sorry for not replying sooner. I got distracted by other stuff and forgot about this. I'll find some time to review it by Wednesday evening. I hope that's okay and sorry again.

@pablogsal
Copy link
Member Author

@pablogsal pablogsal commented Jan 18, 2021

I hope that's okay and sorry again.

Absolutely! Don't worry, I totally understand and there is no problem. Also, don't feel pressured to review this if you don't have time. I wrote the message in case that nobody has time to review this in the short term because I wanted some early exposure for this :)

Also, tell me if you need more time to go through this and I can hold it for more time

Copy link
Contributor

@lysnikolaou lysnikolaou left a comment

LGTM! 🚀 Great work!

Do the Windows warnings bother us or is it okay to merge with those?

@pablogsal
Copy link
Member Author

@pablogsal pablogsal commented Jan 19, 2021

Do the Windows warnings bother us or is it okay to merge with those?

I would merge and then investigate the proper way to fix it. It probably requires a cast or changing the type of the parent stack but maybe it requires changes somewhere else due to type inconsistency across these fields and I prefer to investigate separately if that's ok with you :)

@lysnikolaou
Copy link
Contributor

@lysnikolaou lysnikolaou commented Jan 19, 2021

Do the Windows warnings bother us or is it okay to merge with those?

I would merge and then investigate the proper way to fix it. It probably requires a cast or changing the type of the parent stack but maybe it requires changes somewhere else due to type inconsistency across these fields and I prefer to investigate separately if that's ok with you :)

Yup. Go!

@pablogsal pablogsal merged commit d6d6371 into python:master Jan 19, 2021
11 checks passed
11 checks passed
Docs
Details
Check for source changes
Details
Check if generated files are up to date
Details
Windows (x86)
Details
Windows (x64) Windows (x64)
Details
macOS
Details
Ubuntu
Details
Azure Pipelines PR #20210115.4 succeeded
Details
Travis CI - Pull Request Build Passed
Details
bedevere/issue-number Issue number 42864 found
Details
bedevere/news News entry found in Misc/NEWS.d
@pablogsal
Copy link
Member Author

@pablogsal pablogsal commented Jan 20, 2021

Yup. Go!

Let's see how many weird edge cases we found after this 😆

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

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.