Re: [Orbit-python-list] Catching SIGINT inside orb.run()
Status: Inactive
Brought to you by:
tack
From: Jason T. <ta...@li...> - 2000-11-30 15:48:31
|
> a) I override signal A using signal.signal() > b) orb.run() gets called > c) Just before actually doing the run() I set a new handler for A that > would check PyErr_CheckSignals() > > I just lost the original handler, no? I don't _think_ so. From what I can see in signalmodule.c, when you set a custom handler using signal.signal(), it stores the Python function in an array (line 256 of signalmodule.c, v1.5.2) after calling signal(2) and setting the signal handler to the stub function signal_handler (lines 249 and 245). So when you call signal(2) yourself, you're just skipping the signal module's stub function (signal_handler) in place of your own, both of which will call PyErr_CheckSignals (line 142). PyErr_CheckSignals loops through that array (lines 628-644) and calls the Python functions that were set using signal.signal(). So basically your stub function will have to reimplement what signalmodule's signal_handler does, the most important of which (from what I can tell) is lines 140 and 141. Jason. |