Coverage Report

Created: 2026-12-01 06:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython/Objects/clinic/templateobject.c.h
Line
Count
Source
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
#include "pycore_modsupport.h"    // _PyArg_NoKeywords()
6
#include "pycore_tuple.h"         // _PyTuple_ITEMS()
7
8
static PyObject *
9
template_new_impl(PyTypeObject *type, PyObject * const *args,
10
                  Py_ssize_t args_length);
11
12
static PyObject *
13
template_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
14
0
{
15
0
    PyObject *return_value = NULL;
16
0
    PyTypeObject *base_tp = &_PyTemplate_Type;
17
0
    PyObject * const *__clinic_args;
18
0
    Py_ssize_t args_length;
19
20
0
    if ((type == base_tp || type->tp_init == base_tp->tp_init) &&
21
0
        !_PyArg_NoKeywords("Template", kwargs)) {
22
0
        goto exit;
23
0
    }
24
0
    __clinic_args = _PyTuple_ITEMS(args);
25
0
    args_length = PyTuple_GET_SIZE(args);
26
0
    return_value = template_new_impl(type, __clinic_args, args_length);
27
28
0
exit:
29
0
    return return_value;
30
0
}
31
32
static PyObject *
33
template_vectorcall(PyObject *type, PyObject *const *args,
34
    size_t nargsf, PyObject *kwnames)
35
0
{
36
0
    PyObject *return_value = NULL;
37
0
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
38
0
    PyObject * const *__clinic_args;
39
0
    Py_ssize_t args_length;
40
41
0
    assert(_PyType_CAST(type)->tp_new == template_new);
42
    /* Make sure the type object is immutable: the generated
43
     * vectorcall doesn't deal e.g. with users reassigning __init__. */
44
0
    assert(PyType_HasFeature(_PyType_CAST(type), Py_TPFLAGS_IMMUTABLETYPE));
45
0
    if (!_PyArg_NoKwnames("Template", kwnames)) {
46
0
        goto exit;
47
0
    }
48
0
    __clinic_args = args;
49
0
    args_length = nargs;
50
0
    return_value = template_new_impl(_PyType_CAST(type), __clinic_args, args_length);
51
52
0
exit:
53
0
    return return_value;
54
0
}
55
/*[clinic end generated code: output=38d45f3b38a21517 input=a9049054013a1b77]*/