From 9fb3133007bd5f6bc49ab4f437bc0babc76a7bcc Mon Sep 17 00:00:00 2001 From: Yashraj Date: Mon, 9 Mar 2026 22:00:00 +0530 Subject: [PATCH] gh-141617: clarify `concurrent.futures.ThreadPoolExecutor` deadlock example (GH-141620) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --------- (cherry picked from commit 171133aa84cd2fa8738bdbb0c76435645810e8d3) Co-authored-by: Yashraj Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> --- Doc/library/concurrent.futures.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst index 09d7a0d0ec21c3..86d3a9566d9ed7 100644 --- a/Doc/library/concurrent.futures.rst +++ b/Doc/library/concurrent.futures.rst @@ -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=())