From: Yashraj Date: Mon, 9 Mar 2026 16:30:00 +0000 (+0530) Subject: gh-141617: clarify `concurrent.futures.ThreadPoolExecutor` deadlock example (#141620) X-Git-Tag: v3.15.0a7~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=171133aa84cd2fa8738bdbb0c76435645810e8d3;p=thirdparty%2FPython%2Fcpython.git gh-141617: clarify `concurrent.futures.ThreadPoolExecutor` deadlock example (#141620) --------- Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst index 3ea24ea77004..a32c38283134 100644 --- a/Doc/library/concurrent.futures.rst +++ b/Doc/library/concurrent.futures.rst @@ -156,7 +156,9 @@ And:: print(f.result()) executor = ThreadPoolExecutor(max_workers=1) - executor.submit(wait_on_future) + future = executor.submit(wait_on_future) + # Note: calling future.result() would also cause a deadlock because + # the single worker thread is already waiting for wait_on_future(). .. class:: ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())