The following functions needs to be made thread safe and atomic for free-threading for both pure python and C implementation:
Note that some of these were made thread safe in C impl #120974
The following classes needs to be thread safe for free-threading in C implementation:
Both of these classes are documented to be not thread safe but currently calling methods on these classes from multiple threads can crash the interpreter. The pure python implementation cannot crash the interpreter when called from multiple threads so changes are only needed for C implementation. Before making these thread safe in C I would gather some numbers for how much a difference the C implementation makes in free-threading and if it isn't much we can just disable the C extension for free-threading.
cc @colesbury
Linked PRs
The following functions needs to be made thread safe and atomic for free-threading for both pure python and C implementation:
asyncio._enter_taskasyncio._leave_taskasyncio._register_taskasyncio._unregister_taskasyncio._swap_current_taskasyncio.current_taskasyncio.all_tasksNote that some of these were made thread safe in C impl #120974
The following classes needs to be thread safe for free-threading in C implementation:
asyncio.Taskasyncio.FutureBoth of these classes are documented to be not thread safe but currently calling methods on these classes from multiple threads can crash the interpreter. The pure python implementation cannot crash the interpreter when called from multiple threads so changes are only needed for C implementation. Before making these thread safe in C I would gather some numbers for how much a difference the C implementation makes in free-threading and if it isn't much we can just disable the C extension for free-threading.
cc @colesbury
Linked PRs
asyncio.all_tasksagainst concurrent deallocations of tasks #128541_PyObject_SetMaybeWeakrefwhen creating tasks in asyncio #128885test_all_tasks_different_threadin asyncio #129267PyList_Extendinstead of manual iteration #129942asyncio.all_tasks#129943asyncio(GH-134324) #134362