Skip to content

Commit

Permalink
Don't mess with END_FOR
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanrossum committed Mar 13, 2023
1 parent 68077f1 commit 12e85cf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
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 comments on commit 12e85cf

Please sign in to comment.