Skip to content

Commit 8d9cbfe

Browse files
committed
fixup! Handle process exiting during sampling
1 parent b42812e commit 8d9cbfe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/test_sample_profiler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,8 +1610,9 @@ def test_is_process_running(self):
16101610
profiler = SampleProfiler(pid=proc.pid, sample_interval_usec=1000, all_threads=False)
16111611

16121612
self.assertTrue(profiler._is_process_running())
1613-
proc.wait()
1614-
self.assertFalse(profiler._is_process_running())
1613+
1614+
# Exit the context manager to ensure the process is terminated
1615+
self.assertFalse(profiler._is_process_running())
16151616

16161617
@unittest.skipUnless(sys.platform == "linux", "Only valid on Linux")
16171618
def test_esrch_signal_handling(self):

0 commit comments

Comments
 (0)