summaryrefslogtreecommitdiff
path: root/Lib/asyncio/futures.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/asyncio/futures.py')
-rw-r--r--Lib/asyncio/futures.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py
index 98a5308ed0..9afda220bd 100644
--- a/Lib/asyncio/futures.py
+++ b/Lib/asyncio/futures.py
@@ -115,7 +115,10 @@ class Future:
def get_loop(self):
"""Return the event loop the Future is bound to."""
- return self._loop
+ loop = self._loop
+ if loop is None:
+ raise RuntimeError("Future object is not initialized.")
+ return loop
def cancel(self):
"""Cancel the future and schedule callbacks.