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.

classification
Title: Change in signal function in the signal module
Type: Stage:
Components: Documentation Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, anthonybaxter, loechelt, rhettinger
Priority: normal Keywords:

Created on 2004-12-10 20:58 by loechelt, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
set_signals.py loechelt, 2004-12-10 20:58 Python script illustrating change in signal module
Messages (4)
msg23641 - (view) Author: Gary H. Loechelt (loechelt) Date: 2004-12-10 20:58
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
msg23642 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-12-11 03:32
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?
msg23643 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2004-12-13 13:16
Logged In: YES 
user_id=29957

This is a deliberate change - "errors should not pass
silently". I agree that it should get better visibility.
Perhaps an entry in amk's what's new document in the section
on Porting to 2.4
<http://www.python.org/doc/2.4/whatsnew/node15.html>
would be appropriate. AMK? (I've added a comment to the
document as a reminder)
msg23644 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2005-01-07 14:35
Logged In: YES 
user_id=11375

Change now described in "What's New".
History
Date User Action Args
2022-04-11 14:56:08adminsetgithub: 41307
2004-12-10 20:58:31loecheltcreate