Antoine Pitrou added the comment:

Isn't the thread state clearing subject to a race condition? 
PyThreadState_Clear() will release a bunch of frames, deallocating arbitrary 
objects and therefore potentially releasing the GIL. This lets the main thread 
run and potentially spawn other threads, which may be wrongly deallocated in 
the following loop iteration.

A solution would be to detach the thread states from the linked list and clear 
them afterwards.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17094>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to