Skip to content

Commit

Permalink
pythonGH-98543: Fix asyncio.TaskGroup to not keep reference to erro…
Browse files Browse the repository at this point in the history
…rs after raising ExceptionGroup (python#98544)
  • Loading branch information
kumaraditya303 committed Oct 22, 2022
1 parent 5871e19 commit f4a1494
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Lib/asyncio/taskgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ async def __aexit__(self, et, exc, tb):
# Exceptions are heavy objects that can have object
# cycles (bad for GC); let's not keep a reference to
# a bunch of them.
errors = self._errors
self._errors = None

me = BaseExceptionGroup('unhandled errors in a TaskGroup', errors)
raise me from None
try:
me = BaseExceptionGroup('unhandled errors in a TaskGroup', self._errors)
raise me from None
finally:
self._errors = None

def create_task(self, coro, *, name=None, context=None):
if not self._entered:
Expand Down

0 comments on commit f4a1494

Please sign in to comment.