Skip to content

Commit 421f499

Browse files
committed
Simplify logic
1 parent bc41fc3 commit 421f499

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

Python/optimizer_bytecodes.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -905,14 +905,12 @@ dummy_func(void) {
905905
// known types, meaning we can deduce either True or False
906906

907907
// The below check is equivalent to PyObject_TypeCheck(inst, cls)
908+
PyObject *out = Py_False;
908909
if (inst_type == cls_o || PyType_IsSubtype(inst_type, cls_o)) {
909-
sym_set_const(res, Py_True);
910-
REPLACE_OP(this_instr, _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)Py_True);
911-
}
912-
else {
913-
sym_set_const(res, Py_False);
914-
REPLACE_OP(this_instr, _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)Py_False);
910+
out = Py_True;
915911
}
912+
sym_set_const(res, out);
913+
REPLACE_OP(this_instr, _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)out);
916914
}
917915
}
918916

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)