]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109832: concurrent.futures test_deadlock restores sys.stderr (#109887)
authorVictor Stinner <vstinner@python.org>
Tue, 26 Sep 2023 10:43:45 +0000 (12:43 +0200)
committerGitHub <noreply@github.com>
Tue, 26 Sep 2023 10:43:45 +0000 (12:43 +0200)
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().

Lib/test/test_concurrent_futures/test_deadlock.py

index a76e075c3be18060811f12100d3c51a26335378c..af702542081ad9193e79e011a93372604e0e4557 100644 (file)
@@ -145,6 +145,9 @@ class ExecutorDeadlockTest:
         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())
 
@@ -180,6 +183,9 @@ class ExecutorDeadlockTest:
         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,