https://github.com/python/cpython/commit/3db7bf2d180be5475266411b62114c28a0d4f92c
commit: 3db7bf2d180be5475266411b62114c28a0d4f92c
branch: main
author: yihong <[email protected]>
committer: pablogsal <[email protected]>
date: 2025-12-08T04:45:04Z
summary:
gh-142207: remove assertions incompatible under `profiling.sampling` (#142331)
files:
A Misc/NEWS.d/next/Library/2025-12-06-13-19-43.gh-issue-142207.x_X9oH.rst
M 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
index 00000000000000..69ca8c41ac9b8b
--- /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 69819eb8dcd645..774338f9dc241e 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);
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]