gh-132011: Fix crash on invalid CALL_LIST_APPEND deoptimization (#132018)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
sobolevn 2025-04-06 19:10:39 +03:00 committed by GitHub
parent 42e3a8410b
commit c0661df42a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 32 additions and 4 deletions

View file

@ -4235,7 +4235,7 @@ dummy_func(
PyInterpreterState *interp = tstate->interp;
DEOPT_IF(callable_o != interp->callable_cache.list_append);
assert(self_o != NULL);
DEOPT_IF(self_o == NULL);
DEOPT_IF(!PyList_Check(self_o));
DEOPT_IF(!LOCK_OBJECT(self_o));
STAT_INC(CALL, hit);

View file

@ -5710,7 +5710,10 @@
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
}
assert(self_o != NULL);
if (self_o == NULL) {
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
}
if (!PyList_Check(self_o)) {
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();

View file

@ -3265,7 +3265,11 @@
assert(_PyOpcode_Deopt[opcode] == (CALL));
JUMP_TO_PREDICTED(CALL);
}
assert(self_o != NULL);
if (self_o == NULL) {
UPDATE_MISS_STATS(CALL);
assert(_PyOpcode_Deopt[opcode] == (CALL));
JUMP_TO_PREDICTED(CALL);
}
if (!PyList_Check(self_o)) {
UPDATE_MISS_STATS(CALL);
assert(_PyOpcode_Deopt[opcode] == (CALL));