diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/asyncio/taskgroups.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/asyncio/taskgroups.py b/Lib/asyncio/taskgroups.py index 5d5e2a8..911419e 100644 --- a/Lib/asyncio/taskgroups.py +++ b/Lib/asyncio/taskgroups.py @@ -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: |