1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 PyDoc_STRVAR(_elementtree_Element_append__doc__,
6 "append($self, subelement, /)\n"
7 "--\n"
8 "\n");
9 
10 #define _ELEMENTTREE_ELEMENT_APPEND_METHODDEF    \
11     {"append", (PyCFunction)_elementtree_Element_append, METH_O, _elementtree_Element_append__doc__},
12 
13 static PyObject *
14 _elementtree_Element_append_impl(ElementObject *self, PyObject *subelement);
15 
16 static PyObject *
_elementtree_Element_append(ElementObject * self,PyObject * arg)17 _elementtree_Element_append(ElementObject *self, PyObject *arg)
18 {
19     PyObject *return_value = NULL;
20     PyObject *subelement;
21 
22     if (!PyObject_TypeCheck(arg, &Element_Type)) {
23         _PyArg_BadArgument("append", "argument", (&Element_Type)->tp_name, arg);
24         goto exit;
25     }
26     subelement = arg;
27     return_value = _elementtree_Element_append_impl(self, subelement);
28 
29 exit:
30     return return_value;
31 }
32 
33 PyDoc_STRVAR(_elementtree_Element_clear__doc__,
34 "clear($self, /)\n"
35 "--\n"
36 "\n");
37 
38 #define _ELEMENTTREE_ELEMENT_CLEAR_METHODDEF    \
39     {"clear", (PyCFunction)_elementtree_Element_clear, METH_NOARGS, _elementtree_Element_clear__doc__},
40 
41 static PyObject *
42 _elementtree_Element_clear_impl(ElementObject *self);
43 
44 static PyObject *
_elementtree_Element_clear(ElementObject * self,PyObject * Py_UNUSED (ignored))45 _elementtree_Element_clear(ElementObject *self, PyObject *Py_UNUSED(ignored))
46 {
47     return _elementtree_Element_clear_impl(self);
48 }
49 
50 PyDoc_STRVAR(_elementtree_Element___copy____doc__,
51 "__copy__($self, /)\n"
52 "--\n"
53 "\n");
54 
55 #define _ELEMENTTREE_ELEMENT___COPY___METHODDEF    \
56     {"__copy__", (PyCFunction)_elementtree_Element___copy__, METH_NOARGS, _elementtree_Element___copy____doc__},
57 
58 static PyObject *
59 _elementtree_Element___copy___impl(ElementObject *self);
60 
61 static PyObject *
_elementtree_Element___copy__(ElementObject * self,PyObject * Py_UNUSED (ignored))62 _elementtree_Element___copy__(ElementObject *self, PyObject *Py_UNUSED(ignored))
63 {
64     return _elementtree_Element___copy___impl(self);
65 }
66 
67 PyDoc_STRVAR(_elementtree_Element___deepcopy____doc__,
68 "__deepcopy__($self, memo, /)\n"
69 "--\n"
70 "\n");
71 
72 #define _ELEMENTTREE_ELEMENT___DEEPCOPY___METHODDEF    \
73     {"__deepcopy__", (PyCFunction)_elementtree_Element___deepcopy__, METH_O, _elementtree_Element___deepcopy____doc__},
74 
75 static PyObject *
76 _elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo);
77 
78 static PyObject *
_elementtree_Element___deepcopy__(ElementObject * self,PyObject * arg)79 _elementtree_Element___deepcopy__(ElementObject *self, PyObject *arg)
80 {
81     PyObject *return_value = NULL;
82     PyObject *memo;
83 
84     if (!PyDict_Check(arg)) {
85         _PyArg_BadArgument("__deepcopy__", "argument", "dict", arg);
86         goto exit;
87     }
88     memo = arg;
89     return_value = _elementtree_Element___deepcopy___impl(self, memo);
90 
91 exit:
92     return return_value;
93 }
94 
95 PyDoc_STRVAR(_elementtree_Element___sizeof____doc__,
96 "__sizeof__($self, /)\n"
97 "--\n"
98 "\n");
99 
100 #define _ELEMENTTREE_ELEMENT___SIZEOF___METHODDEF    \
101     {"__sizeof__", (PyCFunction)_elementtree_Element___sizeof__, METH_NOARGS, _elementtree_Element___sizeof____doc__},
102 
103 static Py_ssize_t
104 _elementtree_Element___sizeof___impl(ElementObject *self);
105 
106 static PyObject *
_elementtree_Element___sizeof__(ElementObject * self,PyObject * Py_UNUSED (ignored))107 _elementtree_Element___sizeof__(ElementObject *self, PyObject *Py_UNUSED(ignored))
108 {
109     PyObject *return_value = NULL;
110     Py_ssize_t _return_value;
111 
112     _return_value = _elementtree_Element___sizeof___impl(self);
113     if ((_return_value == -1) && PyErr_Occurred()) {
114         goto exit;
115     }
116     return_value = PyLong_FromSsize_t(_return_value);
117 
118 exit:
119     return return_value;
120 }
121 
122 PyDoc_STRVAR(_elementtree_Element___getstate____doc__,
123 "__getstate__($self, /)\n"
124 "--\n"
125 "\n");
126 
127 #define _ELEMENTTREE_ELEMENT___GETSTATE___METHODDEF    \
128     {"__getstate__", (PyCFunction)_elementtree_Element___getstate__, METH_NOARGS, _elementtree_Element___getstate____doc__},
129 
130 static PyObject *
131 _elementtree_Element___getstate___impl(ElementObject *self);
132 
133 static PyObject *
_elementtree_Element___getstate__(ElementObject * self,PyObject * Py_UNUSED (ignored))134 _elementtree_Element___getstate__(ElementObject *self, PyObject *Py_UNUSED(ignored))
135 {
136     return _elementtree_Element___getstate___impl(self);
137 }
138 
139 PyDoc_STRVAR(_elementtree_Element___setstate____doc__,
140 "__setstate__($self, state, /)\n"
141 "--\n"
142 "\n");
143 
144 #define _ELEMENTTREE_ELEMENT___SETSTATE___METHODDEF    \
145     {"__setstate__", (PyCFunction)_elementtree_Element___setstate__, METH_O, _elementtree_Element___setstate____doc__},
146 
147 PyDoc_STRVAR(_elementtree_Element_extend__doc__,
148 "extend($self, elements, /)\n"
149 "--\n"
150 "\n");
151 
152 #define _ELEMENTTREE_ELEMENT_EXTEND_METHODDEF    \
153     {"extend", (PyCFunction)_elementtree_Element_extend, METH_O, _elementtree_Element_extend__doc__},
154 
155 PyDoc_STRVAR(_elementtree_Element_find__doc__,
156 "find($self, /, path, namespaces=None)\n"
157 "--\n"
158 "\n");
159 
160 #define _ELEMENTTREE_ELEMENT_FIND_METHODDEF    \
161     {"find", (PyCFunction)(void(*)(void))_elementtree_Element_find, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_find__doc__},
162 
163 static PyObject *
164 _elementtree_Element_find_impl(ElementObject *self, PyObject *path,
165                                PyObject *namespaces);
166 
167 static PyObject *
_elementtree_Element_find(ElementObject * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)168 _elementtree_Element_find(ElementObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
169 {
170     PyObject *return_value = NULL;
171     static const char * const _keywords[] = {"path", "namespaces", NULL};
172     static _PyArg_Parser _parser = {NULL, _keywords, "find", 0};
173     PyObject *argsbuf[2];
174     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
175     PyObject *path;
176     PyObject *namespaces = Py_None;
177 
178     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
179     if (!args) {
180         goto exit;
181     }
182     path = args[0];
183     if (!noptargs) {
184         goto skip_optional_pos;
185     }
186     namespaces = args[1];
187 skip_optional_pos:
188     return_value = _elementtree_Element_find_impl(self, path, namespaces);
189 
190 exit:
191     return return_value;
192 }
193 
194 PyDoc_STRVAR(_elementtree_Element_findtext__doc__,
195 "findtext($self, /, path, default=None, namespaces=None)\n"
196 "--\n"
197 "\n");
198 
199 #define _ELEMENTTREE_ELEMENT_FINDTEXT_METHODDEF    \
200     {"findtext", (PyCFunction)(void(*)(void))_elementtree_Element_findtext, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_findtext__doc__},
201 
202 static PyObject *
203 _elementtree_Element_findtext_impl(ElementObject *self, PyObject *path,
204                                    PyObject *default_value,
205                                    PyObject *namespaces);
206 
207 static PyObject *
_elementtree_Element_findtext(ElementObject * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)208 _elementtree_Element_findtext(ElementObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
209 {
210     PyObject *return_value = NULL;
211     static const char * const _keywords[] = {"path", "default", "namespaces", NULL};
212     static _PyArg_Parser _parser = {NULL, _keywords, "findtext", 0};
213     PyObject *argsbuf[3];
214     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
215     PyObject *path;
216     PyObject *default_value = Py_None;
217     PyObject *namespaces = Py_None;
218 
219     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 3, 0, argsbuf);
220     if (!args) {
221         goto exit;
222     }
223     path = args[0];
224     if (!noptargs) {
225         goto skip_optional_pos;
226     }
227     if (args[1]) {
228         default_value = args[1];
229         if (!--noptargs) {
230             goto skip_optional_pos;
231         }
232     }
233     namespaces = args[2];
234 skip_optional_pos:
235     return_value = _elementtree_Element_findtext_impl(self, path, default_value, namespaces);
236 
237 exit:
238     return return_value;
239 }
240 
241 PyDoc_STRVAR(_elementtree_Element_findall__doc__,
242 "findall($self, /, path, namespaces=None)\n"
243 "--\n"
244 "\n");
245 
246 #define _ELEMENTTREE_ELEMENT_FINDALL_METHODDEF    \
247     {"findall", (PyCFunction)(void(*)(void))_elementtree_Element_findall, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_findall__doc__},
248 
249 static PyObject *
250 _elementtree_Element_findall_impl(ElementObject *self, PyObject *path,
251                                   PyObject *namespaces);
252 
253 static PyObject *
_elementtree_Element_findall(ElementObject * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)254 _elementtree_Element_findall(ElementObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
255 {
256     PyObject *return_value = NULL;
257     static const char * const _keywords[] = {"path", "namespaces", NULL};
258     static _PyArg_Parser _parser = {NULL, _keywords, "findall", 0};
259     PyObject *argsbuf[2];
260     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
261     PyObject *path;
262     PyObject *namespaces = Py_None;
263 
264     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
265     if (!args) {
266         goto exit;
267     }
268     path = args[0];
269     if (!noptargs) {
270         goto skip_optional_pos;
271     }
272     namespaces = args[1];
273 skip_optional_pos:
274     return_value = _elementtree_Element_findall_impl(self, path, namespaces);
275 
276 exit:
277     return return_value;
278 }
279 
280 PyDoc_STRVAR(_elementtree_Element_iterfind__doc__,
281 "iterfind($self, /, path, namespaces=None)\n"
282 "--\n"
283 "\n");
284 
285 #define _ELEMENTTREE_ELEMENT_ITERFIND_METHODDEF    \
286     {"iterfind", (PyCFunction)(void(*)(void))_elementtree_Element_iterfind, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_iterfind__doc__},
287 
288 static PyObject *
289 _elementtree_Element_iterfind_impl(ElementObject *self, PyObject *path,
290                                    PyObject *namespaces);
291 
292 static PyObject *
_elementtree_Element_iterfind(ElementObject * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)293 _elementtree_Element_iterfind(ElementObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
294 {
295     PyObject *return_value = NULL;
296     static const char * const _keywords[] = {"path", "namespaces", NULL};
297     static _PyArg_Parser _parser = {NULL, _keywords, "iterfind", 0};
298     PyObject *argsbuf[2];
299     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
300     PyObject *path;
301     PyObject *namespaces = Py_None;
302 
303     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
304     if (!args) {
305         goto exit;
306     }
307     path = args[0];
308     if (!noptargs) {
309         goto skip_optional_pos;
310     }
311     namespaces = args[1];
312 skip_optional_pos:
313     return_value = _elementtree_Element_iterfind_impl(self, path, namespaces);
314 
315 exit:
316     return return_value;
317 }
318 
319 PyDoc_STRVAR(_elementtree_Element_get__doc__,
320 "get($self, /, key, default=None)\n"
321 "--\n"
322 "\n");
323 
324 #define _ELEMENTTREE_ELEMENT_GET_METHODDEF    \
325     {"get", (PyCFunction)(void(*)(void))_elementtree_Element_get, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_get__doc__},
326 
327 static PyObject *
328 _elementtree_Element_get_impl(ElementObject *self, PyObject *key,
329                               PyObject *default_value);
330 
331 static PyObject *
_elementtree_Element_get(ElementObject * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)332 _elementtree_Element_get(ElementObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
333 {
334     PyObject *return_value = NULL;
335     static const char * const _keywords[] = {"key", "default", NULL};
336     static _PyArg_Parser _parser = {NULL, _keywords, "get", 0};
337     PyObject *argsbuf[2];
338     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
339     PyObject *key;
340     PyObject *default_value = Py_None;
341 
342     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
343     if (!args) {
344         goto exit;
345     }
346     key = args[0];
347     if (!noptargs) {
348         goto skip_optional_pos;
349     }
350     default_value = args[1];
351 skip_optional_pos:
352     return_value = _elementtree_Element_get_impl(self, key, default_value);
353 
354 exit:
355     return return_value;
356 }
357 
358 PyDoc_STRVAR(_elementtree_Element_getchildren__doc__,
359 "getchildren($self, /)\n"
360 "--\n"
361 "\n");
362 
363 #define _ELEMENTTREE_ELEMENT_GETCHILDREN_METHODDEF    \
364     {"getchildren", (PyCFunction)_elementtree_Element_getchildren, METH_NOARGS, _elementtree_Element_getchildren__doc__},
365 
366 static PyObject *
367 _elementtree_Element_getchildren_impl(ElementObject *self);
368 
369 static PyObject *
_elementtree_Element_getchildren(ElementObject * self,PyObject * Py_UNUSED (ignored))370 _elementtree_Element_getchildren(ElementObject *self, PyObject *Py_UNUSED(ignored))
371 {
372     return _elementtree_Element_getchildren_impl(self);
373 }
374 
375 PyDoc_STRVAR(_elementtree_Element_iter__doc__,
376 "iter($self, /, tag=None)\n"
377 "--\n"
378 "\n");
379 
380 #define _ELEMENTTREE_ELEMENT_ITER_METHODDEF    \
381     {"iter", (PyCFunction)(void(*)(void))_elementtree_Element_iter, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_iter__doc__},
382 
383 static PyObject *
384 _elementtree_Element_iter_impl(ElementObject *self, PyObject *tag);
385 
386 static PyObject *
_elementtree_Element_iter(ElementObject * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)387 _elementtree_Element_iter(ElementObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
388 {
389     PyObject *return_value = NULL;
390     static const char * const _keywords[] = {"tag", NULL};
391     static _PyArg_Parser _parser = {NULL, _keywords, "iter", 0};
392     PyObject *argsbuf[1];
393     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
394     PyObject *tag = Py_None;
395 
396     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
397     if (!args) {
398         goto exit;
399     }
400     if (!noptargs) {
401         goto skip_optional_pos;
402     }
403     tag = args[0];
404 skip_optional_pos:
405     return_value = _elementtree_Element_iter_impl(self, tag);
406 
407 exit:
408     return return_value;
409 }
410 
411 PyDoc_STRVAR(_elementtree_Element_getiterator__doc__,
412 "getiterator($self, /, tag=None)\n"
413 "--\n"
414 "\n");
415 
416 #define _ELEMENTTREE_ELEMENT_GETITERATOR_METHODDEF    \
417     {"getiterator", (PyCFunction)(void(*)(void))_elementtree_Element_getiterator, METH_FASTCALL|METH_KEYWORDS, _elementtree_Element_getiterator__doc__},
418 
419 static PyObject *
420 _elementtree_Element_getiterator_impl(ElementObject *self, PyObject *tag);
421 
422 static PyObject *
_elementtree_Element_getiterator(ElementObject * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)423 _elementtree_Element_getiterator(ElementObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
424 {
425     PyObject *return_value = NULL;
426     static const char * const _keywords[] = {"tag", NULL};
427     static _PyArg_Parser _parser = {NULL, _keywords, "getiterator", 0};
428     PyObject *argsbuf[1];
429     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
430     PyObject *tag = Py_None;
431 
432     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
433     if (!args) {
434         goto exit;
435     }
436     if (!noptargs) {
437         goto skip_optional_pos;
438     }
439     tag = args[0];
440 skip_optional_pos:
441     return_value = _elementtree_Element_getiterator_impl(self, tag);
442 
443 exit:
444     return return_value;
445 }
446 
447 PyDoc_STRVAR(_elementtree_Element_itertext__doc__,
448 "itertext($self, /)\n"
449 "--\n"
450 "\n");
451 
452 #define _ELEMENTTREE_ELEMENT_ITERTEXT_METHODDEF    \
453     {"itertext", (PyCFunction)_elementtree_Element_itertext, METH_NOARGS, _elementtree_Element_itertext__doc__},
454 
455 static PyObject *
456 _elementtree_Element_itertext_impl(ElementObject *self);
457 
458 static PyObject *
_elementtree_Element_itertext(ElementObject * self,PyObject * Py_UNUSED (ignored))459 _elementtree_Element_itertext(ElementObject *self, PyObject *Py_UNUSED(ignored))
460 {
461     return _elementtree_Element_itertext_impl(self);
462 }
463 
464 PyDoc_STRVAR(_elementtree_Element_insert__doc__,
465 "insert($self, index, subelement, /)\n"
466 "--\n"
467 "\n");
468 
469 #define _ELEMENTTREE_ELEMENT_INSERT_METHODDEF    \
470     {"insert", (PyCFunction)(void(*)(void))_elementtree_Element_insert, METH_FASTCALL, _elementtree_Element_insert__doc__},
471 
472 static PyObject *
473 _elementtree_Element_insert_impl(ElementObject *self, Py_ssize_t index,
474                                  PyObject *subelement);
475 
476 static PyObject *
_elementtree_Element_insert(ElementObject * self,PyObject * const * args,Py_ssize_t nargs)477 _elementtree_Element_insert(ElementObject *self, PyObject *const *args, Py_ssize_t nargs)
478 {
479     PyObject *return_value = NULL;
480     Py_ssize_t index;
481     PyObject *subelement;
482 
483     if (!_PyArg_CheckPositional("insert", nargs, 2, 2)) {
484         goto exit;
485     }
486     if (PyFloat_Check(args[0])) {
487         PyErr_SetString(PyExc_TypeError,
488                         "integer argument expected, got float" );
489         goto exit;
490     }
491     {
492         Py_ssize_t ival = -1;
493         PyObject *iobj = PyNumber_Index(args[0]);
494         if (iobj != NULL) {
495             ival = PyLong_AsSsize_t(iobj);
496             Py_DECREF(iobj);
497         }
498         if (ival == -1 && PyErr_Occurred()) {
499             goto exit;
500         }
501         index = ival;
502     }
503     if (!PyObject_TypeCheck(args[1], &Element_Type)) {
504         _PyArg_BadArgument("insert", "argument 2", (&Element_Type)->tp_name, args[1]);
505         goto exit;
506     }
507     subelement = args[1];
508     return_value = _elementtree_Element_insert_impl(self, index, subelement);
509 
510 exit:
511     return return_value;
512 }
513 
514 PyDoc_STRVAR(_elementtree_Element_items__doc__,
515 "items($self, /)\n"
516 "--\n"
517 "\n");
518 
519 #define _ELEMENTTREE_ELEMENT_ITEMS_METHODDEF    \
520     {"items", (PyCFunction)_elementtree_Element_items, METH_NOARGS, _elementtree_Element_items__doc__},
521 
522 static PyObject *
523 _elementtree_Element_items_impl(ElementObject *self);
524 
525 static PyObject *
_elementtree_Element_items(ElementObject * self,PyObject * Py_UNUSED (ignored))526 _elementtree_Element_items(ElementObject *self, PyObject *Py_UNUSED(ignored))
527 {
528     return _elementtree_Element_items_impl(self);
529 }
530 
531 PyDoc_STRVAR(_elementtree_Element_keys__doc__,
532 "keys($self, /)\n"
533 "--\n"
534 "\n");
535 
536 #define _ELEMENTTREE_ELEMENT_KEYS_METHODDEF    \
537     {"keys", (PyCFunction)_elementtree_Element_keys, METH_NOARGS, _elementtree_Element_keys__doc__},
538 
539 static PyObject *
540 _elementtree_Element_keys_impl(ElementObject *self);
541 
542 static PyObject *
_elementtree_Element_keys(ElementObject * self,PyObject * Py_UNUSED (ignored))543 _elementtree_Element_keys(ElementObject *self, PyObject *Py_UNUSED(ignored))
544 {
545     return _elementtree_Element_keys_impl(self);
546 }
547 
548 PyDoc_STRVAR(_elementtree_Element_makeelement__doc__,
549 "makeelement($self, tag, attrib, /)\n"
550 "--\n"
551 "\n");
552 
553 #define _ELEMENTTREE_ELEMENT_MAKEELEMENT_METHODDEF    \
554     {"makeelement", (PyCFunction)(void(*)(void))_elementtree_Element_makeelement, METH_FASTCALL, _elementtree_Element_makeelement__doc__},
555 
556 static PyObject *
557 _elementtree_Element_makeelement_impl(ElementObject *self, PyObject *tag,
558                                       PyObject *attrib);
559 
560 static PyObject *
_elementtree_Element_makeelement(ElementObject * self,PyObject * const * args,Py_ssize_t nargs)561 _elementtree_Element_makeelement(ElementObject *self, PyObject *const *args, Py_ssize_t nargs)
562 {
563     PyObject *return_value = NULL;
564     PyObject *tag;
565     PyObject *attrib;
566 
567     if (!_PyArg_CheckPositional("makeelement", nargs, 2, 2)) {
568         goto exit;
569     }
570     tag = args[0];
571     attrib = args[1];
572     return_value = _elementtree_Element_makeelement_impl(self, tag, attrib);
573 
574 exit:
575     return return_value;
576 }
577 
578 PyDoc_STRVAR(_elementtree_Element_remove__doc__,
579 "remove($self, subelement, /)\n"
580 "--\n"
581 "\n");
582 
583 #define _ELEMENTTREE_ELEMENT_REMOVE_METHODDEF    \
584     {"remove", (PyCFunction)_elementtree_Element_remove, METH_O, _elementtree_Element_remove__doc__},
585 
586 static PyObject *
587 _elementtree_Element_remove_impl(ElementObject *self, PyObject *subelement);
588 
589 static PyObject *
_elementtree_Element_remove(ElementObject * self,PyObject * arg)590 _elementtree_Element_remove(ElementObject *self, PyObject *arg)
591 {
592     PyObject *return_value = NULL;
593     PyObject *subelement;
594 
595     if (!PyObject_TypeCheck(arg, &Element_Type)) {
596         _PyArg_BadArgument("remove", "argument", (&Element_Type)->tp_name, arg);
597         goto exit;
598     }
599     subelement = arg;
600     return_value = _elementtree_Element_remove_impl(self, subelement);
601 
602 exit:
603     return return_value;
604 }
605 
606 PyDoc_STRVAR(_elementtree_Element_set__doc__,
607 "set($self, key, value, /)\n"
608 "--\n"
609 "\n");
610 
611 #define _ELEMENTTREE_ELEMENT_SET_METHODDEF    \
612     {"set", (PyCFunction)(void(*)(void))_elementtree_Element_set, METH_FASTCALL, _elementtree_Element_set__doc__},
613 
614 static PyObject *
615 _elementtree_Element_set_impl(ElementObject *self, PyObject *key,
616                               PyObject *value);
617 
618 static PyObject *
_elementtree_Element_set(ElementObject * self,PyObject * const * args,Py_ssize_t nargs)619 _elementtree_Element_set(ElementObject *self, PyObject *const *args, Py_ssize_t nargs)
620 {
621     PyObject *return_value = NULL;
622     PyObject *key;
623     PyObject *value;
624 
625     if (!_PyArg_CheckPositional("set", nargs, 2, 2)) {
626         goto exit;
627     }
628     key = args[0];
629     value = args[1];
630     return_value = _elementtree_Element_set_impl(self, key, value);
631 
632 exit:
633     return return_value;
634 }
635 
636 static int
637 _elementtree_TreeBuilder___init___impl(TreeBuilderObject *self,
638                                        PyObject *element_factory,
639                                        PyObject *comment_factory,
640                                        PyObject *pi_factory,
641                                        int insert_comments, int insert_pis);
642 
643 static int
_elementtree_TreeBuilder___init__(PyObject * self,PyObject * args,PyObject * kwargs)644 _elementtree_TreeBuilder___init__(PyObject *self, PyObject *args, PyObject *kwargs)
645 {
646     int return_value = -1;
647     static const char * const _keywords[] = {"element_factory", "comment_factory", "pi_factory", "insert_comments", "insert_pis", NULL};
648     static _PyArg_Parser _parser = {NULL, _keywords, "TreeBuilder", 0};
649     PyObject *argsbuf[5];
650     PyObject * const *fastargs;
651     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
652     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
653     PyObject *element_factory = Py_None;
654     PyObject *comment_factory = Py_None;
655     PyObject *pi_factory = Py_None;
656     int insert_comments = 0;
657     int insert_pis = 0;
658 
659     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 1, 0, argsbuf);
660     if (!fastargs) {
661         goto exit;
662     }
663     if (!noptargs) {
664         goto skip_optional_pos;
665     }
666     if (fastargs[0]) {
667         element_factory = fastargs[0];
668         if (!--noptargs) {
669             goto skip_optional_pos;
670         }
671     }
672 skip_optional_pos:
673     if (!noptargs) {
674         goto skip_optional_kwonly;
675     }
676     if (fastargs[1]) {
677         comment_factory = fastargs[1];
678         if (!--noptargs) {
679             goto skip_optional_kwonly;
680         }
681     }
682     if (fastargs[2]) {
683         pi_factory = fastargs[2];
684         if (!--noptargs) {
685             goto skip_optional_kwonly;
686         }
687     }
688     if (fastargs[3]) {
689         insert_comments = PyObject_IsTrue(fastargs[3]);
690         if (insert_comments < 0) {
691             goto exit;
692         }
693         if (!--noptargs) {
694             goto skip_optional_kwonly;
695         }
696     }
697     insert_pis = PyObject_IsTrue(fastargs[4]);
698     if (insert_pis < 0) {
699         goto exit;
700     }
701 skip_optional_kwonly:
702     return_value = _elementtree_TreeBuilder___init___impl((TreeBuilderObject *)self, element_factory, comment_factory, pi_factory, insert_comments, insert_pis);
703 
704 exit:
705     return return_value;
706 }
707 
708 PyDoc_STRVAR(_elementtree__set_factories__doc__,
709 "_set_factories($module, comment_factory, pi_factory, /)\n"
710 "--\n"
711 "\n"
712 "Change the factories used to create comments and processing instructions.\n"
713 "\n"
714 "For internal use only.");
715 
716 #define _ELEMENTTREE__SET_FACTORIES_METHODDEF    \
717     {"_set_factories", (PyCFunction)(void(*)(void))_elementtree__set_factories, METH_FASTCALL, _elementtree__set_factories__doc__},
718 
719 static PyObject *
720 _elementtree__set_factories_impl(PyObject *module, PyObject *comment_factory,
721                                  PyObject *pi_factory);
722 
723 static PyObject *
_elementtree__set_factories(PyObject * module,PyObject * const * args,Py_ssize_t nargs)724 _elementtree__set_factories(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
725 {
726     PyObject *return_value = NULL;
727     PyObject *comment_factory;
728     PyObject *pi_factory;
729 
730     if (!_PyArg_CheckPositional("_set_factories", nargs, 2, 2)) {
731         goto exit;
732     }
733     comment_factory = args[0];
734     pi_factory = args[1];
735     return_value = _elementtree__set_factories_impl(module, comment_factory, pi_factory);
736 
737 exit:
738     return return_value;
739 }
740 
741 PyDoc_STRVAR(_elementtree_TreeBuilder_data__doc__,
742 "data($self, data, /)\n"
743 "--\n"
744 "\n");
745 
746 #define _ELEMENTTREE_TREEBUILDER_DATA_METHODDEF    \
747     {"data", (PyCFunction)_elementtree_TreeBuilder_data, METH_O, _elementtree_TreeBuilder_data__doc__},
748 
749 PyDoc_STRVAR(_elementtree_TreeBuilder_end__doc__,
750 "end($self, tag, /)\n"
751 "--\n"
752 "\n");
753 
754 #define _ELEMENTTREE_TREEBUILDER_END_METHODDEF    \
755     {"end", (PyCFunction)_elementtree_TreeBuilder_end, METH_O, _elementtree_TreeBuilder_end__doc__},
756 
757 PyDoc_STRVAR(_elementtree_TreeBuilder_comment__doc__,
758 "comment($self, text, /)\n"
759 "--\n"
760 "\n");
761 
762 #define _ELEMENTTREE_TREEBUILDER_COMMENT_METHODDEF    \
763     {"comment", (PyCFunction)_elementtree_TreeBuilder_comment, METH_O, _elementtree_TreeBuilder_comment__doc__},
764 
765 PyDoc_STRVAR(_elementtree_TreeBuilder_pi__doc__,
766 "pi($self, target, text=None, /)\n"
767 "--\n"
768 "\n");
769 
770 #define _ELEMENTTREE_TREEBUILDER_PI_METHODDEF    \
771     {"pi", (PyCFunction)(void(*)(void))_elementtree_TreeBuilder_pi, METH_FASTCALL, _elementtree_TreeBuilder_pi__doc__},
772 
773 static PyObject *
774 _elementtree_TreeBuilder_pi_impl(TreeBuilderObject *self, PyObject *target,
775                                  PyObject *text);
776 
777 static PyObject *
_elementtree_TreeBuilder_pi(TreeBuilderObject * self,PyObject * const * args,Py_ssize_t nargs)778 _elementtree_TreeBuilder_pi(TreeBuilderObject *self, PyObject *const *args, Py_ssize_t nargs)
779 {
780     PyObject *return_value = NULL;
781     PyObject *target;
782     PyObject *text = Py_None;
783 
784     if (!_PyArg_CheckPositional("pi", nargs, 1, 2)) {
785         goto exit;
786     }
787     target = args[0];
788     if (nargs < 2) {
789         goto skip_optional;
790     }
791     text = args[1];
792 skip_optional:
793     return_value = _elementtree_TreeBuilder_pi_impl(self, target, text);
794 
795 exit:
796     return return_value;
797 }
798 
799 PyDoc_STRVAR(_elementtree_TreeBuilder_close__doc__,
800 "close($self, /)\n"
801 "--\n"
802 "\n");
803 
804 #define _ELEMENTTREE_TREEBUILDER_CLOSE_METHODDEF    \
805     {"close", (PyCFunction)_elementtree_TreeBuilder_close, METH_NOARGS, _elementtree_TreeBuilder_close__doc__},
806 
807 static PyObject *
808 _elementtree_TreeBuilder_close_impl(TreeBuilderObject *self);
809 
810 static PyObject *
_elementtree_TreeBuilder_close(TreeBuilderObject * self,PyObject * Py_UNUSED (ignored))811 _elementtree_TreeBuilder_close(TreeBuilderObject *self, PyObject *Py_UNUSED(ignored))
812 {
813     return _elementtree_TreeBuilder_close_impl(self);
814 }
815 
816 PyDoc_STRVAR(_elementtree_TreeBuilder_start__doc__,
817 "start($self, tag, attrs=None, /)\n"
818 "--\n"
819 "\n");
820 
821 #define _ELEMENTTREE_TREEBUILDER_START_METHODDEF    \
822     {"start", (PyCFunction)(void(*)(void))_elementtree_TreeBuilder_start, METH_FASTCALL, _elementtree_TreeBuilder_start__doc__},
823 
824 static PyObject *
825 _elementtree_TreeBuilder_start_impl(TreeBuilderObject *self, PyObject *tag,
826                                     PyObject *attrs);
827 
828 static PyObject *
_elementtree_TreeBuilder_start(TreeBuilderObject * self,PyObject * const * args,Py_ssize_t nargs)829 _elementtree_TreeBuilder_start(TreeBuilderObject *self, PyObject *const *args, Py_ssize_t nargs)
830 {
831     PyObject *return_value = NULL;
832     PyObject *tag;
833     PyObject *attrs = Py_None;
834 
835     if (!_PyArg_CheckPositional("start", nargs, 1, 2)) {
836         goto exit;
837     }
838     tag = args[0];
839     if (nargs < 2) {
840         goto skip_optional;
841     }
842     attrs = args[1];
843 skip_optional:
844     return_value = _elementtree_TreeBuilder_start_impl(self, tag, attrs);
845 
846 exit:
847     return return_value;
848 }
849 
850 static int
851 _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *target,
852                                      const char *encoding);
853 
854 static int
_elementtree_XMLParser___init__(PyObject * self,PyObject * args,PyObject * kwargs)855 _elementtree_XMLParser___init__(PyObject *self, PyObject *args, PyObject *kwargs)
856 {
857     int return_value = -1;
858     static const char * const _keywords[] = {"target", "encoding", NULL};
859     static _PyArg_Parser _parser = {NULL, _keywords, "XMLParser", 0};
860     PyObject *argsbuf[2];
861     PyObject * const *fastargs;
862     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
863     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
864     PyObject *target = NULL;
865     const char *encoding = NULL;
866 
867     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 0, 0, argsbuf);
868     if (!fastargs) {
869         goto exit;
870     }
871     if (!noptargs) {
872         goto skip_optional_kwonly;
873     }
874     if (fastargs[0]) {
875         target = fastargs[0];
876         if (!--noptargs) {
877             goto skip_optional_kwonly;
878         }
879     }
880     if (fastargs[1] == Py_None) {
881         encoding = NULL;
882     }
883     else if (PyUnicode_Check(fastargs[1])) {
884         Py_ssize_t encoding_length;
885         encoding = PyUnicode_AsUTF8AndSize(fastargs[1], &encoding_length);
886         if (encoding == NULL) {
887             goto exit;
888         }
889         if (strlen(encoding) != (size_t)encoding_length) {
890             PyErr_SetString(PyExc_ValueError, "embedded null character");
891             goto exit;
892         }
893     }
894     else {
895         _PyArg_BadArgument("XMLParser", "argument 'encoding'", "str or None", fastargs[1]);
896         goto exit;
897     }
898 skip_optional_kwonly:
899     return_value = _elementtree_XMLParser___init___impl((XMLParserObject *)self, target, encoding);
900 
901 exit:
902     return return_value;
903 }
904 
905 PyDoc_STRVAR(_elementtree_XMLParser_close__doc__,
906 "close($self, /)\n"
907 "--\n"
908 "\n");
909 
910 #define _ELEMENTTREE_XMLPARSER_CLOSE_METHODDEF    \
911     {"close", (PyCFunction)_elementtree_XMLParser_close, METH_NOARGS, _elementtree_XMLParser_close__doc__},
912 
913 static PyObject *
914 _elementtree_XMLParser_close_impl(XMLParserObject *self);
915 
916 static PyObject *
_elementtree_XMLParser_close(XMLParserObject * self,PyObject * Py_UNUSED (ignored))917 _elementtree_XMLParser_close(XMLParserObject *self, PyObject *Py_UNUSED(ignored))
918 {
919     return _elementtree_XMLParser_close_impl(self);
920 }
921 
922 PyDoc_STRVAR(_elementtree_XMLParser_feed__doc__,
923 "feed($self, data, /)\n"
924 "--\n"
925 "\n");
926 
927 #define _ELEMENTTREE_XMLPARSER_FEED_METHODDEF    \
928     {"feed", (PyCFunction)_elementtree_XMLParser_feed, METH_O, _elementtree_XMLParser_feed__doc__},
929 
930 PyDoc_STRVAR(_elementtree_XMLParser__parse_whole__doc__,
931 "_parse_whole($self, file, /)\n"
932 "--\n"
933 "\n");
934 
935 #define _ELEMENTTREE_XMLPARSER__PARSE_WHOLE_METHODDEF    \
936     {"_parse_whole", (PyCFunction)_elementtree_XMLParser__parse_whole, METH_O, _elementtree_XMLParser__parse_whole__doc__},
937 
938 PyDoc_STRVAR(_elementtree_XMLParser__setevents__doc__,
939 "_setevents($self, events_queue, events_to_report=None, /)\n"
940 "--\n"
941 "\n");
942 
943 #define _ELEMENTTREE_XMLPARSER__SETEVENTS_METHODDEF    \
944     {"_setevents", (PyCFunction)(void(*)(void))_elementtree_XMLParser__setevents, METH_FASTCALL, _elementtree_XMLParser__setevents__doc__},
945 
946 static PyObject *
947 _elementtree_XMLParser__setevents_impl(XMLParserObject *self,
948                                        PyObject *events_queue,
949                                        PyObject *events_to_report);
950 
951 static PyObject *
_elementtree_XMLParser__setevents(XMLParserObject * self,PyObject * const * args,Py_ssize_t nargs)952 _elementtree_XMLParser__setevents(XMLParserObject *self, PyObject *const *args, Py_ssize_t nargs)
953 {
954     PyObject *return_value = NULL;
955     PyObject *events_queue;
956     PyObject *events_to_report = Py_None;
957 
958     if (!_PyArg_CheckPositional("_setevents", nargs, 1, 2)) {
959         goto exit;
960     }
961     events_queue = args[0];
962     if (nargs < 2) {
963         goto skip_optional;
964     }
965     events_to_report = args[1];
966 skip_optional:
967     return_value = _elementtree_XMLParser__setevents_impl(self, events_queue, events_to_report);
968 
969 exit:
970     return return_value;
971 }
972 /*[clinic end generated code: output=1443ed7bb9f9e03e input=a9049054013a1b77]*/
973