[Scons-users] Crash in signal handling in Jobs.py

Brian Quistorff brian at quistorff.com
Wed Oct 6 20:09:49 EDT 2021


Hello,

Thanks all for the wonderful tool.

My scons crashes in situations where there is a signal handler registered
from "outside Python" (the phrase used in the Python docs for
signal.signal). This happens for me when I run scons from inside Stata (a
stats program), which embeds Python, and sets up a signal handler. I think
this could also happen if one runs scons from a Python environment where a
compiled plugin registered a signal handler. I tracked the problem to
Jobs.py, where _setup_sig_handler() retrieves the previous signal handler
(signal.signal() returns None in this case) and then in
_reset_sig_handler() it tries to the set the signal handler to this
previous (None) value. None is not allowed and this causes a crash.

I've coded up a patch that resets the signal handler to signal.SIG_DFL (the
default handler) when the previous one was None and warns the user that
this is happening. I'm looking for feedback, to see if this is an
acceptable fix, and if/how I should proceed on GitHub.

Thanks,
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20211006/2ee16a4a/attachment.htm>


More information about the Scons-users mailing list