gh-128002: simplify all_tasks to use PyList_Extend instead of manual iteration
#129942
+7
−18
PyList_Extend instead of manual iteration
#129942