I created PR 7069 to remove the assertion. With this change, attached bug.py doesn't crash anymore, but it still logs warnings in verbose mode:
vstinner@apu$ ./python -v bug.py
(...)
PyThreadState_Clear: warning: thread still has a frame
PyThreadState_Clear: warning: thread still has a frame
PyThreadState_Clear: warning: thread still has a generator
PyThreadState_Clear: warning: thread still has a frame
PyThreadState_Clear: warning: thread still has a generator
PyThreadState_Clear: warning: thread still has a frame
The root issue is that Python doesn't join deamonic threads. But it's by design no?
I hate daemonic threads :-)
For the specific case of a fork(), it can be possible that a thread calls os.fork() while another thread is running a generator, no?
--
Since this issue seems to be a regression and I have a PR fixing it, I propose to mark this issue as a release blocker. Sorry Ned :-( |