Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f1f63c

Browse files
committed
Close the discussion in SF bug 1069160.
1 parent 7fcb786 commit 0f1f63c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Python/pystate.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)