summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/futures.py
diff options
context:
space:
mode:
authorThomas Grainger <tagrain@gmail.com>2024-10-14 15:19:56 (GMT)
committerGitHub <noreply@github.com>2024-10-14 15:19:56 (GMT)
commitd5dbbf4372cd3dbf3eead1cc70ddc4261c061fd9 (patch)
tree81f9098b3e6857cad85f38790a96765968b4074b /Lib/asyncio/futures.py
parent45df264f3ffbc0893cbfd257131d3abe21043786 (diff)
downloadcpython-d5dbbf4372cd3dbf3eead1cc70ddc4261c061fd9.zip
cpython-d5dbbf4372cd3dbf3eead1cc70ddc4261c061fd9.tar.gz
cpython-d5dbbf4372cd3dbf3eead1cc70ddc4261c061fd9.tar.bz2
gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#124959)
Diffstat (limited to 'Lib/asyncio/futures.py')
-rw-r--r--Lib/asyncio/futures.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py
index 5f6fa23..c95fce0 100644
--- a/Lib/asyncio/futures.py
+++ b/Lib/asyncio/futures.py
@@ -190,8 +190,7 @@ class Future:
the future is done and has an exception set, this exception is raised.
"""
if self._state == _CANCELLED:
- exc = self._make_cancelled_error()
- raise exc
+ raise self._make_cancelled_error()
if self._state != _FINISHED:
raise exceptions.InvalidStateError('Result is not ready.')
self.__log_traceback = False
@@ -208,8 +207,7 @@ class Future:
InvalidStateError.
"""
if self._state == _CANCELLED:
- exc = self._make_cancelled_error()
- raise exc
+ raise self._make_cancelled_error()
if self._state != _FINISHED:
raise exceptions.InvalidStateError('Exception is not set.')
self.__log_traceback = False