To run all exit handlers or not?

The current behavior of the atexit module is that if any of the exit handlers raises an exception the remaining handlers are not run. Greg Chapman posted a bug report about this: http://www.python.org/sf/1052242 Greg proposed catching any exceptions and continuing so that all exit handlers at least have a chance to run and Raymond agrees with him. I attached a patch to the ticket to add a flag to determine the behavior on the principle that atexit has been around long enough that someone out there probably relies on the early exit behavior. This is the old Python chestnut of using a flag to preserve existing behavior as the default while allowing users to set the flag to get the new behavior. I'm happy to go either way, but thought perhaps a quick poll of the troops might be in order, hence this note. Skip

On Wed, 27 Oct 2004 09:50:46 -0500, Skip Montanaro <skip@pobox.com> wrote:
The current behavior of the atexit module is that if any of the exit handlers raises an exception the remaining handlers are not run. Greg Chapman posted a bug report about this:
http://www.python.org/sf/1052242
Greg proposed catching any exceptions and continuing so that all exit handlers at least have a chance to run and Raymond agrees with him. I attached a patch to the ticket to add a flag to determine the behavior on the principle that atexit has been around long enough that someone out there probably relies on the early exit behavior. This is the old Python chestnut of using a flag to preserve existing behavior as the default while allowing users to set the flag to get the new behavior.
I'm happy to go either way, but thought perhaps a quick poll of the troops might be in order, hence this note.
If I were a user of the atexit module and aware of this behavior, I'd consider it a bug write my atexit handler to avoid ever raising an exception, because I didn't want to jeopardize other atexit handlers. So I think preserving backwards-compatible behavior is unnecessary. -- --Guido van Rossum (home page: http://www.python.org/~guido/)

Guido> If I were a user of the atexit module and aware of this behavior, Guido> I'd consider it a bug [and] write my atexit handler to avoid ever Guido> raising an exception, because I didn't want to jeopardize other Guido> atexit handlers. So I think preserving backwards-compatible Guido> behavior is unnecessary. Okay. Will take that as a pronouncement... Skip
participants (2)
-
Guido van Rossum
-
Skip Montanaro