-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-42218: Correctly handle errors in left-recursive rules #23065
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-42218: Correctly handle errors in left-recursive rules #23065
Conversation
Left-recursive rules need to check for errors explicitly, since even if the rule returns NULL, the parsing might continue and lead to long-distance failures.
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.
Oh, great catch, @lysnikolaou! 🎣
Misc/NEWS.d/next/Core and Builtins/2020-10-31-17-50-23.bpo-42218.Dp_Z3v.rst
Outdated
Show resolved
Hide resolved
…18.Dp_Z3v.rst Co-authored-by: Pablo Galindo <[email protected]>
@lysnikolaou (For a different PR/issue) I was thinking that maybe we should add an |
That's a good idea, though every function might be a bit too much. Are we 100% sure that the assertion should apply to every single rule? |
Thanks @lysnikolaou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Sorry, @lysnikolaou, I could not cleanly backport this to |
…honGH-23065) Left-recursive rules need to check for errors explicitly, since even if the rule returns NULL, the parsing might continue and lead to long-distance failures. Co-authored-by: Pablo Galindo <[email protected]> (cherry picked from commit 02cdfc9)
GH-23066 is a backport of this pull request to the 3.9 branch. |
I am confident it applies to most of the functions if not all. The key here is that non of these functions should be called with the error indicator set, ever. As the assertion is also only on debug mode (and is just a simple check of an integer) I think the cost is not too elevated. The most annoying part is checking what functions don't make sense to include the check. |
Right, that's what I wanted to say before as well. Figuring out where might be a bit annoying, but I agree that it's definitely worth it. |
Ok, I will try to make a proposal PR soon :) |
Let me know, in case you don't find the bandwidth. I can take it up, if needed. |
…23065) (GH-23066) Left-recursive rules need to check for errors explicitly, since even if the rule returns NULL, the parsing might continue and lead to long-distance failures. Co-authored-by: Pablo Galindo <[email protected]> (cherry picked from commit 02cdfc9) Automerge-Triggered-By: GH:lysnikolaou
…23065) Left-recursive rules need to check for errors explicitly, since even if the rule returns NULL, the parsing might continue and lead to long-distance failures. Co-authored-by: Pablo Galindo <[email protected]>
Left-recursive rules need to check for errors explicitly, since
even if the rule returns NULL, the parsing might continue and lead
to long-distance failures.
https://bugs.python.org/issue42218