[PATCH 3/4] Re: Catch KeyboardInterrupts and raise them

Johannes Stezenbach js at sig21.net
Thu Dec 23 19:43:08 GMT 2010

On Wed, Dec 22, 2010 at 11:45:44PM +0100, Nicolas Sebrecht wrote:
> On Wed, Dec 22, 2010 at 03:27:19PM +0100, Sebastian Spaeth wrote:
> > 
> > This was previously not important as most of the code was never run in the main thread and thus never got to see KeyboardInterrupts.
> > In preparation for true singlethreaded mode, we need to protect against KeyboardInterrupts and raise them to the top, cleanly exiting after a ctrl-c.
> You're talking about the KeyboardInterrupt but not the SystemExit you
> are raising too.
> Why do you raise on both except at some lines but not at the others?
> The commit message shouldn't have lines longer than 72-80 characters.
> >                  except:
> > +                    #TODO, we should catch a specific Exception here, not ALL. But which?
> >                      pass
> What do you have in mind? Why do we only catch one specific exception?

Instead of "catch all exceptions except KeyboardInterrupt",
how about "catch only EnvironmentError"?

(Note that e.g. socket.error is a subclass of IOError).

Besides fixing the KeyboardInterrupt issue, it would also
give us back the tracebacks on unexpected errors.


More information about the OfflineIMAP-project mailing list