Coverage Report

Created: 2025-07-11 06:59

/src/Python-3.8.3/Python/clinic/traceback.c.h
Line
Count
Source (jump to first uncovered line)
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
PyDoc_STRVAR(tb_new__doc__,
6
"TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)\n"
7
"--\n"
8
"\n"
9
"Create a new traceback object.");
10
11
static PyObject *
12
tb_new_impl(PyTypeObject *type, PyObject *tb_next, PyFrameObject *tb_frame,
13
            int tb_lasti, int tb_lineno);
14
15
static PyObject *
16
tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
17
0
{
18
0
    PyObject *return_value = NULL;
19
0
    static const char * const _keywords[] = {"tb_next", "tb_frame", "tb_lasti", "tb_lineno", NULL};
20
0
    static _PyArg_Parser _parser = {NULL, _keywords, "TracebackType", 0};
21
0
    PyObject *argsbuf[4];
22
0
    PyObject * const *fastargs;
23
0
    Py_ssize_t nargs = PyTuple_GET_SIZE(args);
24
0
    PyObject *tb_next;
25
0
    PyFrameObject *tb_frame;
26
0
    int tb_lasti;
27
0
    int tb_lineno;
28
29
0
    fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 4, 4, 0, argsbuf);
30
0
    if (!fastargs) {
31
0
        goto exit;
32
0
    }
33
0
    tb_next = fastargs[0];
34
0
    if (!PyObject_TypeCheck(fastargs[1], &PyFrame_Type)) {
35
0
        _PyArg_BadArgument("TracebackType", "argument 'tb_frame'", (&PyFrame_Type)->tp_name, fastargs[1]);
36
0
        goto exit;
37
0
    }
38
0
    tb_frame = (PyFrameObject *)fastargs[1];
39
0
    if (PyFloat_Check(fastargs[2])) {
40
0
        PyErr_SetString(PyExc_TypeError,
41
0
                        "integer argument expected, got float" );
42
0
        goto exit;
43
0
    }
44
0
    tb_lasti = _PyLong_AsInt(fastargs[2]);
45
0
    if (tb_lasti == -1 && PyErr_Occurred()) {
46
0
        goto exit;
47
0
    }
48
0
    if (PyFloat_Check(fastargs[3])) {
49
0
        PyErr_SetString(PyExc_TypeError,
50
0
                        "integer argument expected, got float" );
51
0
        goto exit;
52
0
    }
53
0
    tb_lineno = _PyLong_AsInt(fastargs[3]);
54
0
    if (tb_lineno == -1 && PyErr_Occurred()) {
55
0
        goto exit;
56
0
    }
57
0
    return_value = tb_new_impl(type, tb_next, tb_frame, tb_lasti, tb_lineno);
58
59
0
exit:
60
0
    return return_value;
61
0
}
62
/*[clinic end generated code: output=3def6c06248feed8 input=a9049054013a1b77]*/