Skip to content

Commit 889cef0

Browse files
committed
mark task before it runs eagerly
2 parents dfa20f9 + 8e2864a commit 889cef0

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
On the free-threaded build, :func:`asyncio.all_tasks` no longer lost
2+
eager-started tasks when called from a thread other than the one running the
3+
event loop

Modules/_asynciomodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,6 +2190,9 @@ register_task(_PyThreadStateImpl *ts, TaskObj *task)
21902190
assert(task->task_node.prev != NULL);
21912191
return;
21922192
}
2193+
#ifdef Py_GIL_DISABLED
2194+
_PyObject_SetMaybeWeakref((PyObject *)task);
2195+
#endif
21932196
struct llist_node *head = &ts->asyncio_tasks_head;
21942197
llist_insert_tail(head, &task->task_node);
21952198
}

0 commit comments

Comments
 (0)