STINNER Victor <vstin...@python.org> added the comment:

I don't think that there is a "good default behavior" where Python currently 
calls PyThread_exit_thread().

IMO we should take the problem from the other side and tries to reduce cases 
when Python can reach this case. Or even make it impossible if possible. For 
example, *removing* daemon threads would remove the most common case when 
Python has to call PyThread_exit_thread().

I'm not sure how to make this case less likely when threading._shutdown() is 
interrupted by CTRL+C. This function can likely hang if a thread is stuck for 
whatever reason. It's important than an user is able to "interrupt" or kill a 
stuck process with CTRL+C (SIGINT). It's a common expectation on Unix, at least 
for me.

Maybe threading._shutdown() should be less nice and call os._exit() in this 
case: exit *immediately* the process in this case. Or Python should restore the 
default SIGINT handler: on Unix, the default SIGINT handler immediately 
terminate the process (like os._exit() does).

I don't think that abort() should be called here (raise SIGABRT signal), since 
the intent of an user pressing CTRL+C is to silently terminate the process. 
It's not an application bug, but an user action.

----------

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

Reply via email to