aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/optimizer_bytecodes.c
diff options
context:
space:
mode:
authorTomas R. <tomas.roun8@gmail.com>2025-04-08 17:22:54 +0200
committerGitHub <noreply@github.com>2025-04-08 08:22:54 -0700
commit71009cb835f9fa37647b0f2f7dcc0d6ca8aa36b6 (patch)
tree01d1df72cad314acc50c57fc925e98f125caecb8 /Python/optimizer_bytecodes.c
parent933c6653cba235b3af2250bb19713694b560c367 (diff)
downloadcpython-71009cb835f9fa37647b0f2f7dcc0d6ca8aa36b6.tar.gz
cpython-71009cb835f9fa37647b0f2f7dcc0d6ca8aa36b6.zip
GH-131798: Narrow the result type of _BINARY_OP_SUBSCR_STR_INT to str in the JIT (GH-132153)
Diffstat (limited to 'Python/optimizer_bytecodes.c')
-rw-r--r--Python/optimizer_bytecodes.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c
index d7b3564db1b..72dc2bbd44e 100644
--- a/Python/optimizer_bytecodes.c
+++ b/Python/optimizer_bytecodes.c
@@ -366,6 +366,10 @@ dummy_func(void) {
ctx->done = true;
}
+ op(_BINARY_OP_SUBSCR_STR_INT, (left, right -- res)) {
+ res = sym_new_type(ctx, &PyUnicode_Type);
+ }
+
op(_TO_BOOL, (value -- res)) {
int already_bool = optimize_to_bool(this_instr, ctx, value, &res);
if (!already_bool) {