summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorTomas R. <tomas.roun8@gmail.com>2025-04-05 22:56:01 (GMT)
committerGitHub <noreply@github.com>2025-04-05 22:56:01 (GMT)
commit85bc489b649fe261f9625163c684a69a470b3dc1 (patch)
tree43d078cac4313bfa7339f5dc881cec45a2196ed2 /Python
parentad6a032cebf59d1668caa7e726aa5da72e1cbb5c (diff)
downloadcpython-85bc489b649fe261f9625163c684a69a470b3dc1.zip
cpython-85bc489b649fe261f9625163c684a69a470b3dc1.tar.gz
cpython-85bc489b649fe261f9625163c684a69a470b3dc1.tar.bz2
GH-131798: Narrow the result of _CONTAINS_OP_SET to bool in the JIT (GH-132057)
Diffstat (limited to 'Python')
-rw-r--r--Python/optimizer_bytecodes.c4
-rw-r--r--Python/optimizer_cases.c.h6
2 files changed, 7 insertions, 3 deletions
diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c
index da36704..d7b3564 100644
--- a/Python/optimizer_bytecodes.c
+++ b/Python/optimizer_bytecodes.c
@@ -477,6 +477,10 @@ dummy_func(void) {
res = sym_new_type(ctx, &PyBool_Type);
}
+ op(_CONTAINS_OP_SET, (left, right -- res)) {
+ res = sym_new_type(ctx, &PyBool_Type);
+ }
+
op(_LOAD_CONST, (-- value)) {
PyObject *val = PyTuple_GET_ITEM(co->co_consts, this_instr->oparg);
int opcode = _Py_IsImmortal(val) ? _LOAD_CONST_INLINE_BORROW : _LOAD_CONST_INLINE;
diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h
index f5cd169..870c32d 100644
--- a/Python/optimizer_cases.c.h
+++ b/Python/optimizer_cases.c.h
@@ -1283,9 +1283,9 @@
}
case _CONTAINS_OP_SET: {
- JitOptSymbol *b;
- b = sym_new_not_null(ctx);
- stack_pointer[-2] = b;
+ JitOptSymbol *res;
+ res = sym_new_type(ctx, &PyBool_Type);
+ stack_pointer[-2] = res;
stack_pointer += -1;
assert(WITHIN_STACK_BOUNDS());
break;