summaryrefslogtreecommitdiffstats
path: root/Modules/atexitmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-91320: Use _PyCFunction_CAST() (#92251)Victor Stinner2022-05-031-1/+1
| | | | | | | | | | Replace "(PyCFunction)(void(*)(void))func" cast with _PyCFunction_CAST(func). Change generated by the command: sed -i -e \ 's!(PyCFunction)(void(\*)(void)) *\([A-Za-z0-9_]\+\)!_PyCFunction_CAST(\1)!g' \ $(find -name "*.c")
* bpo-46025: Fix a crash in the atexit module for auto-unregistering functions ↵Pablo Galindo Salgado2021-12-091-1/+4
| | | | (GH-30002)
* bpo-43268: Pass interp rather than tstate to internal functions (GH-24580)Victor Stinner2021-02-191-4/+4
| | | | | | | | | | | | | | | Pass the current interpreter (interp) rather than the current Python thread state (tstate) to internal functions which only use the interpreter. Modified functions: * _PyXXX_Fini() and _PyXXX_ClearFreeList() functions * _PyEval_SignalAsyncExc(), make_pending_calls() * _PySys_GetObject(), sys_set_object(), sys_set_object_id(), sys_set_object_str() * should_audit(), set_flags_from_config(), make_flags() * _PyAtExit_Call() * init_stdio_encoding() * etc.
* bpo-42639: atexit._run_exitfuncs() uses sys.unraisablehook (GH-23779)Victor Stinner2020-12-151-35/+11
| | | | | | | | | | atexit._run_exitfuncs() now logs callback exceptions using sys.unraisablehook, rather than logging them directly into sys.stderr and raising the last exception. Run GeneralTest of test_atexit in a subprocess since it calls atexit._clear() which clears all atexit callbacks. _PyAtExit_Fini() sets state->callbacks to NULL.
* bpo-42639: Move atexit state to PyInterpreterState (GH-23763)Victor Stinner2020-12-151-97/+53
| | | | | | | | | * Add _PyAtExit_Call() function and remove pyexitfunc and pyexitmodule members of PyInterpreterState. The function logs atexit callback errors using _PyErr_WriteUnraisableMsg(). * Add _PyAtExit_Init() and _PyAtExit_Fini() functions. * Remove traverse, clear and free functions of the atexit module. Co-authored-by: Dong-hee Na <donghee.na@python.org>
* bpo-42639: atexit now logs callbacks exceptions (GH-23771)Victor Stinner2020-12-141-18/+35
| | | | | | | | | | | At Python exit, if a callback registered with atexit.register() fails, its exception is now logged. Previously, only some exceptions were logged, and the last exception was always silently ignored. Add _PyAtExit_Call() function and remove PyInterpreterState.atexit_func member. call_py_exitfuncs() now calls directly _PyAtExit_Call(). The atexit module must now always be built as a built-in module.
* bpo-42639: Cleanup atexitmodule.c (GH-23770)Victor Stinner2020-12-141-126/+109
| | | | | | | | | * Rename "atexitmodule_state" to "struct atexit_state". * Rename "modstate" to "state". * Rename "self" parameter to "module". * test_atexit uses textwrap.dedent(). * Remove _Py_PyAtExit() function: inline it into atexit_exec(). * PyInterpreterState: rename pyexitfunc to atexit_func, rename pyexitmodule to atexit_module.
* Fix atexitmodule doc (GH-21456)linchiwei1232020-07-261-1/+1
|
* bpo-39824: module_traverse() don't call m_traverse if md_state=NULL (GH-18738)Victor Stinner2020-03-171-16/+11
| | | | | | | | | | | | | Extension modules: m_traverse, m_clear and m_free functions of PyModuleDef are no longer called if the module state was requested but is not allocated yet. This is the case immediately after the module is created and before the module is executed (Py_mod_exec function). More precisely, these functions are not called if m_size is greater than 0 and the module state (as returned by PyModule_GetState()) is NULL. Extension modules without module state (m_size <= 0) are not affected. Co-Authored-By: Petr Viktorin <encukou@gmail.com>
* bpo-39968: Convert extension modules' macros of get_module_state() to inline ↵Hai Shi2020-03-161-10/+16
| | | | functions (GH-19017)
* bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)Serhiy Storchaka2018-11-271-1/+1
| | | | | | Fix invalid function cast warnings with gcc 8 for method conventions different from METH_NOARGS, METH_O and METH_VARARGS excluding Argument Clinic generated code.
* bpo-31901: atexit callbacks should be run at subinterpreter shutdown (#4611)Marcel Plch2017-12-201-32/+40
| | | | Change atexit behavior and PEP-489 multiphase init support.
* bpo-28994: Fixed errors handling in atexit._run_exitfuncs(). (#2034)Serhiy Storchaka2017-06-121-1/+1
| | | The traceback no longer displayed for SystemExit raised in a callback registered by atexit.
* Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5Martin Panter2015-11-021-1/+1
|\
| * Issue #25523: Correct "a" article to "an" articleMartin Panter2015-11-021-1/+1
| | | | | | | | | | | | This changes the main documentation, doc strings, source code comments, and a couple error messages in the test suite. In some cases the word was removed or edited some other way to fix the grammar.
* | Removed unintentional trailing spaces in non-external and non-generated C files.Serhiy Storchaka2015-03-181-4/+4
| |
* | Issue #22869: Split pythonrun into two modulesNick Coghlan2014-11-201-1/+1
|/ | | | | | | - interpreter startup and shutdown code moved to a new pylifecycle.c module - Py_OptimizeFlag moved into the new module with the other global flags
* Issue #18619: Fix atexit leaking callbacks registered from sub-interpreters, ↵Antoine Pitrou2013-08-011-42/+79
| | | | and make it GC-aware.
* Issue #11826: Fix memory leak in atexitmodule.Stefan Krah2012-03-271-1/+9
|
* Issue #10756: atexit normalizes the exception before displaying it.Victor Stinner2011-01-051-0/+1
|
* Issue #4200: Changed the atexit module to store its state in its PyModuleDef ↵Christian Heimes2008-10-301-50/+82
| | | | atexitmodule. This fixes a bug with multiple subinterpeters. The bug was found by Graham Dumpletom during his work on a 3.0 port of mod_wsgi. The patch has been reviewed by Benjamin.
* Fix for issue 3666 - atexit.register with bad inputs segfaults on exit.Skip Montanaro2008-09-231-6/+7
| | | | Reviewed by Christian Heimes.
* Implement PEP 3121: new module initialization and finalization API.Martin v. Löwis2008-06-111-4/+18
|
* missing docstringsSkip Montanaro2007-08-061-5/+23
|
* Address some XXXs from Neal Norwitz.Collin Winter2007-03-231-8/+19
|
* Little fixes:Neal Norwitz2007-03-211-8/+15
| | | | | | | | * make some module variables static to prevent name pollution * Add some comments to clarify what's going on and some XXXs to address * Add a space after "for" before ( * exc_value and tb can be NULL in some cases * Get working on Windows (I think)
* Patch #1680961: remove sys.exitfunc and replace it with a private C API. ↵Collin Winter2007-03-211-0/+217
Also, reimplement atexit in C so it can take advantage of this private API.