Issue 1083177: Change in signal function in the signal module (original) (raw)
The signal function of the signal module handles arguments differently in Python 2.4 than in Python 2.3. I am running on an HP-UX 11 workstation. If I set a handler for a signal that cannot be trapped, like KILL (signal 9), the signal function accepts the argument in Python 2.3 but ignores the operation. However, if I do the same thing in Python 2.4, the signal function rejects the argument and raises a RuntimeError.
I am not sure if this change in behavior is intentional or not. It makes sense in one way to complain about an invalid argument (as in Python 2.4) rather than just ignore the operation (as in Python 2.3). However, I did not find this change in either the documentation or the release notes, and it caught me by surprise. Granted, the stricter argument checking probably caught a sloppy line of coding. Still, some kind of user warning would have been nice if this was an intentional change.
I am enclosing a simple Python script which illustrates the problem. It finishes normally when using Python 2.3 and raises a RuntimeError when using Python 2.4:
Traceback (most recent call last): File "set_signals.py", line 7, in ? signal.signal(signal.SIGKILL, dummy) RuntimeError: (22, 'Invalid argument')
Gary H. Loechelt
Logged In: YES user_id=80475
On WinME, I appropriately get an AttributeError consistently for Py2.2, Py2.3, and Py2.4.
Anthony, you've made the most recent updates to the signalmodule. What do you think?