summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/_elementtree.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/clinic/_elementtree.c.h')
-rw-r--r--Modules/clinic/_elementtree.c.h128
1 files changed, 122 insertions, 6 deletions
diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h
index d239c80..0f55480 100644
--- a/Modules/clinic/_elementtree.c.h
+++ b/Modules/clinic/_elementtree.c.h
@@ -635,19 +635,26 @@ exit:
static int
_elementtree_TreeBuilder___init___impl(TreeBuilderObject *self,
- PyObject *element_factory);
+ PyObject *element_factory,
+ PyObject *comment_factory,
+ PyObject *pi_factory,
+ int insert_comments, int insert_pis);
static int
_elementtree_TreeBuilder___init__(PyObject *self, PyObject *args, PyObject *kwargs)
{
int return_value = -1;
- static const char * const _keywords[] = {"element_factory", NULL};
+ static const char * const _keywords[] = {"element_factory", "comment_factory", "pi_factory", "insert_comments", "insert_pis", NULL};
static _PyArg_Parser _parser = {NULL, _keywords, "TreeBuilder", 0};
- PyObject *argsbuf[1];
+ PyObject *argsbuf[5];
PyObject * const *fastargs;
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
PyObject *element_factory = NULL;
+ PyObject *comment_factory = NULL;
+ PyObject *pi_factory = NULL;
+ int insert_comments = 0;
+ int insert_pis = 0;
fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 1, 0, argsbuf);
if (!fastargs) {
@@ -656,9 +663,76 @@ _elementtree_TreeBuilder___init__(PyObject *self, PyObject *args, PyObject *kwar
if (!noptargs) {
goto skip_optional_pos;
}
- element_factory = fastargs[0];
+ if (fastargs[0]) {
+ element_factory = fastargs[0];
+ if (!--noptargs) {
+ goto skip_optional_pos;
+ }
+ }
skip_optional_pos:
- return_value = _elementtree_TreeBuilder___init___impl((TreeBuilderObject *)self, element_factory);
+ if (!noptargs) {
+ goto skip_optional_kwonly;
+ }
+ if (fastargs[1]) {
+ comment_factory = fastargs[1];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (fastargs[2]) {
+ pi_factory = fastargs[2];
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ if (fastargs[3]) {
+ insert_comments = PyObject_IsTrue(fastargs[3]);
+ if (insert_comments < 0) {
+ goto exit;
+ }
+ if (!--noptargs) {
+ goto skip_optional_kwonly;
+ }
+ }
+ insert_pis = PyObject_IsTrue(fastargs[4]);
+ if (insert_pis < 0) {
+ goto exit;
+ }
+skip_optional_kwonly:
+ return_value = _elementtree_TreeBuilder___init___impl((TreeBuilderObject *)self, element_factory, comment_factory, pi_factory, insert_comments, insert_pis);
+
+exit:
+ return return_value;
+}
+
+PyDoc_STRVAR(_elementtree__set_factories__doc__,
+"_set_factories($module, comment_factory, pi_factory, /)\n"
+"--\n"
+"\n"
+"Change the factories used to create comments and processing instructions.\n"
+"\n"
+"For internal use only.");
+
+#define _ELEMENTTREE__SET_FACTORIES_METHODDEF \
+ {"_set_factories", (PyCFunction)(void(*)(void))_elementtree__set_factories, METH_FASTCALL, _elementtree__set_factories__doc__},
+
+static PyObject *
+_elementtree__set_factories_impl(PyObject *module, PyObject *comment_factory,
+ PyObject *pi_factory);
+
+static PyObject *
+_elementtree__set_factories(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ PyObject *comment_factory;
+ PyObject *pi_factory;
+
+ if (!_PyArg_CheckPositional("_set_factories", nargs, 2, 2)) {
+ goto exit;
+ }
+ comment_factory = args[0];
+ pi_factory = args[1];
+ return_value = _elementtree__set_factories_impl(module, comment_factory, pi_factory);
exit:
return return_value;
@@ -680,6 +754,48 @@ PyDoc_STRVAR(_elementtree_TreeBuilder_end__doc__,
#define _ELEMENTTREE_TREEBUILDER_END_METHODDEF \
{"end", (PyCFunction)_elementtree_TreeBuilder_end, METH_O, _elementtree_TreeBuilder_end__doc__},
+PyDoc_STRVAR(_elementtree_TreeBuilder_comment__doc__,
+"comment($self, text, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_TREEBUILDER_COMMENT_METHODDEF \
+ {"comment", (PyCFunction)_elementtree_TreeBuilder_comment, METH_O, _elementtree_TreeBuilder_comment__doc__},
+
+PyDoc_STRVAR(_elementtree_TreeBuilder_pi__doc__,
+"pi($self, target, text=None, /)\n"
+"--\n"
+"\n");
+
+#define _ELEMENTTREE_TREEBUILDER_PI_METHODDEF \
+ {"pi", (PyCFunction)(void(*)(void))_elementtree_TreeBuilder_pi, METH_FASTCALL, _elementtree_TreeBuilder_pi__doc__},
+
+static PyObject *
+_elementtree_TreeBuilder_pi_impl(TreeBuilderObject *self, PyObject *target,
+ PyObject *text);
+
+static PyObject *
+_elementtree_TreeBuilder_pi(TreeBuilderObject *self, PyObject *const *args, Py_ssize_t nargs)
+{
+ PyObject *return_value = NULL;
+ PyObject *target;
+ PyObject *text = Py_None;
+
+ if (!_PyArg_CheckPositional("pi", nargs, 1, 2)) {
+ goto exit;
+ }
+ target = args[0];
+ if (nargs < 2) {
+ goto skip_optional;
+ }
+ text = args[1];
+skip_optional:
+ return_value = _elementtree_TreeBuilder_pi_impl(self, target, text);
+
+exit:
+ return return_value;
+}
+
PyDoc_STRVAR(_elementtree_TreeBuilder_close__doc__,
"close($self, /)\n"
"--\n"
@@ -853,4 +969,4 @@ skip_optional:
exit:
return return_value;
}
-/*[clinic end generated code: output=440b5d90a4b86590 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=386a68425d072b5c input=a9049054013a1b77]*/