Skip to content

gh-102654: Insert #line directives in generated_cases.c.h #102669

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 1 commit into from
Mar 15, 2023

Conversation

gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Mar 13, 2023

This behavior is optional, because in some extreme cases it may just make debugging harder. The tool defaults it to off, but it is on in Makefile.pre.in.

Also note that this makes diffs to generated_cases.c.h way noisier, since whenever you insert or delete a line in bytecodes.c, all subsequent #line directives will change.

Honestly I wonder if maybe we should keep it off and tell developers how to turn it on (maybe by environment variable) when they're developing instructions?

This behavior is optional, because in some extreme cases it
may just make debugging harder. The tool defaults it to off,
but it is on in Makefile.pre.in.

Also note that this makes diffs to generated_cases.c.h noisier,
since whenever you insert or delete a line in bytecodes.c,
all subsequent #line directives will change.
@corona10
Copy link
Member

corona10 commented Mar 14, 2023

I learn a new thing from this PR.
I was always curious about managing line numbers information for the auto-gen codes.

Looks good to me

Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

Changes look fine, in the context of the current design.
Ideally the changes would have been restricted to the formatter, but the current design prevents that.

Notes for future PR:

Passing tokens instead of strings to the Formatter would mean that the rest of the code doesn't need to care about line numbers.
Using tokens mean that we can parse DEOPT_IF, etc. in a more robust way than using a regex.

@gvanrossum gvanrossum merged commit 70185de into python:main Mar 15, 2023
@gvanrossum gvanrossum deleted the line-dirs branch March 15, 2023 15:37
Fidget-Spinner pushed a commit to Fidget-Spinner/cpython that referenced this pull request Mar 27, 2023
…on#102669)

This behavior is optional, because in some extreme cases it
may just make debugging harder. The tool defaults it to off,
but it is on in Makefile.pre.in.

Also note that this makes diffs to generated_cases.c.h noisier,
since whenever you insert or delete a line in bytecodes.c,
all subsequent #line directives will change.
warsaw pushed a commit to warsaw/cpython that referenced this pull request Apr 11, 2023
…on#102669)

This behavior is optional, because in some extreme cases it
may just make debugging harder. The tool defaults it to off,
but it is on in Makefile.pre.in.

Also note that this makes diffs to generated_cases.c.h noisier,
since whenever you insert or delete a line in bytecodes.c,
all subsequent #line directives will change.
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.

4 participants