Skip to content

Commit cdfbacb

Browse files
committed
POP_JUMP_IF_NOT_NONE, POP_JUMP_IF_NONE
1 parent 76efcb4 commit cdfbacb

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

Python/bytecodes.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,18 +1978,17 @@ dummy_func(
19781978
}
19791979
}
19801980

1981-
// stack effect: (__0 -- )
1982-
inst(POP_JUMP_IF_NOT_NONE) {
1983-
PyObject *value = POP();
1981+
inst(POP_JUMP_IF_NOT_NONE, (value -- )) {
19841982
if (!Py_IsNone(value)) {
1983+
Py_DECREF(value);
19851984
JUMPBY(oparg);
19861985
}
1987-
Py_DECREF(value);
1986+
else {
1987+
_Py_DECREF_NO_DEALLOC(value);
1988+
}
19881989
}
19891990

1990-
// stack effect: (__0 -- )
1991-
inst(POP_JUMP_IF_NONE) {
1992-
PyObject *value = POP();
1991+
inst(POP_JUMP_IF_NONE, (value -- )) {
19931992
if (Py_IsNone(value)) {
19941993
_Py_DECREF_NO_DEALLOC(value);
19951994
JUMPBY(oparg);

Python/generated_cases.c.h

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/opcode_metadata.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ _PyOpcode_num_popped(int opcode, int oparg) {
237237
case POP_JUMP_IF_TRUE:
238238
return -1;
239239
case POP_JUMP_IF_NOT_NONE:
240-
return -1;
240+
return 1;
241241
case POP_JUMP_IF_NONE:
242-
return -1;
242+
return 1;
243243
case JUMP_IF_FALSE_OR_POP:
244244
return -1;
245245
case JUMP_IF_TRUE_OR_POP:
@@ -583,9 +583,9 @@ _PyOpcode_num_pushed(int opcode, int oparg) {
583583
case POP_JUMP_IF_TRUE:
584584
return -1;
585585
case POP_JUMP_IF_NOT_NONE:
586-
return -1;
586+
return 0;
587587
case POP_JUMP_IF_NONE:
588-
return -1;
588+
return 0;
589589
case JUMP_IF_FALSE_OR_POP:
590590
return -1;
591591
case JUMP_IF_TRUE_OR_POP:

0 commit comments

Comments
 (0)