Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix thread cache test
  • Loading branch information
pablogsal committed Dec 7, 2025
commit 13bd7e45f86e87609b82fc529411fa919a307ea2
24 changes: 11 additions & 13 deletions Lib/test/test_external_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2543,20 +2543,18 @@ def recv_msg():

def get_thread_frames(target_funcs):
"""Get frames for thread matching target functions."""
retries = 0
for _ in busy_retry(SHORT_TIMEOUT):
if retries >= 5:
break
retries += 1
# On Windows, ReadProcessMemory can fail with OSError
# (WinError 299) when frame pointers are in flux
with contextlib.suppress(RuntimeError, OSError):
for _ in range(self.MAX_TRIES):
try:
traces = unwinder.get_stack_trace()
for interp in traces:
for thread in interp.threads:
funcs = [f.funcname for f in thread.frame_info]
if any(f in funcs for f in target_funcs):
return funcs
except (RuntimeError, OSError):
time.sleep(0.1)
continue
all_threads = [t for i in traces for t in i.threads]
for thread in all_threads:
funcs = [f.funcname for f in thread.frame_info]
if any(f in funcs for f in target_funcs):
return funcs
time.sleep(0.1)
return None

# Track results for each sync point
Expand Down
Loading