Skip to content

Commit 088ccd8

Browse files
committed
Simplify code
1 parent 0465c9a commit 088ccd8

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

Python/optimizer_bytecodes.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -964,15 +964,14 @@ dummy_func(void) {
964964
int length = sym_tuple_length(cls);
965965
if (length != -1) {
966966
// We cannot do anything about tuples with unknown length
967-
bool all_items_known = true;
968-
PyObject *out = NULL;
967+
PyObject *out = Py_False;
969968
for (int i = 0; i < length; i++) {
970969
JitOptSymbol *item = sym_tuple_getitem(ctx, cls, i);
971970
if (!sym_has_type(item)) {
972971
// There is an unknown item in the tuple.
973972
// It could potentially define its own __instancecheck__
974973
// method so we can only deduce bool.
975-
all_items_known = false;
974+
out = NULL;
976975
break;
977976
}
978977
PyTypeObject *cls_o = (PyTypeObject *)sym_get_const(ctx, item);
@@ -984,11 +983,6 @@ dummy_func(void) {
984983
break;
985984
}
986985
}
987-
if (out == NULL && all_items_known) {
988-
// We haven't deduced True, but all items in the tuple are known
989-
// so we can deduce False.
990-
out = Py_False;
991-
}
992986
if (out) {
993987
sym_set_const(res, out);
994988
REPLACE_OP(this_instr, _POP_CALL_TWO_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)out);

Python/optimizer_cases.c.h

Lines changed: 2 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)