diff options
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2023-08-26-04-33-18.gh-issue-108487.aUFxqf.rst | 1 | ||||
-rw-r--r-- | Python/bytecodes.c | 2 | ||||
-rw-r--r-- | Python/generated_cases.c.h | 2 |
3 files changed, 3 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-08-26-04-33-18.gh-issue-108487.aUFxqf.rst b/Misc/NEWS.d/next/Core and Builtins/2023-08-26-04-33-18.gh-issue-108487.aUFxqf.rst new file mode 100644 index 0000000..1117bcd --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-08-26-04-33-18.gh-issue-108487.aUFxqf.rst @@ -0,0 +1 @@ +Change an assert that would cause a spurious crash in a devious case that should only trigger deoptimization. diff --git a/Python/bytecodes.c b/Python/bytecodes.c index dc2ae22..5e80e06 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -2992,9 +2992,9 @@ dummy_func( inst(CALL_NO_KW_LIST_APPEND, (unused/1, unused/2, method, self, args[oparg] -- unused)) { assert(kwnames == NULL); assert(oparg == 1); - assert(method != NULL); PyInterpreterState *interp = _PyInterpreterState_GET(); DEOPT_IF(method != interp->callable_cache.list_append, CALL); + assert(self != NULL); DEOPT_IF(!PyList_Check(self), CALL); STAT_INC(CALL, hit); if (_PyList_AppendTakeRef((PyListObject *)self, args[0]) < 0) { diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index b0a363c..a3c0495 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -4248,9 +4248,9 @@ #line 2993 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); - assert(method != NULL); PyInterpreterState *interp = _PyInterpreterState_GET(); DEOPT_IF(method != interp->callable_cache.list_append, CALL); + assert(self != NULL); DEOPT_IF(!PyList_Check(self), CALL); STAT_INC(CALL, hit); if (_PyList_AppendTakeRef((PyListObject *)self, args[0]) < 0) { |