From ade0ef80d24e847606cb565187d30023e09e5017 Mon Sep 17 00:00:00 2001 From: yihong0618 Date: Sat, 6 Dec 2025 13:20:47 +0800 Subject: [PATCH 1/2] fix: close issue #142207 by drop the assert Signed-off-by: yihong0618 --- .../Library/2025-12-06-13-19-43.gh-issue-142207.x_X9oH.rst | 2 ++ Modules/_remote_debugging/threads.c | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2025-12-06-13-19-43.gh-issue-142207.x_X9oH.rst 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 00000000000000..39f1b2e074175c --- /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 assertssertion `!(has_gil && +gil_requested)' diff --git a/Modules/_remote_debugging/threads.c b/Modules/_remote_debugging/threads.c index 99147b01a1b9ed..83afe07e22809c 100644 --- a/Modules/_remote_debugging/threads.c +++ b/Modules/_remote_debugging/threads.c @@ -335,12 +335,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); From 82b16d80909a25b17527cda4159900303d1ae2e8 Mon Sep 17 00:00:00 2001 From: yihong0618 Date: Sat, 6 Dec 2025 14:06:07 +0800 Subject: [PATCH 2/2] fix: make news format right Signed-off-by: yihong0618 --- .../Library/2025-12-06-13-19-43.gh-issue-142207.x_X9oH.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 index 39f1b2e074175c..69ca8c41ac9b8b 100644 --- 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 @@ -1,2 +1,2 @@ -Fix: profiling.sampling may cause assertssertion `!(has_gil && -gil_requested)' +Fix: profiling.sampling may cause assertion ``!(has_gil && +gil_requested)``