aboutsummaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-12-14 22:40:40 +0100
committerGitHub <noreply@github.com>2020-12-14 22:40:40 +0100
commit83d52044ae4def1e8611a4b1b9263b850ca5c458 (patch)
treecdc3b90536390556290ca0fc2f12ea54a0135289 /Python
parentbpo-41877: Check for misspelled speccing arguments (GH-23737) (diff)
downloadcpython-83d52044ae4def1e8611a4b1b9263b850ca5c458.tar.gz
cpython-83d52044ae4def1e8611a4b1b9263b850ca5c458.tar.bz2
cpython-83d52044ae4def1e8611a4b1b9263b850ca5c458.zip
bpo-42639: Cleanup atexitmodule.c (GH-23770)
* 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.
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 6a705b4d2b4..54a35a27ecc 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -2634,26 +2634,14 @@ Py_ExitStatusException(PyStatus status)
/* Clean up and exit */
-/* For the atexit module. */
-void _Py_PyAtExit(void (*func)(PyObject *), PyObject *module)
-{
- PyInterpreterState *is = _PyInterpreterState_GET();
-
- /* Guard against API misuse (see bpo-17852) */
- assert(is->pyexitfunc == NULL || is->pyexitfunc == func);
-
- is->pyexitfunc = func;
- is->pyexitmodule = module;
-}
-
static void
call_py_exitfuncs(PyThreadState *tstate)
{
PyInterpreterState *interp = tstate->interp;
- if (interp->pyexitfunc == NULL)
+ if (interp->atexit_func == NULL)
return;
- (*interp->pyexitfunc)(interp->pyexitmodule);
+ interp->atexit_func(interp->atexit_module);
_PyErr_Clear(tstate);
}