Coverage Report

Created: 2022-07-08 09:39

/home/mdboom/Work/builds/cpython/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
{
19
    int return_value = -1;
20
    static const char * const _keywords[] = {"name", "doc", NULL};
21
    static _PyArg_Parser _parser = {NULL, _keywords, "module", 0};
22
    PyObject *argsbuf[2];
23
    PyObject * const *fastargs;
24
    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
25
    Py_ssize_t noptargs = nargs + (kwargs ? 
PyDict_GET_SIZE0
(kwargs) : 0) - 1;
  Branch (25:36): [True: 0, False: 9.79k]
26
    PyObject *name;
27
    PyObject *doc = Py_None;
28
29
    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 1, 2, 0, argsbuf);
30
    if (!fastargs) {
  Branch (30:9): [True: 0, False: 9.79k]
31
        goto exit;
32
    }
33
    if (!PyUnicode_Check(fastargs[0])) {
  Branch (33:9): [True: 0, False: 9.79k]
34
        _PyArg_BadArgument("module", "argument 'name'", "str", fastargs[0]);
35
        goto exit;
36
    }
37
    if (PyUnicode_READY(fastargs[0]) == -1) {
  Branch (37:9): [True: 0, False: 9.79k]
38
        goto exit;
39
    }
40
    name = fastargs[0];
41
    if (!noptargs) {
  Branch (41:9): [True: 9.79k, False: 6]
42
        goto skip_optional_pos;
43
    }
44
    doc = fastargs[1];
45
skip_optional_pos:
46
    return_value = module___init___impl((PyModuleObject *)self, name, doc);
47
48
exit:
49
    return return_value;
50
}
51
/*[clinic end generated code: output=680276bc3a496d7a input=a9049054013a1b77]*/