Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Some questions about atexit

11 views
Skip to first unread message

Roy Smith

unread,
Sep 12, 2012, 8:58:23 PM9/12/12
to
The atexit docs (http://docs.python.org/library/atexit.html) are very
confusing. In one place they say, "The order in which the functions are
called is not defined". In another place, "all functions registered are
called in last in, first out order". Which is correct?

Also, it's not clear how atexit handlers interact with threading. Do
all handlers get called in the main thread? What if some other thread
registers a handler? Does it get called in that thread?

Terry Reedy

unread,
Sep 12, 2012, 10:29:00 PM9/12/12
to pytho...@python.org
On 9/12/2012 8:58 PM, Roy Smith wrote:
> The atexit docs (http://docs.python.org/library/atexit.html) are very
> confusing. In one place they say, "The order in which the functions are
> called is not defined". In another place, "all functions registered are
> called in last in, first out order". Which is correct?

Check the tracker (bugs.python.org) for atexit issues, open and closed.
I believe there was one about order and whether to make a guarantee. The
doc might have been changed one place and not another. The newer
statement is probably correct. In any case, the wrong place should be
corrected.

> Also, it's not clear how atexit handlers interact with threading. Do
> all handlers get called in the main thread? What if some other thread
> registers a handler? Does it get called in that thread?

Don't know about this.

--
Terry Jan Reedy

Roy Smith

unread,
Sep 13, 2012, 9:03:43 AM9/13/12
to
In article <mailman.587.13475033...@python.org>,
Terry Reedy <tjr...@udel.edu> wrote:

> On 9/12/2012 8:58 PM, Roy Smith wrote:
> > The atexit docs (http://docs.python.org/library/atexit.html) are very
> > confusing. In one place they say, "The order in which the functions are
> > called is not defined". In another place, "all functions registered are
> > called in last in, first out order". Which is correct?
>
> Check the tracker (bugs.python.org) for atexit issues, open and closed.

Thanks for the pointer. The operative one seems to be
http://bugs.python.org/issue15233
0 new messages