Author pkerling
Recipients pkerling
Date 2017-06-13.13:06:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1497359164.84.0.615765342748.issue30654@psf.upfronthosting.co.za>
In-reply-to
Content
The signal module checks the SIGINT handler on startup. It only registers a new custom handler if the default OS handler is still installed, so that when embedding python in an application the SIGINT handler of that application is not overwritten. 

But on shutdown in finisignal, it *always* sets SIGINT to SIG_DFL. The reason is that it saves the old handler in old_siginthandler, but *only* if the signal handler is overwritten in init, which only happens when it was SIG_DFL in the first place! If there was already a handler in place in init (-> no overwriting), old_siginthandler will default to the initialization value, which is also SIG_DFL.

This means that when an application embeds Python and needs a custom SIGINT handler, it will stop to work as soon as it shuts down Python since it will always be reset to SIG_DFL.
History
Date User Action Args
2017-06-13 13:06:04pkerlingsetrecipients: + pkerling
2017-06-13 13:06:04pkerlingsetmessageid: <1497359164.84.0.615765342748.issue30654@psf.upfronthosting.co.za>
2017-06-13 13:06:04pkerlinglinkissue30654 messages
2017-06-13 13:06:04pkerlingcreate