]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-141617: clarify `concurrent.futures.ThreadPoolExecutor` deadlock example...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 9 Mar 2026 16:43:01 +0000 (17:43 +0100)
committerGitHub <noreply@github.com>
Mon, 9 Mar 2026 16:43:01 +0000 (16:43 +0000)
gh-141617: clarify `concurrent.futures.ThreadPoolExecutor` deadlock example (GH-141620)

---------
(cherry picked from commit 171133aa84cd2fa8738bdbb0c76435645810e8d3)

Co-authored-by: Yashraj <yashrajpala8@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Doc/library/concurrent.futures.rst

index 09d7a0d0ec21c335d2774c305fba2135345b00ea..86d3a9566d9ed7666f353b35dc8b75f57e9d414a 100644 (file)
@@ -147,7 +147,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=())