SIGN IN SIGN UP

[3.13] gh-137400: Fix a crash when disabling profiling across all threads (gh-137471) (gh-137649)

The `PyEval_SetProfileAllThreads` function and other related functions
had a race condition on `tstate->c_profilefunc` that could lead to a
crash when disable profiling or tracing on all threads while another
thread is starting to profile or trace a a call.

There are still potential crashes when threads exit concurrently with
profiling or tracing be enabled/disabled across all threads.
(cherry picked from commit 362692852f13cdd1d33cc7ed35c0cbac7af1a785)
S
Sam Gross committed
e236568c0ea301591ca1517d39ce337e6ee0a48f
Parent: 63a9494
Committed by GitHub <noreply@github.com> on 8/11/2025, 4:07:21 PM