]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-137400: Fix a crash when disabling profiling across all threads (gh-137471...
authorSam Gross <colesbury@gmail.com>
Mon, 11 Aug 2025 16:07:21 +0000 (12:07 -0400)
committerGitHub <noreply@github.com>
Mon, 11 Aug 2025 16:07:21 +0000 (16:07 +0000)
commite236568c0ea301591ca1517d39ce337e6ee0a48f
tree1086ae703ba0bb6134c288f22caa970820506ec1
parent63a949487840f9b4b1d81df3aba06230ca8e5c28
[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)
Lib/test/test_free_threading/test_monitoring.py
Misc/NEWS.d/next/Core and Builtins/2025-08-06-15-39-54.gh-issue-137400.xIw0zs.rst [new file with mode: 0644]
Python/legacy_tracing.c