Coverage Report

Created: 2025-07-11 06:59

/src/Python-3.8.3/Objects/clinic/moduleobject.c.h
Line
Count
Source (jump to first uncovered line)
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
263
{
19
263
    int return_value = -1;
20
263
    static const char * const _keywords[] = {"name", "doc", NULL};
21
263
    static _PyArg_Parser _parser = {NULL, _keywords, "module", 0};
22
263
    PyObject *argsbuf[2];
23
263
    PyObject * const *fastargs;
24
263
    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
25
263
    Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 1;
26
263
    PyObject *name;
27
263
    PyObject *doc = Py_None;
28
29
263
    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
30
263
    if (!fastargs) {
31
0
        goto exit;
32
0
    }
33
263
    if (!PyUnicode_Check(fastargs[0])) {
34
0
        _PyArg_BadArgument("module", "argument 'name'", "str", fastargs[0]);
35
0
        goto exit;
36
0
    }
37
263
    if (PyUnicode_READY(fastargs[0]) == -1) {
38
0
        goto exit;
39
0
    }
40
263
    name = fastargs[0];
41
263
    if (!noptargs) {
42
263
        goto skip_optional_pos;
43
263
    }
44
0
    doc = fastargs[1];
45
263
skip_optional_pos:
46
263
    return_value = module___init___impl((PyModuleObject *)self, name, doc);
47
48
263
exit:
49
263
    return return_value;
50
263
}
51
/*[clinic end generated code: output=680276bc3a496d7a input=a9049054013a1b77]*/