diff --git a/Lib/test/test_free_threading/test_monitoring.py b/Lib/test/test_free_threading/test_monitoring.py index c3d0a2bcea5c17..cb15ca2b668e19 100644 --- a/Lib/test/test_free_threading/test_monitoring.py +++ b/Lib/test/test_free_threading/test_monitoring.py @@ -62,17 +62,9 @@ def test_instrumentation(self): self.after_threads() - while True: - any_alive = False - for t in threads: - if t.is_alive(): - any_alive = True - break - - if not any_alive: - break - - self.during_threads() + # Fix:use join() instead of is_alive() + for t in threads: + t.join() self.after_test() @@ -130,6 +122,8 @@ def callback(self, *args): self.called = True def after_test(self): + # 修复:确保测试结束后监控被禁用 + monitoring.set_events(self.tool_id, 0) self.assertTrue(self.called) def during_threads(self):
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: