Coverage Report

Created: 2026-03-08 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython/Objects/clinic/structseq.c.h
Line
Count
Source
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
6
#  include "pycore_gc.h"          // PyGC_Head
7
#  include "pycore_runtime.h"     // _Py_ID()
8
#endif
9
#include "pycore_modsupport.h"    // _PyArg_UnpackKeywords()
10
11
static PyObject *
12
structseq_new_impl(PyTypeObject *type, PyObject *arg, PyObject *dict);
13
14
static PyObject *
15
structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
16
20.7k
{
17
20.7k
    PyObject *return_value = NULL;
18
20.7k
    #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
19
20
20.7k
    #define NUM_KEYWORDS 2
21
20.7k
    static struct {
22
20.7k
        PyGC_Head _this_is_not_used;
23
20.7k
        PyObject_VAR_HEAD
24
20.7k
        Py_hash_t ob_hash;
25
20.7k
        PyObject *ob_item[NUM_KEYWORDS];
26
20.7k
    } _kwtuple = {
27
20.7k
        .ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS)
28
20.7k
        .ob_hash = -1,
29
20.7k
        .ob_item = { &_Py_ID(sequence), &_Py_ID(dict), },
30
20.7k
    };
31
20.7k
    #undef NUM_KEYWORDS
32
20.7k
    #define KWTUPLE (&_kwtuple.ob_base.ob_base)
33
34
    #else  // !Py_BUILD_CORE
35
    #  define KWTUPLE NULL
36
    #endif  // !Py_BUILD_CORE
37
38
20.7k
    static const char * const _keywords[] = {"sequence", "dict", NULL};
39
20.7k
    static _PyArg_Parser _parser = {
40
20.7k
        .keywords = _keywords,
41
20.7k
        .fname = "structseq",
42
20.7k
        .kwtuple = KWTUPLE,
43
20.7k
    };
44
20.7k
    #undef KWTUPLE
45
20.7k
    PyObject *argsbuf[2];
46
20.7k
    PyObject * const *fastargs;
47
20.7k
    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
48
20.7k
    Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
49
20.7k
    PyObject *arg;
50
20.7k
    PyObject *dict = NULL;
51
52
20.7k
    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser,
53
20.7k
            /*minpos*/ 1, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf);
54
20.7k
    if (!fastargs) {
55
0
        goto exit;
56
0
    }
57
20.7k
    arg = fastargs[0];
58
20.7k
    if (!noptargs) {
59
20.7k
        goto skip_optional_pos;
60
20.7k
    }
61
0
    dict = fastargs[1];
62
20.7k
skip_optional_pos:
63
20.7k
    return_value = structseq_new_impl(type, arg, dict);
64
65
20.7k
exit:
66
20.7k
    return return_value;
67
20.7k
}
68
/*[clinic end generated code: output=112d59f5e98d652b input=a9049054013a1b77]*/