Skip to content

Commit 0bd1469

Browse files
Update concurrent.futures.rst (GH-14061)
This PR adds missing details in the [`concurrent.futures`](https://docs.python.org/3/library/concurrent.futures.html) documentation: * the mention that `Future.cancel` also returns `False` if the call finished running; * the mention of the states for `Future` that did not complete: pending or running. (cherry picked from commit 431478d) Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
1 parent 5292179 commit 0bd1469

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

Doc/library/concurrent.futures.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,10 @@ The :class:`Future` class encapsulates the asynchronous execution of a callable.
293293

294294
.. method:: cancel()
295295

296-
Attempt to cancel the call. If the call is currently being executed and
297-
cannot be cancelled then the method will return ``False``, otherwise the
298-
call will be cancelled and the method will return ``True``.
296+
Attempt to cancel the call. If the call is currently being executed or
297+
finished running and cannot be cancelled then the method will return
298+
``False``, otherwise the call will be cancelled and the method will
299+
return ``True``.
299300

300301
.. method:: cancelled()
301302

@@ -401,8 +402,9 @@ Module Functions
401402
Wait for the :class:`Future` instances (possibly created by different
402403
:class:`Executor` instances) given by *fs* to complete. Returns a named
403404
2-tuple of sets. The first set, named ``done``, contains the futures that
404-
completed (finished or were cancelled) before the wait completed. The second
405-
set, named ``not_done``, contains uncompleted futures.
405+
completed (finished or cancelled futures) before the wait completed. The
406+
second set, named ``not_done``, contains the futures that did not complete
407+
(pending or running futures).
406408

407409
*timeout* can be used to control the maximum number of seconds to wait before
408410
returning. *timeout* can be an int or float. If *timeout* is not specified
@@ -433,7 +435,7 @@ Module Functions
433435

434436
Returns an iterator over the :class:`Future` instances (possibly created by
435437
different :class:`Executor` instances) given by *fs* that yields futures as
436-
they complete (finished or were cancelled). Any futures given by *fs* that
438+
they complete (finished or cancelled futures). Any futures given by *fs* that
437439
are duplicated will be returned once. Any futures that completed before
438440
:func:`as_completed` is called will be yielded first. The returned iterator
439441
raises a :exc:`concurrent.futures.TimeoutError` if :meth:`~iterator.__next__`

0 commit comments

Comments
 (0)