[New-bugs-announce] [issue32312] Create Py_AtExitRegister C API

Neil Schemenauer report at bugs.python.org
Wed Dec 13 15:45:20 EST 2017

New submission from Neil Schemenauer <nas-python at arctrix.com>:

It would be handy to have a C API that registered an atexit function, similar to what calling atexit.register does.  This API could be used by C extension modules to register atexit functions.

I think the implementation would be fairly simple.  We need a function that calls atexit_register().  The tricky bit is that we need to make sure the atexit module has been initialized as atexit_register uses the module state.

This API is different from Py_AtExit in that atexit.register() calls the function early in the interpreter shutdown whereas Py_AtExit calls functions very late in the shutdown.

messages: 308246
nosy: nascheme
priority: low
severity: normal
stage: needs patch
status: open
title: Create Py_AtExitRegister C API
type: enhancement

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list