-
Notifications
You must be signed in to change notification settings - Fork 629
Restore compatibility with Python 3.9's legacy LL(1) parser yet again #4426
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
Restore compatibility with Python 3.9's legacy LL(1) parser yet again #4426
Conversation
|
I don't want to have to do this again, so we need a CI config which will test on the LL1 parser before I'll be happy to merge this. |
I don't think there's much more to this other than setting up a normal Python 3.9 environment, and setting That said, I only tackled the with-statements in |
|
Yeah, I think this is just running our |
As a follow-up to 422425f, the legacy LL(1) parser also parses `with (expr1, expr2):` as simple with-statements, with a single tuple as the context manager expression. Such an expression can easily arise accidentally due to the use of an auto-formatter. Guard against this by rewriting these statements as nested with-statements and adding an appropriate comment about LL(1) parsability.
b83c52e to
6285f22
Compare
|
Rebased on The failed |
Liam-DeVoe
left a comment
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.
Looks good, thanks! (@Zac-HD I'll give you a bit to check my tox configuration if you want to)
|
[I was going to merge this now, but realized it requires a code-owner review] |
Fixes #4421, yet again, this time taking care of compound with-statements with parentheses, which Python 3.9/LL(1) would parse as simple with-statements with a tuple as the single context manager expression.
I don't know why this didn't trigger when I originally tested my fix in #4423, but it does now: on pretty much every
hypothesis.given(...), I get anAttributeErrorinhypothesis.internal.conjecture.engine.ConjectureRunner.run.This PR now splits up all compound with-statements into nested simple ones and adds a comment on why they shouldn't be combined again.
As before, I only tackle theI double-checked every with-statementsrcdirectory, not thetestsor otherwise.inI could find for false positives/negatives and forgotten constellations.src