[Python-Dev] checking what atexit handlers are registered in Python 3

Barry Warsaw barry at python.org
Mon Feb 11 16:28:01 CET 2013

On Feb 10, 2013, at 10:36 AM, Chris Withers wrote:

>One rough edge I've hit: I see the atexit module has moved to be C-based and,
>as far as I can tell, no longer allows you to introspect what atexit
>functions have been registered.
>If I'm writing tests for code that registers atexit handlers, how can I check
>that they've been correctly registered?

Looks like you can't through the atexit module.

Even though Python 2's atexit._exithandlers is a private, undocumented
attribute, the lack of an introspection API in Python 3's atexit seems like a
functional regression.  Please file a bug, although it will have to be a new
feature for Python 3.4.


More information about the Python-Dev mailing list