File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ PyThreadState_GetDict(void)
320320
321321/* Asynchronously raise an exception in a thread.
322322 Requested by Just van Rossum and Alex Martelli.
323- To prevent naive misuse, you must write your own exception
323+ To prevent naive misuse, you must write your own extension
324324 to call this. Must be called with the GIL held.
325325 Returns the number of tstates modified; if it returns a number
326326 greater than one, you're in trouble, and you should call it again
@@ -332,6 +332,7 @@ PyThreadState_SetAsyncExc(long id, PyObject *exc) {
332332 PyInterpreterState * interp = tstate -> interp ;
333333 PyThreadState * p ;
334334 int count = 0 ;
335+ HEAD_LOCK ();
335336 for (p = interp -> tstate_head ; p != NULL ; p = p -> next ) {
336337 if (p -> thread_id != id )
337338 continue ;
@@ -340,6 +341,7 @@ PyThreadState_SetAsyncExc(long id, PyObject *exc) {
340341 p -> async_exc = exc ;
341342 count += 1 ;
342343 }
344+ HEAD_UNLOCK ();
343345 return count ;
344346}
345347
You can’t perform that action at this time.
0 commit comments