summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorjhaydaman <33549221+jhaydaman@users.noreply.github.com>2018-05-30 07:15:06 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2018-05-30 07:15:06 (GMT)
commit0a28c0d12ee7201de039ced4d815f57f1f8fd48c (patch)
tree9fa72f88b1f3035ea9fe5a4bde10215a432abe30 /Lib/asyncio
parentbb9474f1fb2fc7c7ed9f826b78262d6a12b5f9e8 (diff)
downloadcpython-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 'Lib/asyncio')
-rw-r--r--Lib/asyncio/base_futures.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/Lib/asyncio/base_futures.py b/Lib/asyncio/base_futures.py
index 5182884..bd65bee 100644
--- a/Lib/asyncio/base_futures.py
+++ b/Lib/asyncio/base_futures.py
@@ -1,17 +1,13 @@
__all__ = ()
-import concurrent.futures._base
+import concurrent.futures
import reprlib
from . import format_helpers
-Error = concurrent.futures._base.Error
CancelledError = concurrent.futures.CancelledError
TimeoutError = concurrent.futures.TimeoutError
-
-
-class InvalidStateError(Error):
- """The operation is not allowed in this state."""
+InvalidStateError = concurrent.futures.InvalidStateError
# States for Future.