gh-123923: Defer refcounting for f_executable in _PyInterpreterFrame (#123924)
Use a `_PyStackRef` and defer the reference to `f_executable` 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:
@@ -143,9 +143,8 @@ _PyEval_SetOpcodeTrace(
|
||||
bool enable
|
||||
) {
|
||||
assert(frame != NULL);
|
||||
assert(PyCode_Check(frame->f_frame->f_executable));
|
||||
|
||||
PyCodeObject *code = (PyCodeObject *)frame->f_frame->f_executable;
|
||||
PyCodeObject *code = _PyFrame_GetCode(frame->f_frame);
|
||||
_PyMonitoringEventSet events = 0;
|
||||
|
||||
if (_PyMonitoring_GetLocalEvents(code, PY_MONITORING_SYS_TRACE_ID, &events) < 0) {
|
||||
|
||||
Reference in New Issue
Block a user