Coverage Report

Created: 2026-11-20 06:19

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython3/Modules/clinic/atexitmodule.c.h
Line
Count
Source
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
#include "pycore_modsupport.h"    // _PyArg_CheckPositional()
6
7
PyDoc_STRVAR(atexit_register__doc__,
8
"register($module, func, /, *args, **kwargs)\n"
9
"--\n"
10
"\n"
11
"Register a function to be executed upon normal program termination\n"
12
"\n"
13
"    func - function to be called at exit\n"
14
"    args - optional arguments to pass to func\n"
15
"    kwargs - optional keyword arguments to pass to func\n"
16
"\n"
17
"    func is returned to facilitate usage as a decorator.");
18
19
#define ATEXIT_REGISTER_METHODDEF    \
20
    {"register", _PyCFunction_CAST(atexit_register), METH_VARARGS|METH_KEYWORDS, atexit_register__doc__},
21
22
static PyObject *
23
atexit_register_impl(PyObject *module, PyObject *func, PyObject *args,
24
                     PyObject *kwargs);
25
26
static PyObject *
27
atexit_register(PyObject *module, PyObject *args, PyObject *kwargs)
28
0
{
29
0
    PyObject *return_value = NULL;
30
0
    PyObject *func;
31
0
    PyObject *__clinic_args = NULL;
32
0
    PyObject *__clinic_kwargs = NULL;
33
34
0
    if (!_PyArg_CheckPositional("register", PyTuple_GET_SIZE(args), 1, PY_SSIZE_T_MAX)) {
35
0
        goto exit;
36
0
    }
37
0
    func = PyTuple_GET_ITEM(args, 0);
38
0
    __clinic_args = PyTuple_GetSlice(args, 1, PY_SSIZE_T_MAX);
39
0
    if (!__clinic_args) {
40
0
        goto exit;
41
0
    }
42
0
    __clinic_kwargs = Py_XNewRef(kwargs);
43
0
    return_value = atexit_register_impl(module, func, __clinic_args, __clinic_kwargs);
44
45
0
exit:
46
    /* Cleanup for args */
47
0
    Py_XDECREF(__clinic_args);
48
    /* Cleanup for kwargs */
49
0
    Py_XDECREF(__clinic_kwargs);
50
51
0
    return return_value;
52
0
}
53
/*[clinic end generated code: output=ab4b375d516aa59b input=a9049054013a1b77]*/