Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-136186: Fix more flaky tests in test_external_inspection
  • Loading branch information
pablogsal committed Dec 28, 2025
commit 323ecfd60ae45b90bee633c73b60f9ba2118b276
7 changes: 6 additions & 1 deletion Lib/test/test_external_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading