File tree 1 file changed +7
-18
lines changed
1 file changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -4102,6 +4102,12 @@ _asyncio_all_tasks_impl(PyObject *module, PyObject *loop)
4102
4102
Py_DECREF (loop );
4103
4103
return NULL ;
4104
4104
}
4105
+ if (PyList_Extend (tasks , state -> non_asyncio_tasks ) < 0 ) {
4106
+ Py_DECREF (tasks );
4107
+ Py_DECREF (loop );
4108
+ return NULL ;
4109
+ }
4110
+
4105
4111
PyInterpreterState * interp = PyInterpreterState_Get ();
4106
4112
// Stop the world and traverse the per-thread linked list
4107
4113
// of asyncio tasks for every thread, as well as the
@@ -4127,24 +4133,7 @@ _asyncio_all_tasks_impl(PyObject *module, PyObject *loop)
4127
4133
Py_DECREF (loop );
4128
4134
return NULL ;
4129
4135
}
4130
- PyObject * scheduled_iter = PyObject_GetIter (state -> non_asyncio_tasks );
4131
- if (scheduled_iter == NULL ) {
4132
- Py_DECREF (tasks );
4133
- Py_DECREF (loop );
4134
- return NULL ;
4135
- }
4136
- PyObject * item ;
4137
- while ((item = PyIter_Next (scheduled_iter )) != NULL ) {
4138
- if (PyList_Append (tasks , item ) < 0 ) {
4139
- Py_DECREF (tasks );
4140
- Py_DECREF (loop );
4141
- Py_DECREF (item );
4142
- Py_DECREF (scheduled_iter );
4143
- return NULL ;
4144
- }
4145
- Py_DECREF (item );
4146
- }
4147
- Py_DECREF (scheduled_iter );
4136
+
4148
4137
// All the tasks are now in the list, now filter the tasks which are done
4149
4138
PyObject * res = PySet_New (NULL );
4150
4139
if (res == NULL ) {
You can’t perform that action at this time.
0 commit comments