Improve AST safety parsing error message#2304
Improve AST safety parsing error message#2304JelleZijlstra merged 9 commits intopsf:mainfrom felix-hilden:improve-ast-parsing-errors
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) 👌 |
ichard26
left a comment
There was a problem hiding this comment.
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:
astand 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.