]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-142207: remove assertions incompatible under `profiling.sampling` (#142331)
authoryihong <zouzou0208@gmail.com>
Mon, 8 Dec 2025 04:45:04 +0000 (12:45 +0800)
committerGitHub <noreply@github.com>
Mon, 8 Dec 2025 04:45:04 +0000 (04:45 +0000)
Misc/NEWS.d/next/Library/2025-12-06-13-19-43.gh-issue-142207.x_X9oH.rst [new file with mode: 0644]
Modules/_remote_debugging/threads.c

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 (file)
index 0000000..69ca8c4
--- /dev/null
@@ -0,0 +1,2 @@
+Fix: profiling.sampling may cause assertion ``!(has_gil &&
+gil_requested)``
index 69819eb8dcd6453d90e1f39e4ee424a2f5d32c68..774338f9dc241e46a0669dc7d33d3cf064fa5c37 100644 (file)
@@ -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);