From 81488686ce5dedeccf60c0e0f290a548619ffa03 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 26 Sep 2023 12:43:45 +0200 Subject: [PATCH] gh-109832: concurrent.futures test_deadlock restores sys.stderr (GH-109887) test_error_at_task_unpickle() and test_error_during_result_unpickle_in_result_handler() now restore sys.stderr which is overriden by _raise_error_ignore_stderr(). (cherry picked from commit 2897142d2ec0930a8991af964c798b68fb6dcadd) Co-authored-by: Victor Stinner --- Lib/test/test_concurrent_futures/test_deadlock.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/test/test_concurrent_futures/test_deadlock.py b/Lib/test/test_concurrent_futures/test_deadlock.py index 6b78b360d15627..258772397ebea2 100644 --- a/Lib/test/test_concurrent_futures/test_deadlock.py +++ b/Lib/test/test_concurrent_futures/test_deadlock.py @@ -142,6 +142,9 @@ def test_exit_at_task_unpickle(self): self._check_crash(BrokenProcessPool, id, ExitAtUnpickle()) def test_error_at_task_unpickle(self): + # gh-109832: Restore stderr overriden by _raise_error_ignore_stderr() + self.addCleanup(setattr, sys, 'stderr', sys.stderr) + # Check problem occurring while unpickling a task on workers self._check_crash(BrokenProcessPool, id, ErrorAtUnpickle()) @@ -177,6 +180,9 @@ def test_error_during_result_pickle_on_worker(self): self._check_crash(PicklingError, _return_instance, ErrorAtPickle) def test_error_during_result_unpickle_in_result_handler(self): + # gh-109832: Restore stderr overriden by _raise_error_ignore_stderr() + self.addCleanup(setattr, sys, 'stderr', sys.stderr) + # Check problem occurring while unpickling a task in # the result_handler thread self._check_crash(BrokenProcessPool,