Skip to content

GH-131498: Cases generator: Parse down to C statement level. #131948

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

Merged
merged 14 commits into from
Apr 2, 2025

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Mar 31, 2025

This PR enhances the cases generator parser to parse instructions and labels down to C statement level.

This:

  • Simplifies the rest of the code generator.
  • Enables us to treat #if conditionals like normal if statements ensuring that the free-threading and default builds have the same properties and are properly understood by the code generator.

Because we are now parsing the source, rather than simply tokenizing it, the output no longer contains the comments present in the original.

raise NotImplementedError()


@dataclass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe to reduce memory footprint, use slots=True

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is worth it to save a few kbytes.

@markshannon markshannon marked this pull request as ready for review April 2, 2025 13:57
@markshannon markshannon merged commit ad053d8 into python:main Apr 2, 2025
75 checks passed
seehwan pushed a commit to seehwan/cpython that referenced this pull request Apr 16, 2025
…ythonGH-131948)

* Parse down to statement level in the cases generator

* Add handling for #if macros, treating them much like normal ifs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants