Added a comment about GIL acquisition vs. multithreading vs. program exit.#891
Added a comment about GIL acquisition vs. multithreading vs. program exit.#891smurfix wants to merge 1 commit intowjakob:masterfrom
Conversation
|
What does "nor ignoring a cancellation" mean? I will note that |
|
When you try to acquire the GIL and Python is in shutdown, your thread self-cancels. You can't catch this exception without re-throwing it, the compiler won't let you. I can't fix the problem by (only) calling |
|
Hi @smurfix, sorry for the long delay in getting to this. The information in this message is not quite accurate anymore: the crashing behavior was changed in recent Python versions. The issue is also not in threads being alive in general -- it's threads that work with nanobind objects, and specifically in such a way that the GIL is dropped and reacquired (which is the step that crashes on old python versions, and pauses those threads on newer versions). Would you consider updating the text to make this more clear, or shall I close the PR? |
9063be4 to
61e044d
Compare
4d71d9a to
238b695
Compare
477f67b to
75f7046
Compare
1235f9a to
4ba51fc
Compare
I added a paragraph warning about this problem. Maybe it saves somebody else a few hours of work.
Cf. #890 where one of my problems was exactly this …