On 6/21/2011 2:51 PM, Chris Torek wrote:
On Tue, 21 Jun 2011 01:43:39 +0000, Chris Torek wrote:
But how can I know a priori
that os.kill() could raise OverflowError in the first place?

   If you passed an integer that was at some time a valid PID
to "os.kill()", and OverflowError was raised, I'd consider that
a bug in "os.kill()".  Only OSError, or some subclass thereof,
should be raised for a possibly-valid PID.

   If you passed some unreasonably large number, that would be
a legitimate reason for an OverflowError. That's for parameter
errors, though; it shouldn't happen for environment errors.

   That's a strong distinction.  If something can raise an
exception because the environment external to the process
has a problem, the exception should be an EnvironmentError
or a subclass thereof.   This maintains a separation between
bugs (which usually should cause termination or fairly
drastic recovery action) and normal external events (which
have to be routinely handled.)

   It's quite possible to get a OSError on "os.kill()" for
a number of legitimate reasons. The target process may have
exited since the PID was obtained, for example.

                                John Nagle
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to