File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -623,7 +623,6 @@ void slp_kill_tasks_with_stacks(PyThreadState *target_ts)
623623 */
624624 if (target_ts == NULL && tasklet_list ) {
625625 PyThreadState * ts ;
626- PyObject * threadid_list = NULL ;
627626 count = 0 ;
628627
629628 /* build a list of tasklets to be killed */
@@ -640,30 +639,9 @@ void slp_kill_tasks_with_stacks(PyThreadState *target_ts)
640639 }
641640 SLP_HEAD_UNLOCK ();
642641
643- /* get the list of thread ids */
644- if (PyExc_TaskletExit )
645- threadid_list = slp_getthreads (Py_None ); /* requires the HEAD lock */
646-
647642 /* kill the tasklets */
648643 kill_pending (tasklet_list );
649- /* kill the threads */
650- if (threadid_list != NULL ) {
651- Py_ssize_t i , len ;
652- assert (PyList_CheckExact (threadid_list ));
653- len = PyList_GET_SIZE (threadid_list );
654- for (i = 0 ; i < len ; i ++ ) {
655- long thread_id ;
656- PyObject * item = PyList_GET_ITEM (threadid_list , i );
657- assert (PyLong_CheckExact (item ));
658- thread_id = PyLong_AsLong (item );
659- if (thread_id != cts -> thread_id ) {
660- /* requires the HEAD lock */
661- PyThreadState_SetAsyncExc (thread_id , PyExc_TaskletExit );
662- PyErr_Clear ();
663- }
664- }
665- Py_DECREF (threadid_list );
666- }
644+
667645 /* We must not release the GIL while we might hold the HEAD-lock.
668646 * Otherwise another thread (usually the thread of the killed tasklet)
669647 * could try to get the HEAD lock. The result would be a wonderful dead lock.
You can’t perform that action at this time.
0 commit comments