Skip to content
Snippets Groups Projects
Unverified Commit deacf391 authored by Kumar Aditya's avatar Kumar Aditya Committed by GitHub
Browse files

GH-95045: gc untrack _lsprof.Profiler before deallocating it (GH-95315)


Automerge-Triggered-By: GH:pablogsal
parent 78eb3f79
Branches
Tags
No related merge requests found
Fix GC crash when deallocating ``_lsprof.Profiler`` by untracking it before calling any callbacks. Patch by Kumar Aditya.
......@@ -747,6 +747,7 @@ profiler_traverse(ProfilerObject *op, visitproc visit, void *arg)
static void
profiler_dealloc(ProfilerObject *op)
{
PyObject_GC_UnTrack(op);
if (op->flags & POF_ENABLED) {
PyThreadState *tstate = _PyThreadState_GET();
if (_PyEval_SetProfile(tstate, NULL, NULL) < 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment