[Python-Dev] Where to put the interrupt module?

Neal Norwitz neal@metaslash.com
2003年6月12日 16:12:32 -0400


On Thu, Jun 12, 2003 at 04:07:33PM -0400, Guido van Rossum wrote:
> > I haven't looked, but is it possible to make it raise an arbitrary
> > exception? Last time I read the PyErr_CheckSignals code it looked possible. 
> > (That was yesterday, actually, regarding problems with the SSL module and
> > KeyboardInterrupts).
>> The interrupt module currently uses PyErr_SetInterrupt(), which can
> only raise KeyboardInterrupt.
>> Let's not generalize this until there's a need. Then, let whoever has
> the need add the generalization.
>> I'm actually a bit wary of such a generalization, because
> KeyboardInterrupt is currently the only *asynchronous* exception that
> code needs to worry about. There is plenty of code that gives
> KeyboardInterrupt special treatment, typically of the form:
>> while MoreWorkToDo:
> try:
> 	 ...run a chunk of work which may raise arbitrary exceptions...
> except KeyboardInterrupt:
> 	 raise # Don't keep going in this case
> except:
> 	 ...report the error and continue...

What about SystemExit?
Neal

AltStyle によって変換されたページ (->オリジナル) /