🌐 AI搜索 & 代理 主页
Skip to content

Commit 7af5161

Browse files
committed
make test more reliable
1 parent 32facd8 commit 7af5161

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Lib/test/test_external_inspection.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,16 +2469,20 @@ def recv_msg():
24692469

24702470
def get_thread_frames(target_funcs):
24712471
"""Get frames for thread matching target functions."""
2472-
for _ in range(3):
2473-
try:
2472+
retries = 0
2473+
for _ in busy_retry(SHORT_TIMEOUT):
2474+
if retries >= 5:
2475+
break
2476+
retries += 1
2477+
# On Windows, ReadProcessMemory can fail with OSError
2478+
# (WinError 299) when frame pointers are in flux
2479+
with contextlib.suppress(RuntimeError, OSError):
24742480
traces = unwinder.get_stack_trace()
24752481
for interp in traces:
24762482
for thread in interp.threads:
24772483
funcs = [f.funcname for f in thread.frame_info]
24782484
if any(f in funcs for f in target_funcs):
24792485
return funcs
2480-
except RuntimeError:
2481-
pass
24822486
return None
24832487

24842488
# Track results for each sync point

0 commit comments

Comments
 (0)