Coverage Report

Created: 2026-06-14 06:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/Python-3.8.3/Objects/clinic/moduleobject.c.h
Line
Count
Source
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
PyDoc_STRVAR(module___init____doc__,
6
"module(name, doc=None)\n"
7
"--\n"
8
"\n"
9
"Create a module object.\n"
10
"\n"
11
"The name must be a string; the optional doc argument can have any type.");
12
13
static int
14
module___init___impl(PyModuleObject *self, PyObject *name, PyObject *doc);
15
16
static int
17
module___init__(PyObject *self, PyObject *args, PyObject *kwargs)
18
246
{
19
246
    int return_value = -1;
20
246
    static const char * const _keywords[] = {"name", "doc", NULL};
21
246
    static _PyArg_Parser _parser = {NULL, _keywords, "module", 0};
22
246
    PyObject *argsbuf[2];
23
246
    PyObject * const *fastargs;
24
246
    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
25
246
    Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
26
246
    PyObject *name;
27
246
    PyObject *doc = Py_None;
28
29
246
    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
30
246
    if (!fastargs) {
31
0
        goto exit;
32
0
    }
33
246
    if (!PyUnicode_Check(fastargs[0])) {
34
0
        _PyArg_BadArgument("module", "argument 'name'", "str", fastargs[0]);
35
0
        goto exit;
36
0
    }
37
246
    if (PyUnicode_READY(fastargs[0]) == -1) {
38
0
        goto exit;
39
0
    }
40
246
    name = fastargs[0];
41
246
    if (!noptargs) {
42
246
        goto skip_optional_pos;
43
246
    }
44
0
    doc = fastargs[1];
45
246
skip_optional_pos:
46
246
    return_value = module___init___impl((PyModuleObject *)self, name, doc);
47
48
246
exit:
49
246
    return return_value;
50
246
}
51
/*[clinic end generated code: output=680276bc3a496d7a input=a9049054013a1b77]*/