]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-141617: clarify `concurrent.futures.ThreadPoolExecutor` deadlock example (#141620)
authorYashraj <yashrajpala8@gmail.com>
Mon, 9 Mar 2026 16:30:00 +0000 (22:00 +0530)
committerGitHub <noreply@github.com>
Mon, 9 Mar 2026 16:30:00 +0000 (16:30 +0000)
---------

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

index 3ea24ea77004ad42ab8dbb0ea17119b5e3242c8e..a32c382831345457423c6a2cdfc7a1a68bb238cb 100644 (file)
@@ -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=())