mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-123923: Defer refcounting for f_funcobj
in _PyInterpreterFrame
(#124026)
Use a `_PyStackRef` and defer the reference to `f_funcobj` when possible. This avoids some reference count contention in the common case of executing the same code object from multiple threads concurrently in the free-threaded build.
This commit is contained in:
parent
d3c76dff44
commit
f4997bb3ac
17 changed files with 143 additions and 137 deletions
|
@ -145,7 +145,7 @@ remove_globals(_PyInterpreterFrame *frame, _PyUOpInstruction *buffer,
|
|||
return 1;
|
||||
}
|
||||
PyObject *globals = frame->f_globals;
|
||||
PyFunctionObject *function = (PyFunctionObject *)frame->f_funcobj;
|
||||
PyFunctionObject *function = _PyFrame_GetFunction(frame);
|
||||
assert(PyFunction_Check(function));
|
||||
assert(function->func_builtins == builtins);
|
||||
assert(function->func_globals == globals);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue