Skip to content

Commit 47d7eba

Browse files
authored
gh-108487: Move assert(self != NULL) down beyond DEOPT_IF() (#108510)
1 parent 4116592 commit 47d7eba

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Move an assert that would cause a spurious crash in a devious case that should only trigger deoptimization.

Python/bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3346,9 +3346,9 @@ dummy_func(
33463346
inst(CALL_NO_KW_LIST_APPEND, (unused/1, unused/2, callable, self, args[oparg] -- unused)) {
33473347
ASSERT_KWNAMES_IS_NULL();
33483348
assert(oparg == 1);
3349-
assert(self != NULL);
33503349
PyInterpreterState *interp = tstate->interp;
33513350
DEOPT_IF(callable != interp->callable_cache.list_append, CALL);
3351+
assert(self != NULL);
33523352
DEOPT_IF(!PyList_Check(self), CALL);
33533353
STAT_INC(CALL, hit);
33543354
if (_PyList_AppendTakeRef((PyListObject *)self, args[0]) < 0) {

Python/generated_cases.c.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)