/src/Python-3.8.3/Objects/clinic/codeobject.c.h
Line  | Count  | Source  | 
1  |  | /*[clinic input]  | 
2  |  | preserve  | 
3  |  | [clinic start generated code]*/  | 
4  |  |  | 
5  |  | PyDoc_STRVAR(code_replace__doc__,  | 
6  |  | "replace($self, /, *, co_argcount=-1, co_posonlyargcount=-1,\n"  | 
7  |  | "        co_kwonlyargcount=-1, co_nlocals=-1, co_stacksize=-1,\n"  | 
8  |  | "        co_flags=-1, co_firstlineno=-1, co_code=None, co_consts=None,\n"  | 
9  |  | "        co_names=None, co_varnames=None, co_freevars=None,\n"  | 
10  |  | "        co_cellvars=None, co_filename=None, co_name=None,\n"  | 
11  |  | "        co_lnotab=None)\n"  | 
12  |  | "--\n"  | 
13  |  | "\n"  | 
14  |  | "Return a copy of the code object with new values for the specified fields.");  | 
15  |  |  | 
16  |  | #define CODE_REPLACE_METHODDEF    \  | 
17  |  |     {"replace", (PyCFunction)(void(*)(void))code_replace, METH_FASTCALL|METH_KEYWORDS, code_replace__doc__}, | 
18  |  |  | 
19  |  | static PyObject *  | 
20  |  | code_replace_impl(PyCodeObject *self, int co_argcount,  | 
21  |  |                   int co_posonlyargcount, int co_kwonlyargcount,  | 
22  |  |                   int co_nlocals, int co_stacksize, int co_flags,  | 
23  |  |                   int co_firstlineno, PyBytesObject *co_code,  | 
24  |  |                   PyObject *co_consts, PyObject *co_names,  | 
25  |  |                   PyObject *co_varnames, PyObject *co_freevars,  | 
26  |  |                   PyObject *co_cellvars, PyObject *co_filename,  | 
27  |  |                   PyObject *co_name, PyBytesObject *co_lnotab);  | 
28  |  |  | 
29  |  | static PyObject *  | 
30  |  | code_replace(PyCodeObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)  | 
31  | 0  | { | 
32  | 0  |     PyObject *return_value = NULL;  | 
33  | 0  |     static const char * const _keywords[] = {"co_argcount", "co_posonlyargcount", "co_kwonlyargcount", "co_nlocals", "co_stacksize", "co_flags", "co_firstlineno", "co_code", "co_consts", "co_names", "co_varnames", "co_freevars", "co_cellvars", "co_filename", "co_name", "co_lnotab", NULL}; | 
34  | 0  |     static _PyArg_Parser _parser = {NULL, _keywords, "replace", 0}; | 
35  | 0  |     PyObject *argsbuf[16];  | 
36  | 0  |     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;  | 
37  | 0  |     int co_argcount = self->co_argcount;  | 
38  | 0  |     int co_posonlyargcount = self->co_posonlyargcount;  | 
39  | 0  |     int co_kwonlyargcount = self->co_kwonlyargcount;  | 
40  | 0  |     int co_nlocals = self->co_nlocals;  | 
41  | 0  |     int co_stacksize = self->co_stacksize;  | 
42  | 0  |     int co_flags = self->co_flags;  | 
43  | 0  |     int co_firstlineno = self->co_firstlineno;  | 
44  | 0  |     PyBytesObject *co_code = (PyBytesObject *)self->co_code;  | 
45  | 0  |     PyObject *co_consts = self->co_consts;  | 
46  | 0  |     PyObject *co_names = self->co_names;  | 
47  | 0  |     PyObject *co_varnames = self->co_varnames;  | 
48  | 0  |     PyObject *co_freevars = self->co_freevars;  | 
49  | 0  |     PyObject *co_cellvars = self->co_cellvars;  | 
50  | 0  |     PyObject *co_filename = self->co_filename;  | 
51  | 0  |     PyObject *co_name = self->co_name;  | 
52  | 0  |     PyBytesObject *co_lnotab = (PyBytesObject *)self->co_lnotab;  | 
53  |  | 
  | 
54  | 0  |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 0, 0, argsbuf);  | 
55  | 0  |     if (!args) { | 
56  | 0  |         goto exit;  | 
57  | 0  |     }  | 
58  | 0  |     if (!noptargs) { | 
59  | 0  |         goto skip_optional_kwonly;  | 
60  | 0  |     }  | 
61  | 0  |     if (args[0]) { | 
62  | 0  |         if (PyFloat_Check(args[0])) { | 
63  | 0  |             PyErr_SetString(PyExc_TypeError,  | 
64  | 0  |                             "integer argument expected, got float" );  | 
65  | 0  |             goto exit;  | 
66  | 0  |         }  | 
67  | 0  |         co_argcount = _PyLong_AsInt(args[0]);  | 
68  | 0  |         if (co_argcount == -1 && PyErr_Occurred()) { | 
69  | 0  |             goto exit;  | 
70  | 0  |         }  | 
71  | 0  |         if (!--noptargs) { | 
72  | 0  |             goto skip_optional_kwonly;  | 
73  | 0  |         }  | 
74  | 0  |     }  | 
75  | 0  |     if (args[1]) { | 
76  | 0  |         if (PyFloat_Check(args[1])) { | 
77  | 0  |             PyErr_SetString(PyExc_TypeError,  | 
78  | 0  |                             "integer argument expected, got float" );  | 
79  | 0  |             goto exit;  | 
80  | 0  |         }  | 
81  | 0  |         co_posonlyargcount = _PyLong_AsInt(args[1]);  | 
82  | 0  |         if (co_posonlyargcount == -1 && PyErr_Occurred()) { | 
83  | 0  |             goto exit;  | 
84  | 0  |         }  | 
85  | 0  |         if (!--noptargs) { | 
86  | 0  |             goto skip_optional_kwonly;  | 
87  | 0  |         }  | 
88  | 0  |     }  | 
89  | 0  |     if (args[2]) { | 
90  | 0  |         if (PyFloat_Check(args[2])) { | 
91  | 0  |             PyErr_SetString(PyExc_TypeError,  | 
92  | 0  |                             "integer argument expected, got float" );  | 
93  | 0  |             goto exit;  | 
94  | 0  |         }  | 
95  | 0  |         co_kwonlyargcount = _PyLong_AsInt(args[2]);  | 
96  | 0  |         if (co_kwonlyargcount == -1 && PyErr_Occurred()) { | 
97  | 0  |             goto exit;  | 
98  | 0  |         }  | 
99  | 0  |         if (!--noptargs) { | 
100  | 0  |             goto skip_optional_kwonly;  | 
101  | 0  |         }  | 
102  | 0  |     }  | 
103  | 0  |     if (args[3]) { | 
104  | 0  |         if (PyFloat_Check(args[3])) { | 
105  | 0  |             PyErr_SetString(PyExc_TypeError,  | 
106  | 0  |                             "integer argument expected, got float" );  | 
107  | 0  |             goto exit;  | 
108  | 0  |         }  | 
109  | 0  |         co_nlocals = _PyLong_AsInt(args[3]);  | 
110  | 0  |         if (co_nlocals == -1 && PyErr_Occurred()) { | 
111  | 0  |             goto exit;  | 
112  | 0  |         }  | 
113  | 0  |         if (!--noptargs) { | 
114  | 0  |             goto skip_optional_kwonly;  | 
115  | 0  |         }  | 
116  | 0  |     }  | 
117  | 0  |     if (args[4]) { | 
118  | 0  |         if (PyFloat_Check(args[4])) { | 
119  | 0  |             PyErr_SetString(PyExc_TypeError,  | 
120  | 0  |                             "integer argument expected, got float" );  | 
121  | 0  |             goto exit;  | 
122  | 0  |         }  | 
123  | 0  |         co_stacksize = _PyLong_AsInt(args[4]);  | 
124  | 0  |         if (co_stacksize == -1 && PyErr_Occurred()) { | 
125  | 0  |             goto exit;  | 
126  | 0  |         }  | 
127  | 0  |         if (!--noptargs) { | 
128  | 0  |             goto skip_optional_kwonly;  | 
129  | 0  |         }  | 
130  | 0  |     }  | 
131  | 0  |     if (args[5]) { | 
132  | 0  |         if (PyFloat_Check(args[5])) { | 
133  | 0  |             PyErr_SetString(PyExc_TypeError,  | 
134  | 0  |                             "integer argument expected, got float" );  | 
135  | 0  |             goto exit;  | 
136  | 0  |         }  | 
137  | 0  |         co_flags = _PyLong_AsInt(args[5]);  | 
138  | 0  |         if (co_flags == -1 && PyErr_Occurred()) { | 
139  | 0  |             goto exit;  | 
140  | 0  |         }  | 
141  | 0  |         if (!--noptargs) { | 
142  | 0  |             goto skip_optional_kwonly;  | 
143  | 0  |         }  | 
144  | 0  |     }  | 
145  | 0  |     if (args[6]) { | 
146  | 0  |         if (PyFloat_Check(args[6])) { | 
147  | 0  |             PyErr_SetString(PyExc_TypeError,  | 
148  | 0  |                             "integer argument expected, got float" );  | 
149  | 0  |             goto exit;  | 
150  | 0  |         }  | 
151  | 0  |         co_firstlineno = _PyLong_AsInt(args[6]);  | 
152  | 0  |         if (co_firstlineno == -1 && PyErr_Occurred()) { | 
153  | 0  |             goto exit;  | 
154  | 0  |         }  | 
155  | 0  |         if (!--noptargs) { | 
156  | 0  |             goto skip_optional_kwonly;  | 
157  | 0  |         }  | 
158  | 0  |     }  | 
159  | 0  |     if (args[7]) { | 
160  | 0  |         if (!PyBytes_Check(args[7])) { | 
161  | 0  |             _PyArg_BadArgument("replace", "argument 'co_code'", "bytes", args[7]); | 
162  | 0  |             goto exit;  | 
163  | 0  |         }  | 
164  | 0  |         co_code = (PyBytesObject *)args[7];  | 
165  | 0  |         if (!--noptargs) { | 
166  | 0  |             goto skip_optional_kwonly;  | 
167  | 0  |         }  | 
168  | 0  |     }  | 
169  | 0  |     if (args[8]) { | 
170  | 0  |         if (!PyTuple_Check(args[8])) { | 
171  | 0  |             _PyArg_BadArgument("replace", "argument 'co_consts'", "tuple", args[8]); | 
172  | 0  |             goto exit;  | 
173  | 0  |         }  | 
174  | 0  |         co_consts = args[8];  | 
175  | 0  |         if (!--noptargs) { | 
176  | 0  |             goto skip_optional_kwonly;  | 
177  | 0  |         }  | 
178  | 0  |     }  | 
179  | 0  |     if (args[9]) { | 
180  | 0  |         if (!PyTuple_Check(args[9])) { | 
181  | 0  |             _PyArg_BadArgument("replace", "argument 'co_names'", "tuple", args[9]); | 
182  | 0  |             goto exit;  | 
183  | 0  |         }  | 
184  | 0  |         co_names = args[9];  | 
185  | 0  |         if (!--noptargs) { | 
186  | 0  |             goto skip_optional_kwonly;  | 
187  | 0  |         }  | 
188  | 0  |     }  | 
189  | 0  |     if (args[10]) { | 
190  | 0  |         if (!PyTuple_Check(args[10])) { | 
191  | 0  |             _PyArg_BadArgument("replace", "argument 'co_varnames'", "tuple", args[10]); | 
192  | 0  |             goto exit;  | 
193  | 0  |         }  | 
194  | 0  |         co_varnames = args[10];  | 
195  | 0  |         if (!--noptargs) { | 
196  | 0  |             goto skip_optional_kwonly;  | 
197  | 0  |         }  | 
198  | 0  |     }  | 
199  | 0  |     if (args[11]) { | 
200  | 0  |         if (!PyTuple_Check(args[11])) { | 
201  | 0  |             _PyArg_BadArgument("replace", "argument 'co_freevars'", "tuple", args[11]); | 
202  | 0  |             goto exit;  | 
203  | 0  |         }  | 
204  | 0  |         co_freevars = args[11];  | 
205  | 0  |         if (!--noptargs) { | 
206  | 0  |             goto skip_optional_kwonly;  | 
207  | 0  |         }  | 
208  | 0  |     }  | 
209  | 0  |     if (args[12]) { | 
210  | 0  |         if (!PyTuple_Check(args[12])) { | 
211  | 0  |             _PyArg_BadArgument("replace", "argument 'co_cellvars'", "tuple", args[12]); | 
212  | 0  |             goto exit;  | 
213  | 0  |         }  | 
214  | 0  |         co_cellvars = args[12];  | 
215  | 0  |         if (!--noptargs) { | 
216  | 0  |             goto skip_optional_kwonly;  | 
217  | 0  |         }  | 
218  | 0  |     }  | 
219  | 0  |     if (args[13]) { | 
220  | 0  |         if (!PyUnicode_Check(args[13])) { | 
221  | 0  |             _PyArg_BadArgument("replace", "argument 'co_filename'", "str", args[13]); | 
222  | 0  |             goto exit;  | 
223  | 0  |         }  | 
224  | 0  |         if (PyUnicode_READY(args[13]) == -1) { | 
225  | 0  |             goto exit;  | 
226  | 0  |         }  | 
227  | 0  |         co_filename = args[13];  | 
228  | 0  |         if (!--noptargs) { | 
229  | 0  |             goto skip_optional_kwonly;  | 
230  | 0  |         }  | 
231  | 0  |     }  | 
232  | 0  |     if (args[14]) { | 
233  | 0  |         if (!PyUnicode_Check(args[14])) { | 
234  | 0  |             _PyArg_BadArgument("replace", "argument 'co_name'", "str", args[14]); | 
235  | 0  |             goto exit;  | 
236  | 0  |         }  | 
237  | 0  |         if (PyUnicode_READY(args[14]) == -1) { | 
238  | 0  |             goto exit;  | 
239  | 0  |         }  | 
240  | 0  |         co_name = args[14];  | 
241  | 0  |         if (!--noptargs) { | 
242  | 0  |             goto skip_optional_kwonly;  | 
243  | 0  |         }  | 
244  | 0  |     }  | 
245  | 0  |     if (!PyBytes_Check(args[15])) { | 
246  | 0  |         _PyArg_BadArgument("replace", "argument 'co_lnotab'", "bytes", args[15]); | 
247  | 0  |         goto exit;  | 
248  | 0  |     }  | 
249  | 0  |     co_lnotab = (PyBytesObject *)args[15];  | 
250  | 0  | skip_optional_kwonly:  | 
251  | 0  |     return_value = code_replace_impl(self, co_argcount, co_posonlyargcount, co_kwonlyargcount, co_nlocals, co_stacksize, co_flags, co_firstlineno, co_code, co_consts, co_names, co_varnames, co_freevars, co_cellvars, co_filename, co_name, co_lnotab);  | 
252  |  | 
  | 
253  | 0  | exit:  | 
254  | 0  |     return return_value;  | 
255  | 0  | }  | 
256  |  | /*[clinic end generated code: output=27fe34e82106b220 input=a9049054013a1b77]*/  |