-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Improve AST safety parsing error message #2304
Improve AST safety parsing error message #2304
Conversation
Oops. Didn't realise tests wouldn't run in a draft! |
Not sure what's going on with the mypy error. Can look in more detail in a few hours. |
I said this on PyDis but I'll say it here for the record and also just in case someone misses it:
The easiest solution would be just adding an assert that makes sure we're running on 3.8 in that branch. Other than that, I can't think of a solution that wouldn't require redoing and restructuring the patch which is kinda defeating the point :/ edit: and yes mypy is configured to treat the runtime version as 3.6: Line 5 in a2b5ba2
|
Thanks for digging around! I see now why the error happens only now. So a couple of things we could do:
I'll leave it up to you! |
I corrected the parsing logic now! I think this could be ready for another round of review (hopefully the last as well) 👌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any issue with this and it's a nice readability improvement while implementing a nice enhancement. Thank you!
Closes #2178, alternative to #2218: This PR continues on the work of Hasan Ramezani in the alternative PR to improve the error messages when parsing formatted AST. His original commit is till at the beginning of the branch, which I then modified (Thank you for the initial push!)
A number of non-obvious details and questions:
ast
and then bytyped_ast
. On Discord we determined this was an accident so I removed it.Everything's in separate commits for an easier review. I'll leave this as a draft at least until the Mypy issue has been resolved.