Skip to content

Commit e7e3f40

Browse files
committed
Narrow the result type of _BINARY_OP_SUBSCR_USTR_INT to str in the JIT
1 parent 6ad8076 commit e7e3f40

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Python/optimizer_bytecodes.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,12 @@ dummy_func(void) {
334334
i = sub_st;
335335
}
336336

337+
op(_BINARY_OP_SUBSCR_USTR_INT, (str_st, sub_st -- res, s, i)) {
338+
res = sym_new_type(ctx, &PyUnicode_Type);
339+
s = str_st;
340+
i = sub_st;
341+
}
342+
337343
op(_GUARD_BINARY_OP_SUBSCR_TUPLE_INT_BOUNDS, (tuple_st, sub_st -- tuple_st, sub_st)) {
338344
assert(sym_matches_type(tuple_st, &PyTuple_Type));
339345
if (sym_is_const(ctx, sub_st)) {

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)