Skip to content
Merged
Prev Previous commit
Next Next commit
Do not close callable stackref
  • Loading branch information
tomasr8 committed Jun 23, 2025
commit 81f9b443c833845fbf3c31f6a4bef413b8163a18
4 changes: 3 additions & 1 deletion Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5361,8 +5361,10 @@ dummy_func(
tier2 op(_SWAP_CALL_ONE_LOAD_CONST_INLINE_BORROW, (ptr/4, callable, null, arg -- value, a)) {
PyStackRef_CLOSE(arg);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here, right? Because we're leaving arg on the stack in a?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Veery late response 😅 but I changed and renamed this op to _SHUFFLE_2_LOAD_CONST_INLINE_BORROW since it's analogous to the recently added _SHUFFLE_3_LOAD_CONST_INLINE_BORROW. This also resolves the issue with closing the ref! :)

(void)null; // Silence compiler warnings about unused variables
(void)callable;
DEAD(null);
PyStackRef_CLOSE(callable);
DEAD(callable);
assert(_Py_IsImmortal(PyStackRef_AsPyObjectBorrow(callable)));
value = PyStackRef_FromPyObjectBorrow(ptr);
a = arg;
}
Expand Down
13 changes: 4 additions & 9 deletions Python/executor_cases.c.h

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