[issue11116] mailbox and email errors

R. David Murray report at bugs.python.org
Fri Feb 11 15:17:17 CET 2011


R. David Murray <rdmurray at bitdance.com> added the comment:

The finally was doing a _sync_close, which flushes the tmp file and closes it.  The except Exception is checking if any non-BaseException error occurs, *removing* the tmp file, and re-raising the exception.  There's nothing to flush/close in that case.  Then, the else: clause of the exception deals with doing the _sync_close if, eg, we had a keyboard interrupt.  That may or may not leave the mailbox in a sensible state, but it is no worse than the previous behavior.  Certainly for any non-BaseException exception the new code is better; previously you'd most likely wind up with an empty or partially written message tmp file.  I'm open to changing to BaseException, though, if you think that would be better (I can see the argument for that).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11116>
_______________________________________


More information about the Python-bugs-list mailing list