If the `shutdown()` call happens before the worker thread starts executing
the task, then nothing will be printed to stdout.
(cherry picked from commit
7d1abe9502641a3602e9773aebc29ee56d8f40ae)
Co-authored-by: Sam Gross <colesbury@gmail.com>
# Errors in atexit hooks don't change the process exit code, check
# stderr manually.
self.assertFalse(err)
- self.assertEqual(out.strip(), b"apple")
+ # gh-116682: stdout may be empty if shutdown happens before task
+ # starts executing.
+ self.assertIn(out.strip(), [b"apple", b""])
class ProcessPoolShutdownTest(ExecutorShutdownTest):