Skip to content

Commit 10a03a0

Browse files
itamarojbower-fb
andcommitted
Fix test_task_exc_handler_correct_context
Co-authored-by: Jacob Bower <jbower@meta.com>
1 parent e7743f6 commit 10a03a0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/asyncio/tasks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ def __eager_start(self):
273273
finally:
274274
if self.done():
275275
self._coro = None
276+
self = None # Needed to break cycles when an exception occurs.
276277
else:
277278
_register_task(self)
278279

@@ -365,6 +366,8 @@ def __step_run_and_handle_result(self, exc):
365366
new_exc = RuntimeError(f'Task got bad yield: {result!r}')
366367
self._loop.call_soon(
367368
self.__step, new_exc, context=self._context)
369+
finally:
370+
self = None # Needed to break cycles when an exception occurs.
368371

369372
def __wakeup(self, future):
370373
try:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy