mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
GH-95045: gc untrack _lsprof.Profiler before deallocating it (GH-95315)
Automerge-Triggered-By: GH:pablogsal
(cherry picked from commit deacf391d7)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
parent
c72c1d65cb
commit
6b01fc7045
2 changed files with 2 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue