Coverage Report

Created: 2022-07-08 09:39

/home/mdboom/Work/builds/cpython/Objects/stringlib/clinic/transmogrify.h.h
Line
Count
Source (jump to first uncovered line)
1
/*[clinic input]
2
preserve
3
[clinic start generated code]*/
4
5
PyDoc_STRVAR(stringlib_expandtabs__doc__,
6
"expandtabs($self, /, tabsize=8)\n"
7
"--\n"
8
"\n"
9
"Return a copy where all tab characters are expanded using spaces.\n"
10
"\n"
11
"If tabsize is not given, a tab size of 8 characters is assumed.");
12
13
#define STRINGLIB_EXPANDTABS_METHODDEF    \
14
    {"expandtabs", _PyCFunction_CAST(stringlib_expandtabs), METH_FASTCALL|METH_KEYWORDS, stringlib_expandtabs__doc__},
15
16
static PyObject *
17
stringlib_expandtabs_impl(PyObject *self, int tabsize);
18
19
static PyObject *
20
stringlib_expandtabs(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
21
{
22
    PyObject *return_value = NULL;
23
    static const char * const _keywords[] = {"tabsize", NULL};
24
    static _PyArg_Parser _parser = {NULL, _keywords, "expandtabs", 0};
25
    PyObject *argsbuf[1];
26
    Py_ssize_t noptargs = nargs + (kwnames ? 
PyTuple_GET_SIZE4
(kwnames) :
022
) - 0;
  Branch (26:36): [True: 2, False: 11]
  Branch (26:36): [True: 2, False: 11]
27
    int tabsize = 8;
28
29
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
30
    if (!args) {
  Branch (30:9): [True: 1, False: 12]
  Branch (30:9): [True: 1, False: 12]
31
        goto exit;
32
    }
33
    if (!noptargs) {
  Branch (33:9): [True: 3, False: 9]
  Branch (33:9): [True: 3, False: 9]
34
        goto skip_optional_pos;
35
    }
36
    tabsize = _PyLong_AsInt(args[0]);
37
    if (tabsize == -1 && 
PyErr_Occurred()0
) {
  Branch (37:9): [True: 0, False: 9]
  Branch (37:26): [True: 0, False: 0]
  Branch (37:9): [True: 0, False: 9]
  Branch (37:26): [True: 0, False: 0]
38
        goto exit;
39
    }
40
skip_optional_pos:
41
    return_value = stringlib_expandtabs_impl(self, tabsize);
42
43
exit:
44
    return return_value;
45
}
bytearrayobject.c:stringlib_expandtabs
Line
Count
Source
21
{
22
    PyObject *return_value = NULL;
23
    static const char * const _keywords[] = {"tabsize", NULL};
24
    static _PyArg_Parser _parser = {NULL, _keywords, "expandtabs", 0};
25
    PyObject *argsbuf[1];
26
    Py_ssize_t noptargs = nargs + (kwnames ? 
PyTuple_GET_SIZE2
(kwnames) :
011
) - 0;
  Branch (26:36): [True: 2, False: 11]
27
    int tabsize = 8;
28
29
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
30
    if (!args) {
  Branch (30:9): [True: 1, False: 12]
31
        goto exit;
32
    }
33
    if (!noptargs) {
  Branch (33:9): [True: 3, False: 9]
34
        goto skip_optional_pos;
35
    }
36
    tabsize = _PyLong_AsInt(args[0]);
37
    if (tabsize == -1 && 
PyErr_Occurred()0
) {
  Branch (37:9): [True: 0, False: 9]
  Branch (37:26): [True: 0, False: 0]
38
        goto exit;
39
    }
40
skip_optional_pos:
41
    return_value = stringlib_expandtabs_impl(self, tabsize);
42
43
exit:
44
    return return_value;
45
}
bytesobject.c:stringlib_expandtabs
Line
Count
Source
21
{
22
    PyObject *return_value = NULL;
23
    static const char * const _keywords[] = {"tabsize", NULL};
24
    static _PyArg_Parser _parser = {NULL, _keywords, "expandtabs", 0};
25
    PyObject *argsbuf[1];
26
    Py_ssize_t noptargs = nargs + (kwnames ? 
PyTuple_GET_SIZE2
(kwnames) :
011
) - 0;
  Branch (26:36): [True: 2, False: 11]
27
    int tabsize = 8;
28
29
    args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
30
    if (!args) {
  Branch (30:9): [True: 1, False: 12]
31
        goto exit;
32
    }
33
    if (!noptargs) {
  Branch (33:9): [True: 3, False: 9]
34
        goto skip_optional_pos;
35
    }
36
    tabsize = _PyLong_AsInt(args[0]);
37
    if (tabsize == -1 && 
PyErr_Occurred()0
) {
  Branch (37:9): [True: 0, False: 9]
  Branch (37:26): [True: 0, False: 0]
38
        goto exit;
39
    }
40
skip_optional_pos:
41
    return_value = stringlib_expandtabs_impl(self, tabsize);
42
43
exit:
44
    return return_value;
45
}
46
47
PyDoc_STRVAR(stringlib_ljust__doc__,
48
"ljust($self, width, fillchar=b\' \', /)\n"
49
"--\n"
50
"\n"
51
"Return a left-justified string of length width.\n"
52
"\n"
53
"Padding is done using the specified fill character.");
54
55
#define STRINGLIB_LJUST_METHODDEF    \
56
    {"ljust", _PyCFunction_CAST(stringlib_ljust), METH_FASTCALL, stringlib_ljust__doc__},
57
58
static PyObject *
59
stringlib_ljust_impl(PyObject *self, Py_ssize_t width, char fillchar);
60
61
static PyObject *
62
stringlib_ljust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
63
{
64
    PyObject *return_value = NULL;
65
    Py_ssize_t width;
66
    char fillchar = ' ';
67
68
    if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) {
69
        goto exit;
70
    }
71
    {
72
        Py_ssize_t ival = -1;
73
        PyObject *iobj = _PyNumber_Index(args[0]);
74
        if (iobj != NULL) {
  Branch (74:13): [True: 14, False: 0]
  Branch (74:13): [True: 57, False: 0]
75
            ival = PyLong_AsSsize_t(iobj);
76
            Py_DECREF(iobj);
77
        }
78
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (78:13): [True: 0, False: 14]
  Branch (78:27): [True: 0, False: 0]
  Branch (78:13): [True: 0, False: 57]
  Branch (78:27): [True: 0, False: 0]
79
            goto exit;
80
        }
81
        width = ival;
82
    }
83
    if (nargs < 2) {
  Branch (83:9): [True: 10, False: 4]
  Branch (83:9): [True: 12, False: 45]
84
        goto skip_optional;
85
    }
86
    if (PyBytes_Check(args[1]) && 
PyBytes_GET_SIZE44
(args[1]) == 144
) {
  Branch (86:35): [True: 1, False: 0]
  Branch (86:35): [True: 43, False: 0]
87
        fillchar = PyBytes_AS_STRING(args[1])[0];
88
    }
89
    else if (PyByteArray_Check(args[1]) && 
PyByteArray_GET_SIZE3
(args[1]) == 13
) {
  Branch (89:44): [True: 2, False: 0]
  Branch (89:44): [True: 1, False: 0]
90
        fillchar = PyByteArray_AS_STRING(args[1])[0];
91
    }
92
    else {
93
        _PyArg_BadArgument("ljust", "argument 2", "a byte string of length 1", args[1]);
94
        goto exit;
95
    }
96
skip_optional:
97
    return_value = stringlib_ljust_impl(self, width, fillchar);
98
99
exit:
100
    return return_value;
101
}
bytearrayobject.c:stringlib_ljust
Line
Count
Source
63
{
64
    PyObject *return_value = NULL;
65
    Py_ssize_t width;
66
    char fillchar = ' ';
67
68
    if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) {
69
        goto exit;
70
    }
71
    {
72
        Py_ssize_t ival = -1;
73
        PyObject *iobj = _PyNumber_Index(args[0]);
74
        if (iobj != NULL) {
  Branch (74:13): [True: 14, False: 0]
75
            ival = PyLong_AsSsize_t(iobj);
76
            Py_DECREF(iobj);
77
        }
78
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (78:13): [True: 0, False: 14]
  Branch (78:27): [True: 0, False: 0]
79
            goto exit;
80
        }
81
        width = ival;
82
    }
83
    if (nargs < 2) {
  Branch (83:9): [True: 10, False: 4]
84
        goto skip_optional;
85
    }
86
    if (PyBytes_Check(args[1]) && 
PyBytes_GET_SIZE1
(args[1]) == 11
) {
  Branch (86:35): [True: 1, False: 0]
87
        fillchar = PyBytes_AS_STRING(args[1])[0];
88
    }
89
    else if (PyByteArray_Check(args[1]) && 
PyByteArray_GET_SIZE2
(args[1]) == 12
) {
  Branch (89:44): [True: 2, False: 0]
90
        fillchar = PyByteArray_AS_STRING(args[1])[0];
91
    }
92
    else {
93
        _PyArg_BadArgument("ljust", "argument 2", "a byte string of length 1", args[1]);
94
        goto exit;
95
    }
96
skip_optional:
97
    return_value = stringlib_ljust_impl(self, width, fillchar);
98
99
exit:
100
    return return_value;
101
}
bytesobject.c:stringlib_ljust
Line
Count
Source
63
{
64
    PyObject *return_value = NULL;
65
    Py_ssize_t width;
66
    char fillchar = ' ';
67
68
    if (!_PyArg_CheckPositional("ljust", nargs, 1, 2)) {
69
        goto exit;
70
    }
71
    {
72
        Py_ssize_t ival = -1;
73
        PyObject *iobj = _PyNumber_Index(args[0]);
74
        if (iobj != NULL) {
  Branch (74:13): [True: 57, False: 0]
75
            ival = PyLong_AsSsize_t(iobj);
76
            Py_DECREF(iobj);
77
        }
78
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (78:13): [True: 0, False: 57]
  Branch (78:27): [True: 0, False: 0]
79
            goto exit;
80
        }
81
        width = ival;
82
    }
83
    if (nargs < 2) {
  Branch (83:9): [True: 12, False: 45]
84
        goto skip_optional;
85
    }
86
    if (PyBytes_Check(args[1]) && 
PyBytes_GET_SIZE43
(args[1]) == 143
) {
  Branch (86:35): [True: 43, False: 0]
87
        fillchar = PyBytes_AS_STRING(args[1])[0];
88
    }
89
    else if (PyByteArray_Check(args[1]) && 
PyByteArray_GET_SIZE1
(args[1]) == 11
) {
  Branch (89:44): [True: 1, False: 0]
90
        fillchar = PyByteArray_AS_STRING(args[1])[0];
91
    }
92
    else {
93
        _PyArg_BadArgument("ljust", "argument 2", "a byte string of length 1", args[1]);
94
        goto exit;
95
    }
96
skip_optional:
97
    return_value = stringlib_ljust_impl(self, width, fillchar);
98
99
exit:
100
    return return_value;
101
}
102
103
PyDoc_STRVAR(stringlib_rjust__doc__,
104
"rjust($self, width, fillchar=b\' \', /)\n"
105
"--\n"
106
"\n"
107
"Return a right-justified string of length width.\n"
108
"\n"
109
"Padding is done using the specified fill character.");
110
111
#define STRINGLIB_RJUST_METHODDEF    \
112
    {"rjust", _PyCFunction_CAST(stringlib_rjust), METH_FASTCALL, stringlib_rjust__doc__},
113
114
static PyObject *
115
stringlib_rjust_impl(PyObject *self, Py_ssize_t width, char fillchar);
116
117
static PyObject *
118
stringlib_rjust(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
119
{
120
    PyObject *return_value = NULL;
121
    Py_ssize_t width;
122
    char fillchar = ' ';
123
124
    if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) {
125
        goto exit;
126
    }
127
    {
128
        Py_ssize_t ival = -1;
129
        PyObject *iobj = _PyNumber_Index(args[0]);
130
        if (iobj != NULL) {
  Branch (130:13): [True: 12, False: 0]
  Branch (130:13): [True: 37, False: 0]
131
            ival = PyLong_AsSsize_t(iobj);
132
            Py_DECREF(iobj);
133
        }
134
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (134:13): [True: 0, False: 12]
  Branch (134:27): [True: 0, False: 0]
  Branch (134:13): [True: 0, False: 37]
  Branch (134:27): [True: 0, False: 0]
135
            goto exit;
136
        }
137
        width = ival;
138
    }
139
    if (nargs < 2) {
  Branch (139:9): [True: 8, False: 4]
  Branch (139:9): [True: 9, False: 28]
140
        goto skip_optional;
141
    }
142
    if (PyBytes_Check(args[1]) && 
PyBytes_GET_SIZE27
(args[1]) == 127
) {
  Branch (142:35): [True: 1, False: 0]
  Branch (142:35): [True: 26, False: 0]
143
        fillchar = PyBytes_AS_STRING(args[1])[0];
144
    }
145
    else if (PyByteArray_Check(args[1]) && 
PyByteArray_GET_SIZE3
(args[1]) == 13
) {
  Branch (145:44): [True: 2, False: 0]
  Branch (145:44): [True: 1, False: 0]
146
        fillchar = PyByteArray_AS_STRING(args[1])[0];
147
    }
148
    else {
149
        _PyArg_BadArgument("rjust", "argument 2", "a byte string of length 1", args[1]);
150
        goto exit;
151
    }
152
skip_optional:
153
    return_value = stringlib_rjust_impl(self, width, fillchar);
154
155
exit:
156
    return return_value;
157
}
bytearrayobject.c:stringlib_rjust
Line
Count
Source
119
{
120
    PyObject *return_value = NULL;
121
    Py_ssize_t width;
122
    char fillchar = ' ';
123
124
    if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) {
125
        goto exit;
126
    }
127
    {
128
        Py_ssize_t ival = -1;
129
        PyObject *iobj = _PyNumber_Index(args[0]);
130
        if (iobj != NULL) {
  Branch (130:13): [True: 12, False: 0]
131
            ival = PyLong_AsSsize_t(iobj);
132
            Py_DECREF(iobj);
133
        }
134
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (134:13): [True: 0, False: 12]
  Branch (134:27): [True: 0, False: 0]
135
            goto exit;
136
        }
137
        width = ival;
138
    }
139
    if (nargs < 2) {
  Branch (139:9): [True: 8, False: 4]
140
        goto skip_optional;
141
    }
142
    if (PyBytes_Check(args[1]) && 
PyBytes_GET_SIZE1
(args[1]) == 11
) {
  Branch (142:35): [True: 1, False: 0]
143
        fillchar = PyBytes_AS_STRING(args[1])[0];
144
    }
145
    else if (PyByteArray_Check(args[1]) && 
PyByteArray_GET_SIZE2
(args[1]) == 12
) {
  Branch (145:44): [True: 2, False: 0]
146
        fillchar = PyByteArray_AS_STRING(args[1])[0];
147
    }
148
    else {
149
        _PyArg_BadArgument("rjust", "argument 2", "a byte string of length 1", args[1]);
150
        goto exit;
151
    }
152
skip_optional:
153
    return_value = stringlib_rjust_impl(self, width, fillchar);
154
155
exit:
156
    return return_value;
157
}
bytesobject.c:stringlib_rjust
Line
Count
Source
119
{
120
    PyObject *return_value = NULL;
121
    Py_ssize_t width;
122
    char fillchar = ' ';
123
124
    if (!_PyArg_CheckPositional("rjust", nargs, 1, 2)) {
125
        goto exit;
126
    }
127
    {
128
        Py_ssize_t ival = -1;
129
        PyObject *iobj = _PyNumber_Index(args[0]);
130
        if (iobj != NULL) {
  Branch (130:13): [True: 37, False: 0]
131
            ival = PyLong_AsSsize_t(iobj);
132
            Py_DECREF(iobj);
133
        }
134
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (134:13): [True: 0, False: 37]
  Branch (134:27): [True: 0, False: 0]
135
            goto exit;
136
        }
137
        width = ival;
138
    }
139
    if (nargs < 2) {
  Branch (139:9): [True: 9, False: 28]
140
        goto skip_optional;
141
    }
142
    if (PyBytes_Check(args[1]) && 
PyBytes_GET_SIZE26
(args[1]) == 126
) {
  Branch (142:35): [True: 26, False: 0]
143
        fillchar = PyBytes_AS_STRING(args[1])[0];
144
    }
145
    else if (PyByteArray_Check(args[1]) && 
PyByteArray_GET_SIZE1
(args[1]) == 11
) {
  Branch (145:44): [True: 1, False: 0]
146
        fillchar = PyByteArray_AS_STRING(args[1])[0];
147
    }
148
    else {
149
        _PyArg_BadArgument("rjust", "argument 2", "a byte string of length 1", args[1]);
150
        goto exit;
151
    }
152
skip_optional:
153
    return_value = stringlib_rjust_impl(self, width, fillchar);
154
155
exit:
156
    return return_value;
157
}
158
159
PyDoc_STRVAR(stringlib_center__doc__,
160
"center($self, width, fillchar=b\' \', /)\n"
161
"--\n"
162
"\n"
163
"Return a centered string of length width.\n"
164
"\n"
165
"Padding is done using the specified fill character.");
166
167
#define STRINGLIB_CENTER_METHODDEF    \
168
    {"center", _PyCFunction_CAST(stringlib_center), METH_FASTCALL, stringlib_center__doc__},
169
170
static PyObject *
171
stringlib_center_impl(PyObject *self, Py_ssize_t width, char fillchar);
172
173
static PyObject *
174
stringlib_center(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
175
{
176
    PyObject *return_value = NULL;
177
    Py_ssize_t width;
178
    char fillchar = ' ';
179
180
    if (!_PyArg_CheckPositional("center", nargs, 1, 2)) {
181
        goto exit;
182
    }
183
    {
184
        Py_ssize_t ival = -1;
185
        PyObject *iobj = _PyNumber_Index(args[0]);
186
        if (iobj != NULL) {
  Branch (186:13): [True: 10, False: 0]
  Branch (186:13): [True: 11, False: 0]
187
            ival = PyLong_AsSsize_t(iobj);
188
            Py_DECREF(iobj);
189
        }
190
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (190:13): [True: 0, False: 10]
  Branch (190:27): [True: 0, False: 0]
  Branch (190:13): [True: 0, False: 11]
  Branch (190:27): [True: 0, False: 0]
191
            goto exit;
192
        }
193
        width = ival;
194
    }
195
    if (nargs < 2) {
  Branch (195:9): [True: 6, False: 4]
  Branch (195:9): [True: 7, False: 4]
196
        goto skip_optional;
197
    }
198
    if (PyBytes_Check(args[1]) && 
PyBytes_GET_SIZE3
(args[1]) == 13
) {
  Branch (198:35): [True: 1, False: 0]
  Branch (198:35): [True: 2, False: 0]
199
        fillchar = PyBytes_AS_STRING(args[1])[0];
200
    }
201
    else if (PyByteArray_Check(args[1]) && 
PyByteArray_GET_SIZE3
(args[1]) == 13
) {
  Branch (201:44): [True: 2, False: 0]
  Branch (201:44): [True: 1, False: 0]
202
        fillchar = PyByteArray_AS_STRING(args[1])[0];
203
    }
204
    else {
205
        _PyArg_BadArgument("center", "argument 2", "a byte string of length 1", args[1]);
206
        goto exit;
207
    }
208
skip_optional:
209
    return_value = stringlib_center_impl(self, width, fillchar);
210
211
exit:
212
    return return_value;
213
}
bytearrayobject.c:stringlib_center
Line
Count
Source
175
{
176
    PyObject *return_value = NULL;
177
    Py_ssize_t width;
178
    char fillchar = ' ';
179
180
    if (!_PyArg_CheckPositional("center", nargs, 1, 2)) {
181
        goto exit;
182
    }
183
    {
184
        Py_ssize_t ival = -1;
185
        PyObject *iobj = _PyNumber_Index(args[0]);
186
        if (iobj != NULL) {
  Branch (186:13): [True: 10, False: 0]
187
            ival = PyLong_AsSsize_t(iobj);
188
            Py_DECREF(iobj);
189
        }
190
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (190:13): [True: 0, False: 10]
  Branch (190:27): [True: 0, False: 0]
191
            goto exit;
192
        }
193
        width = ival;
194
    }
195
    if (nargs < 2) {
  Branch (195:9): [True: 6, False: 4]
196
        goto skip_optional;
197
    }
198
    if (PyBytes_Check(args[1]) && 
PyBytes_GET_SIZE1
(args[1]) == 11
) {
  Branch (198:35): [True: 1, False: 0]
199
        fillchar = PyBytes_AS_STRING(args[1])[0];
200
    }
201
    else if (PyByteArray_Check(args[1]) && 
PyByteArray_GET_SIZE2
(args[1]) == 12
) {
  Branch (201:44): [True: 2, False: 0]
202
        fillchar = PyByteArray_AS_STRING(args[1])[0];
203
    }
204
    else {
205
        _PyArg_BadArgument("center", "argument 2", "a byte string of length 1", args[1]);
206
        goto exit;
207
    }
208
skip_optional:
209
    return_value = stringlib_center_impl(self, width, fillchar);
210
211
exit:
212
    return return_value;
213
}
bytesobject.c:stringlib_center
Line
Count
Source
175
{
176
    PyObject *return_value = NULL;
177
    Py_ssize_t width;
178
    char fillchar = ' ';
179
180
    if (!_PyArg_CheckPositional("center", nargs, 1, 2)) {
181
        goto exit;
182
    }
183
    {
184
        Py_ssize_t ival = -1;
185
        PyObject *iobj = _PyNumber_Index(args[0]);
186
        if (iobj != NULL) {
  Branch (186:13): [True: 11, False: 0]
187
            ival = PyLong_AsSsize_t(iobj);
188
            Py_DECREF(iobj);
189
        }
190
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (190:13): [True: 0, False: 11]
  Branch (190:27): [True: 0, False: 0]
191
            goto exit;
192
        }
193
        width = ival;
194
    }
195
    if (nargs < 2) {
  Branch (195:9): [True: 7, False: 4]
196
        goto skip_optional;
197
    }
198
    if (PyBytes_Check(args[1]) && 
PyBytes_GET_SIZE2
(args[1]) == 12
) {
  Branch (198:35): [True: 2, False: 0]
199
        fillchar = PyBytes_AS_STRING(args[1])[0];
200
    }
201
    else if (PyByteArray_Check(args[1]) && 
PyByteArray_GET_SIZE1
(args[1]) == 11
) {
  Branch (201:44): [True: 1, False: 0]
202
        fillchar = PyByteArray_AS_STRING(args[1])[0];
203
    }
204
    else {
205
        _PyArg_BadArgument("center", "argument 2", "a byte string of length 1", args[1]);
206
        goto exit;
207
    }
208
skip_optional:
209
    return_value = stringlib_center_impl(self, width, fillchar);
210
211
exit:
212
    return return_value;
213
}
214
215
PyDoc_STRVAR(stringlib_zfill__doc__,
216
"zfill($self, width, /)\n"
217
"--\n"
218
"\n"
219
"Pad a numeric string with zeros on the left, to fill a field of the given width.\n"
220
"\n"
221
"The original string is never truncated.");
222
223
#define STRINGLIB_ZFILL_METHODDEF    \
224
    {"zfill", (PyCFunction)stringlib_zfill, METH_O, stringlib_zfill__doc__},
225
226
static PyObject *
227
stringlib_zfill_impl(PyObject *self, Py_ssize_t width);
228
229
static PyObject *
230
stringlib_zfill(PyObject *self, PyObject *arg)
231
{
232
    PyObject *return_value = NULL;
233
    Py_ssize_t width;
234
235
    {
236
        Py_ssize_t ival = -1;
237
        PyObject *iobj = _PyNumber_Index(arg);
238
        if (iobj != NULL) {
  Branch (238:13): [True: 14, False: 0]
  Branch (238:13): [True: 20, False: 0]
239
            ival = PyLong_AsSsize_t(iobj);
240
            Py_DECREF(iobj);
241
        }
242
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (242:13): [True: 0, False: 14]
  Branch (242:27): [True: 0, False: 0]
  Branch (242:13): [True: 0, False: 20]
  Branch (242:27): [True: 0, False: 0]
243
            goto exit;
244
        }
245
        width = ival;
246
    }
247
    return_value = stringlib_zfill_impl(self, width);
248
249
exit:
250
    return return_value;
251
}
bytearrayobject.c:stringlib_zfill
Line
Count
Source
231
{
232
    PyObject *return_value = NULL;
233
    Py_ssize_t width;
234
235
    {
236
        Py_ssize_t ival = -1;
237
        PyObject *iobj = _PyNumber_Index(arg);
238
        if (iobj != NULL) {
  Branch (238:13): [True: 14, False: 0]
239
            ival = PyLong_AsSsize_t(iobj);
240
            Py_DECREF(iobj);
241
        }
242
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (242:13): [True: 0, False: 14]
  Branch (242:27): [True: 0, False: 0]
243
            goto exit;
244
        }
245
        width = ival;
246
    }
247
    return_value = stringlib_zfill_impl(self, width);
248
249
exit:
250
    return return_value;
251
}
bytesobject.c:stringlib_zfill
Line
Count
Source
231
{
232
    PyObject *return_value = NULL;
233
    Py_ssize_t width;
234
235
    {
236
        Py_ssize_t ival = -1;
237
        PyObject *iobj = _PyNumber_Index(arg);
238
        if (iobj != NULL) {
  Branch (238:13): [True: 20, False: 0]
239
            ival = PyLong_AsSsize_t(iobj);
240
            Py_DECREF(iobj);
241
        }
242
        if (ival == -1 && 
PyErr_Occurred()0
) {
  Branch (242:13): [True: 0, False: 20]
  Branch (242:27): [True: 0, False: 0]
243
            goto exit;
244
        }
245
        width = ival;
246
    }
247
    return_value = stringlib_zfill_impl(self, width);
248
249
exit:
250
    return return_value;
251
}
252
/*[clinic end generated code: output=46d058103bffedf7 input=a9049054013a1b77]*/