8000 gh-98831: Use DECREF_INPUTS() more by gvanrossum · Pull Request #102409 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-98831: Use DECREF_INPUTS() more #102409

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 3 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Don't mess with END_FOR
  • Loading branch information
gvanrossum committed Mar 13, 2023
commit 12e85cfc6a114d40d04528c6305efb78652ef12c
4 changes: 1 addition & 3 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,7 @@ dummy_func(
res = NULL;
}

inst(END_FOR, (second, first --)) {
DECREF_INPUTS();
}
macro(END_FOR) = POP_TOP + POP_TOP;

inst(UNARY_NEGATIVE, (value -- res)) {
res = PyNumber_Negative(value);
Expand Down
14 changes: 10 additions & 4 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Python/opcode_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
case PUSH_NULL:
return 0;
case END_FOR:
return 2;
return 1+1;
case UNARY_NEGATIVE:
return 1;
case UNARY_NOT:
Expand Down Expand Up @@ -390,7 +390,7 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
case PUSH_NULL:
return 1;
case END_FOR:
return 0;
return 0+0;
case UNARY_NEGATIVE:
return 1;
case UNARY_NOT:
Expand Down Expand Up @@ -735,7 +735,7 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = {
[LOAD_CONST__LOAD_FAST] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBIB },
[POP_TOP] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX },
[PUSH_NULL] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX },
[END_FOR] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX },
[END_FOR] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
[UNARY_NEGATIVE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX },
[UNARY_NOT] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX },
[UNARY_INVERT] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IX },
Expand Down
0