◐ Shell
clean mode source ↗

[3.13] gh-137400: Fix thread-safety issues when profiling all threads (gh-137518) by colesbury · Pull Request #137733 · python/cpython

…hreads (pythongh-137518)

There were a few thread-safety issues when profiling or tracing all
threads via PyEval_SetProfileAllThreads or PyEval_SetTraceAllThreads:

* The loop over thread states could crash if a thread exits concurrently
  (in both the free threading and default build)
* The modification of `c_profilefunc` and `c_tracefunc` wasn't
  thread-safe on the free threading build.
(cherry picked from commit a10152f)

Co-authored-by: Sam Gross <colesbury@gmail.com>

This was referenced

Aug 13, 2025

@colesbury

added 2 commits

September 15, 2025 08:04

@Yhg1s

markshannon

@colesbury