Wataru Matsumoto added the comment:

Recently I've encountered the similar problem.
I found the case that SIGINT signal is ignored(set as SIG_IGN) due to the 
external reason.
If the python program starts background in bash script, bash set SIGINT as 
SIG_IGN.

test_interrupt.py
import _thread
_thread.interrupt_main()

run.sh
#!/bin/bash
python test_interrupt.py &
sleep 1s

./run.sh 
Traceback (most recent call last):
  File "test_interrupt.py", line 2, in <module>
    _thread.interrupt_main()
RuntimeError: the SIGINT signal is ignored
(it was TypeError: 'int' object is not callable before the patch)

Python mapped default_int_handler to SIG_INT on SIG_DFL in PyInit__signal.
As the python developer can't control how the program is started, it may be 
better to setup default_int_handler regardless the handler type.

And initially SIG_INT is mapped to default_int_handler but once signal.signal 
is called, the mapping is lost even though the SIG_DFL is specified.
It may need to handle SIG_INT specially in signal_signal_impl as well to keep 
the consistent behavior.

----------

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

Reply via email to