Skip to content

Commit 445ec7d

Browse files
committed
gh-131798: Add JIT path for _BUILD_STRING
Signed-off-by: Manjusaka <[email protected]>
1 parent ab00ff4 commit 445ec7d

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

Python/optimizer_bytecodes.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,8 +920,15 @@ dummy_func(void) {
920920
}
921921

922922
op(_BUILD_STRING, (values[oparg] -- str)) {
923-
if (sym_is_const(ctx, values[oparg])) {
924-
PyObject *val = sym_get_const(ctx, values[oparg]);
923+
bool is_const = true;
924+
for (int i = 0; i < oparg; i++) {
925+
if (!sym_is_const(ctx, values[i])) {
926+
is_const = false;
927+
break;
928+
}
929+
}
930+
if (is_const) {
931+
PyObject *val = sym_get_const(ctx, values[0]);
925932
str = sym_new_const(ctx, val);
926933
Py_DecRef(val);
927934
}

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)