-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
bpo-42810: Mark jumps at end of if and try statements as artificial. #24091
bpo-42810: Mark jumps at end of if and try statements as artificial. #24091
Conversation
@@ -1528,6 +1535,11 @@ compiler_addop_j(struct compiler *c, int opcode, basicblock *b) | |||
return 0; \ | |||
} | |||
|
|||
#define ADDOP_JUMP_NOLINE(C, OP, O) { \ |
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.
Small suggestion (I haven't checked all the PR in detail): we could use something like ADDOP_ARTIFICIAL_JUMP
instead of ADDOP_JUMP_NOLINE
so is clear the kind of jump more than how it will behave
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 think I prefer NOLINE
to ARTIFICIAL
. NOLINE
explains what it does, ARTIFICIAL
explains why.
I'd prefer the code to say what it does, and leave the "why" to comments.
I'll add a comment to explain why the opcode should have no line number.
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.
Makes sense
Thanks for fixing it! The release dice were not in our favor: it missed being in 3.10.0a4 by one commit! |
…ythonGH-24091) * Mark jumps at end of if and try statements as artificial. * Update importlib * Add comment explaining the purpose of ADDOP_JUMP_NOLINE.
This PR marks jumps with no corresponding source token as artificial.
These jumps occur at the end of the body of an
if
statement, inand
/or
expression and intry
statements.Also fixes https://bugs.python.org/issue42803
Skipping NEWS as this PR is cleaning up a very recent regression.
https://bugs.python.org/issue42810