GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-131498: Cases generator: Parse down to C statement level. by markshannon · Pull Request #131948 · python/cpython

Conversation

@markshannon

@markshannon markshannon commented Mar 31, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

  • Issue: Top-of-stack caching in the interpreter #131498

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

stonebig reacted with heart emoji
All reactions
  • ❤️ 1 reaction
markshannon added 8 commits March 31, 2025 15:56
@markshannon
Parse down to statement level in the cases generator
7d1c536
@markshannon
Add handling for #if macros. Work in progress
f7cccf8
@markshannon
Handle variable definition through out parameters
0bf3686
@markshannon
Fixup declarations and test output
a7d137a
@markshannon
Fixup rebase
94562d2
@markshannon
error is nonlocal
94dc498
@markshannon
Remove extra braces in executor_cases.c.h
e8d902e
@markshannon
Fix type annotations
3d3cc0e
@bedevere-app bedevere-app Bot mentioned this pull request Mar 31, 2025
Top-of-stack caching in the interpreter #131498
Closed
@markshannon markshannon added the skip news label Mar 31, 2025
@markshannon
Fix type annotations
f787fe0
picnixz
picnixz reviewed Apr 1, 2025
View reviewed changes
Comment thread Tools/cases_generator/generators_common.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Tools/cases_generator/parsing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Tools/cases_generator/parsing.py
raise NotImplementedError()


@dataclass

@picnixz picnixz Apr 1, 2025

Copy link
Copy Markdown
Member

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.

Maybe to reduce memory footprint, use slots=True

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@markshannon markshannon Apr 2, 2025

Copy link
Copy Markdown
Member Author

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.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Tools/cases_generator/parsing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Tools/cases_generator/parsing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Tools/cases_generator/parsing.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

markshannon added 2 commits April 1, 2025 10:48
@markshannon
Address review comments
a5e731b
@markshannon
Whitespace
907d768
picnixz
picnixz reviewed Apr 1, 2025
View reviewed changes
Comment thread Tools/cases_generator/generators_common.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

markshannon added 2 commits April 1, 2025 11:01
@markshannon
Workaround MyPy's awful flow analysis.
cd59649
@markshannon
Fix typo
63e705e
@markshannon
markshannon marked this pull request as ready for review April 2, 2025 13:57
@markshannon
markshannon requested a review from Fidget-Spinner as a code owner April 2, 2025 13:57
@bedevere-app bedevere-app Bot added the awaiting core review label Apr 2, 2025
@markshannon
Merge branch 'main' into code-gen-add-parser
0cba46d
iritkatriel
iritkatriel approved these changes Apr 2, 2025
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Apr 2, 2025
@markshannon
markshannon merged commit ad053d8 into python:main Apr 2, 2025
@bedevere-app bedevere-app Bot removed the awaiting merge label Apr 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz left review comments
@iritkatriel iritkatriel iritkatriel approved these changes
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner Fidget-Spinner is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@markshannon @iritkatriel @picnixz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.