Skip to content

gh-101925: Validate the output file "pegen.py" #101937

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Marwanmhks
Copy link

@Marwanmhks Marwanmhks commented Feb 15, 2023

@ghost
Copy link

ghost commented Feb 15, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@arhadthedev arhadthedev added the build The build process and cross-build label Feb 16, 2023
@arhadthedev
Copy link
Member

@gvanrossum, @pablogsal, @lysnikolaou (as PEG experts)

@arhadthedev arhadthedev added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Feb 16, 2023
@pablogsal
Copy link
Member

pablogsal commented Feb 16, 2023

You need to regenerate the parser files (one of the checks is failing).

Apart from that I am not sure this is really what we want. What this PR seems to be doing is validating that we can parse an empty string, which is somehow better than what we have now but it doesn't validate that the generated parser works correctly and you don't need to reach back to the previous one.

Maybe what we need here is a backup system so when the metagrammar is regenerated you can easily get back the previous one. In any case, what I normally do is just do git checkout HEAD path_to_grammar_parser and I get back the previous file.

@lysnikolaou what are your thoughts?

@lysnikolaou
Copy link
Member

Thanks for the PR, @Marwanmhks!

@pablogsal I agree! This is not really solving the problem of there being cases, where we need to fall back to the previous version of the metagrammar parser. But yeah, in general, is this a problem worth solving? I feel the answer is no, since the work-around of using git to just go back in time is so straightforward.

@pablogsal
Copy link
Member

But yeah, in general, is this a problem worth solving? I feel the answer is no, since the work-around of using git to just go back in time is so straightforward.

👍

@Marwanmhks
Copy link
Author

Without the fix, the build will succeed the first time, writing a bad output file, and it will fail every time thereafter, even if you restore the old metagrammar.gram, it would require to regenerate the grammar_parser.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review build The build process and cross-build interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants