[issue32312] Create Py_AtExitRegister C API

2019-12-09 Thread STINNER Victor
Change by STINNER Victor : -- components: +C API ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue32312] Create Py_AtExitRegister C API

2019-09-12 Thread STINNER Victor
STINNER Victor added the comment: Joannah Nanjekye asked me to have a look at this issue. The existing Py_AtExit() C function is very low-level: it's called very late in Py_Finalize(), when the Python runtime is already destroyed. I understand that the need here is to call C code which would

[issue32312] Create Py_AtExitRegister C API

2019-03-27 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: This may be especially useful to make sure that extension modules that have threads that were not created by Python calling into Python (registering with the interpreter and picking up the GIL) are stopped before the interpreter starts shutting down t

[issue32312] Create Py_AtExitRegister C API

2019-03-27 Thread Eric Snow
Eric Snow added the comment: > Neil Schemenauer added the comment: > Regarding m_traverse, maybe the list of finalizers should be stored somewhere > in the interpreter > state, not in the atexit module state. That would make more sense to me. > atexit could merely be > a way to manage it r

[issue32312] Create Py_AtExitRegister C API

2019-03-27 Thread Cheryl Sabella
Change by Cheryl Sabella : -- nosy: +pablogsal ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue32312] Create Py_AtExitRegister C API

2017-12-13 Thread Neil Schemenauer
Neil Schemenauer added the comment: Private is fine. We want to get the design correct before making it part of the official API. My thought is that providing a handy atexit hook would be a good thing in that it could be an alternative to 3rd party code using __del__ to do cleanup. One dow

[issue32312] Create Py_AtExitRegister C API

2017-12-13 Thread STINNER Victor
STINNER Victor added the comment: Oh by the way, if we decide to add a function, I would prefer to start with a private function. The C API is big enough. We can decide in the next version if the function becomes useful enough to justify to be added to the public API. --

[issue32312] Create Py_AtExitRegister C API

2017-12-13 Thread Antoine Pitrou
Change by Antoine Pitrou : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue32312] Create Py_AtExitRegister C API

2017-12-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Calling "atexit.register" using the C API isn't very difficult. The annoying part is to wrap a simple C function pointer in a callable PyObject (I don't think there is a simple C API for that). -- ___ Python tracke

[issue32312] Create Py_AtExitRegister C API

2017-12-13 Thread STINNER Victor
STINNER Victor added the comment: See also: [Python-Dev] PEP 489: module m_traverse called with NULL module state https://mail.python.org/pipermail/python-dev/2017-December/151238.html -- ___ Python tracker _

[issue32312] Create Py_AtExitRegister C API

2017-12-13 Thread STINNER Victor
Change by STINNER Victor : -- nosy: +pitrou, vstinner ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue32312] Create Py_AtExitRegister C API

2017-12-13 Thread Neil Schemenauer
New submission from Neil Schemenauer : 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