gh-124958: Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles ... (#125486)

* Revert "gh-125472: Revert "gh-124958: fix asyncio.TaskGroup and _PyFuture refcycles (#12… (#125476)"

This reverts commit e99650b80a.

* fix incompatability with gh-124392
This commit is contained in:
Thomas Grainger 2024-10-14 23:45:58 +01:00 committed by GitHub
parent 1bffd7a2a7
commit 0b28ea4a35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 157 additions and 15 deletions

View file

@ -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