Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
Narrow the result type of _BINARY_OP_SUBSCR_USTR_INT to str in the JIT
  • Loading branch information
chris-eibl committed Jan 4, 2026
commit e7e3f40e35e915123b954066b3074c2f47925b4b
6 changes: 6 additions & 0 deletions Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@ dummy_func(void) {
i = sub_st;
}

op(_BINARY_OP_SUBSCR_USTR_INT, (str_st, sub_st -- res, s, i)) {
res = sym_new_type(ctx, &PyUnicode_Type);
s = str_st;
i = sub_st;
}

op(_GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS, (tuple_st, sub_st -- tuple_st, sub_st)) {
assert(sym_matches_type(tuple_st, &PyTuple_Type));
if (sym_is_const(ctx, sub_st)) {
Expand Down
10 changes: 7 additions & 3 deletions Python/optimizer_cases.c.h

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