Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the PyFrame_FastToLocals and PyFrame_LocalsToFast calls from the trampoline call_target. #337

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pyinstrument/low_level/stat_profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ stat_profile_init(void)
static PyObject *
call_target(ProfilerState *pState, PyFrameObject *frame, int what, PyObject *arg)
{
PyFrame_FastToLocals(frame);
// note: we no longer call PyFrame_FastToLocals and PyFrame_LocalsToFast
// here, as it's only needed for python-level modification of locals,
// which a profiler doesn't need to do.

#if PY_VERSION_HEX >= 0x03090000
// vectorcall implementation could be faster, is available in Python 3.9
Expand All @@ -242,10 +244,9 @@ call_target(ProfilerState *pState, PyFrameObject *frame, int what, PyObject *arg
PyObject *result = PyObject_CallFunctionObjArgs(pState->target, (PyObject *) frame, whatstrings[what], arg == NULL ? Py_None : arg, NULL);
#endif

PyFrame_LocalsToFast(frame, 1);

if (result == NULL)
if (result == NULL) {
PyTraceBack_Here(frame);
}

return result;
}
Expand Down
Loading