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: os.kill() inconsistency
Type: Stage:
Components: Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: exarkun, giampaolo.rodola, gpolo
Priority: normal Keywords:

Created on 2009-02-20 21:51 by giampaolo.rodola, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg82549 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2009-02-20 21:51
On Linux Ubuntu equipped with Python 2.6.1 I get this:

>>> os.kill(99999, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OSError: [Errno 3] No such process
>>> print os.kill(-1, 0)
None
>>>


IMHO the latter case should raise "No such process" for consistency or,
at least ValueError, but surely not returning None.
msg82550 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2009-02-20 21:52
Oddly, by passing -2 as PID no such process is raised:

>>> os.kill(-2, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OSError: [Errno 3] No such process
>>>
msg82551 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-02-20 21:53
Read the docs for kill(2).  -1 is a completely legitimate PID. 
Recommend close as invalid.
msg82552 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2009-02-20 21:55
I lost the race, congrats Jean :P

I was going to copy & paste part of the man page.
msg82554 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2009-02-20 22:44
You're right. My fault.
History
Date User Action Args
2022-04-11 14:56:46adminsetgithub: 49583
2009-02-20 22:44:26giampaolo.rodolasetmessages: + msg82554
2009-02-20 21:55:09gpolosetstatus: open -> closed
nosy: + gpolo
resolution: not a bug
messages: + msg82552
2009-02-20 21:53:10exarkunsetnosy: + exarkun
messages: + msg82551
2009-02-20 21:52:26giampaolo.rodolasetmessages: + msg82550
2009-02-20 21:51:49giampaolo.rodolacreate