From: yihong Date: Mon, 8 Dec 2025 04:45:04 +0000 (+0800) Subject: gh-142207: remove assertions incompatible under `profiling.sampling` (#142331) X-Git-Tag: v3.15.0a3~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3db7bf2d180be5475266411b62114c28a0d4f92c;p=thirdparty%2FPython%2Fcpython.git gh-142207: remove assertions incompatible under `profiling.sampling` (#142331) --- diff --git a/Misc/NEWS.d/next/Library/2025-12-06-13-19-43.gh-issue-142207.x_X9oH.rst b/Misc/NEWS.d/next/Library/2025-12-06-13-19-43.gh-issue-142207.x_X9oH.rst new file mode 100644 index 000000000000..69ca8c41ac9b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-12-06-13-19-43.gh-issue-142207.x_X9oH.rst @@ -0,0 +1,2 @@ +Fix: profiling.sampling may cause assertion ``!(has_gil && +gil_requested)`` diff --git a/Modules/_remote_debugging/threads.c b/Modules/_remote_debugging/threads.c index 69819eb8dcd6..774338f9dc24 100644 --- a/Modules/_remote_debugging/threads.c +++ b/Modules/_remote_debugging/threads.c @@ -339,12 +339,10 @@ unwind_stack_for_thread( #endif if (has_gil) { status_flags |= THREAD_STATUS_HAS_GIL; + // gh-142207 for remote debugging. + gil_requested = 0; } - // Assert that we never have both HAS_GIL and GIL_REQUESTED set at the same time - // This would indicate a race condition in the GIL state tracking - assert(!(has_gil && gil_requested)); - // Check CPU status long pthread_id = GET_MEMBER(long, ts, unwinder->debug_offsets.thread_state.thread_id);