mirror of https://github.com/python/cpython
GH-98543: Fix `asyncio.TaskGroup` to not keep reference to errors after raising ExceptionGroup (#98544)
This commit is contained in:
parent
5871e19942
commit
f4a14941e6
|
@ -128,11 +128,11 @@ class TaskGroup:
|
|||
# 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:
|
||||
|
|
Loading…
Reference in New Issue