Skip to content

gh-105481: reduce repetition in opcode metadata generation code #107942

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 2 commits into from
Aug 14, 2023

Conversation

iritkatriel
Copy link
Member

@iritkatriel iritkatriel commented Aug 14, 2023

This will simplify adding more stuff to the metadata.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

Optional suggestion.

with self.metadata_item(
f"int _PyOpcode_num_{direction}(int opcode, int oparg, bool jump)", "", ""
):
self.out.emit(" switch(opcode) {")
Copy link
Member

Choose a reason for hiding this comment

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

You could use ‘with self.out.block()’ and indent() here instead of adding spaces to the statements.

@iritkatriel iritkatriel enabled auto-merge (squash) August 14, 2023 18:03
@iritkatriel iritkatriel merged commit 3974534 into python:main Aug 14, 2023
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