Skip to content

Commit ae7f6ab

Browse files
committed
pythongh-128421: Fix performance regerssion from adding locks to frames
The recent PR pythongh-131479 added locking to `take_ownership` in the free threading build. The cost is not really the locking -- that path isn't taken frequently -- but the inlined code causes extra register spills and slows down RETURN_VALUE, even when it's not taken. Mark `take_ownership` as `Py_NO_INLINE` to avoid the regression.
1 parent 8ada7a9 commit ae7f6ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/frame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ _PyFrame_MakeAndSetFrameObject(_PyInterpreterFrame *frame)
4444
return f;
4545
}
4646

47-
static void
47+
static void Py_NO_INLINE
4848
take_ownership(PyFrameObject *f, _PyInterpreterFrame *frame)
4949
{
5050
Py_BEGIN_CRITICAL_SECTION(f);

0 commit comments

Comments
 (0)