gh-128552: fix refcycles in eager task creation (#128553)

This commit is contained in:
Thomas Grainger 2025-01-07 11:44:57 +00:00 committed by GitHub
parent 6ea04da270
commit 61b9811ac6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 71 additions and 6 deletions

View file

@ -477,7 +477,12 @@ class BaseEventLoop(events.AbstractEventLoop):
task.set_name(name)
return task
try:
return task
finally:
# gh-128552: prevent a refcycle of
# task.exception().__traceback__->BaseEventLoop.create_task->task
del task
def set_task_factory(self, factory):
"""Set a task factory that will be used by loop.create_task().