https://github.com/python/cpython/commit/4867f717e21c3b5f0ad0e81f950c69dac6c95e6e
commit: 4867f717e21c3b5f0ad0e81f950c69dac6c95e6e
branch: main
author: Pablo Galindo Salgado <[email protected]>
committer: pablogsal <[email protected]>
date: 2025-11-18T02:26:40Z
summary:

gh-140729: Fix subprocess handling in test_process_pool_executor_pickle 
(#141688)

files:
M Lib/test/test_profiling/test_sampling_profiler.py

diff --git a/Lib/test/test_profiling/test_sampling_profiler.py 
b/Lib/test/test_profiling/test_sampling_profiler.py
index 2d00173c22c419..c2cc2ddd48a02c 100644
--- a/Lib/test/test_profiling/test_sampling_profiler.py
+++ b/Lib/test/test_profiling/test_sampling_profiler.py
@@ -3311,6 +3311,8 @@ def test_native_frames_disabled(self):
         self.assertNotIn("<native>", output)
 
 
+@requires_subprocess()
+@skip_if_not_supported
 class TestProcessPoolExecutorSupport(unittest.TestCase):
     """
     Test that ProcessPoolExecutor works correctly with profiling.sampling.
@@ -3339,12 +3341,15 @@ def worker(x):
                     "-d", "5",
                     "-i", "100000",
                     script,
+                    stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE,
                     text=True
                 ) as proc:
-                    proc.wait(timeout=SHORT_TIMEOUT)
-                    stdout = proc.stdout.read()
-                    stderr = proc.stderr.read()
+                    try:
+                        stdout, stderr = 
proc.communicate(timeout=SHORT_TIMEOUT)
+                    except subprocess.TimeoutExpired:
+                        proc.kill()
+                        stdout, stderr = proc.communicate()
 
         if "PermissionError" in stderr:
             self.skipTest("Insufficient permissions for remote profiling")

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to