This code runs fine under regular CPython 3.5:
import concurrent.futures
def job(text):
print(text)
with concurrent.futures.ProcessPoolExecutor(1) as pool:
pool.submit(job, "hello")
But if you run it as python -m doctest myfile.py
, it hangs. Changing submit(job
to submit(print
makes it not hang, as does using ThreadPoolExecutor
instead of ProcessPoolExecutor
.
Why does it hang when run under doctest?