Open snickell opened 1 month ago
I noticed we do not call Py_FinalizeEx(). If I call Py_FinalizeEx()
at the end of my thread: the process exits! 🥳
Changes in my repro code:
Thread.new do
# CUT TO MAKE SHORT
# I have modified pycall.c to add this method, which calls Py_API(Py_FinalizeEx)()
PyCall.finalize
end
With these changes, now the main process exits.
I have started a fix for this here: https://github.com/mrkn/pycall.rb/pull/187, but its not complete yet. It permits the process to exit, but sometimes it segfaults at exit.
If you use PyCall from only one thread , but that thread is NOT the main thread, the process will not exit when the main thread exits.
This is not the same issue as: "Is PyCall Thread Safe" #96, as we are only using PyCall from one thread:
Example:
Output when
do_pycall_import: true
Output when
do_pycall_import: false