https://github.com/python/cpython/commit/836b2810d501fafdefb619e282c745e7d1dfa90f
commit: 836b2810d501fafdefb619e282c745e7d1dfa90f
branch: main
author: Pablo Galindo Salgado <[email protected]>
committer: pablogsal <[email protected]>
date: 2025-12-28T12:52:32Z
summary:
gh-136186: Fix more flaky tests in test_external_inspection (#143235)
files:
M Lib/test/test_external_inspection.py
diff --git a/Lib/test/test_external_inspection.py
b/Lib/test/test_external_inspection.py
index b1a3a8e65a9802..fe1b5fbe00bbc4 100644
--- a/Lib/test/test_external_inspection.py
+++ b/Lib/test/test_external_inspection.py
@@ -1752,7 +1752,12 @@ def main_work():
unwinder_gil = RemoteUnwinder(
p.pid, only_active_thread=True
)
- gil_traces = _get_stack_trace_with_retry(unwinder_gil)
+ # Use condition to retry until we capture a thread holding
the GIL
+ # (sampling may catch moments with no GIL holder on slow
CI)
+ gil_traces = _get_stack_trace_with_retry(
+ unwinder_gil,
+ condition=lambda t: sum(len(i.threads) for i in t) >=
1,
+ )
# Count threads
total_threads = sum(
_______________________________________________
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]