This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sxsns243
Recipients Andre Merzky, minrk, neologix, sxsns243, takluyver, vstinner
Date 2016-12-09.03:05:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481252734.23.0.513932902403.issue23395@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-12-09 03:05:34sxsns243setrecipients: + sxsns243, vstinner, neologix, takluyver, minrk, Andre Merzky
2016-12-09 03:05:34sxsns243setmessageid: <1481252734.23.0.513932902403.issue23395@psf.upfronthosting.co.za>
2016-12-09 03:05:34sxsns243linkissue23395 messages
2016-12-09 03:05:33sxsns243create