diff options
author | jhaydaman <33549221+jhaydaman@users.noreply.github.com> | 2018-05-30 07:15:06 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2018-05-30 07:15:06 (GMT) |
commit | 0a28c0d12ee7201de039ced4d815f57f1f8fd48c (patch) | |
tree | 9fa72f88b1f3035ea9fe5a4bde10215a432abe30 /Doc/library/concurrent.futures.rst | |
parent | bb9474f1fb2fc7c7ed9f826b78262d6a12b5f9e8 (diff) | |
download | cpython-0a28c0d12ee7201de039ced4d815f57f1f8fd48c.zip cpython-0a28c0d12ee7201de039ced4d815f57f1f8fd48c.tar.gz cpython-0a28c0d12ee7201de039ced4d815f57f1f8fd48c.tar.bz2 |
bpo-33238: Add InvalidStateError to concurrent.futures. (GH-7056)
Future.set_result and Future.set_exception now raise InvalidStateError
if the futures are not pending or running. This mirrors the behavior
of asyncio.Future, and prevents AssertionErrors in asyncio.wrap_future
when set_result is called multiple times.
Diffstat (limited to 'Doc/library/concurrent.futures.rst')
-rw-r--r-- | Doc/library/concurrent.futures.rst | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst index 707d24d..6934acc 100644 --- a/Doc/library/concurrent.futures.rst +++ b/Doc/library/concurrent.futures.rst @@ -380,6 +380,11 @@ The :class:`Future` class encapsulates the asynchronous execution of a callable. This method should only be used by :class:`Executor` implementations and unit tests. + .. versionchanged:: 3.8 + This method raises + :exc:`concurrent.futures.InvalidStateError` if the :class:`Future` is + already done. + .. method:: set_exception(exception) Sets the result of the work associated with the :class:`Future` to the @@ -388,6 +393,10 @@ The :class:`Future` class encapsulates the asynchronous execution of a callable. This method should only be used by :class:`Executor` implementations and unit tests. + .. versionchanged:: 3.8 + This method raises + :exc:`concurrent.futures.InvalidStateError` if the :class:`Future` is + already done. Module Functions ---------------- @@ -466,6 +475,13 @@ Exception classes .. versionadded:: 3.7 +.. exception:: InvalidStateError + + Raised when an operation is performed on a future that is not allowed + in the current state. + + .. versionadded:: 3.8 + .. currentmodule:: concurrent.futures.thread .. exception:: BrokenThreadPool |