We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8276c19 commit 81be6d2Copy full SHA for 81be6d2
Lib/test/test_external_inspection.py
@@ -1745,10 +1745,16 @@ def busy():
1745
pass
1746
break
1747
1748
+ attempts = 10
1749
try:
1750
unwinder = RemoteUnwinder(p.pid, all_threads=True, cpu_time=True)
- time.sleep(0.2) # Give a bit of time to let threads settle
1751
- traces = unwinder.get_stack_trace()
+ for _ in range(attempts):
1752
+ traces = unwinder.get_stack_trace()
1753
+ # Check if any thread is running
1754
+ if any(thread_info.status == 0 for interpreter_info in traces
1755
+ for thread_info in interpreter_info.threads):
1756
+ break
1757
+ time.sleep(0.5) # Give a bit of time to let threads settle
1758
except PermissionError:
1759
self.skipTest(
1760
"Insufficient permissions to read the stack trace"
0 commit comments