Skip to content

Commit

Permalink
gh-108487: Move assert(self != NULL) down beyond DEOPT_IF() (#108510)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanrossum committed Aug 28, 2023
1 parent 4116592 commit 47d7eba
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
@@ -0,0 +1 @@
Move an assert that would cause a spurious crash in a devious case that should only trigger deoptimization.
2 changes: 1 addition & 1 deletion Python/bytecodes.c
Expand Up @@ -3346,9 +3346,9 @@ dummy_func(
inst(CALL_NO_KW_LIST_APPEND, (unused/1, unused/2, callable, self, args[oparg] -- unused)) {
ASSERT_KWNAMES_IS_NULL();
assert(oparg == 1);
assert(self != NULL);
PyInterpreterState *interp = tstate->interp;
DEOPT_IF(callable != 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) {
Expand Down
2 changes: 1 addition & 1 deletion Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 47d7eba

Please sign in to comment.