diff options
| author | shadchin <[email protected]> | 2024-04-28 21:17:44 +0300 |
|---|---|---|
| committer | shadchin <[email protected]> | 2024-04-28 21:25:54 +0300 |
| commit | a55d99a3eb72f90355bc146baeda18aa7eb97352 (patch) | |
| tree | b17cfed786effe8b81bba022239d6729f716fbeb /contrib/tools/python3/Modules/_elementtree.c | |
| parent | 67bf49d08acf1277eff4c336021ac22d964bb4c4 (diff) | |
Update Python 3 to 3.12.3
7d09de7d8b99ea2be554ef0fc61276942ca9c2e1
Diffstat (limited to 'contrib/tools/python3/Modules/_elementtree.c')
| -rw-r--r-- | contrib/tools/python3/Modules/_elementtree.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/contrib/tools/python3/Modules/_elementtree.c b/contrib/tools/python3/Modules/_elementtree.c index 620de8bb4c6..fcd4be9338f 100644 --- a/contrib/tools/python3/Modules/_elementtree.c +++ b/contrib/tools/python3/Modules/_elementtree.c @@ -3896,6 +3896,40 @@ _elementtree_XMLParser_close_impl(XMLParserObject *self) } /*[clinic input] +_elementtree.XMLParser.flush + +[clinic start generated code]*/ + +static PyObject * +_elementtree_XMLParser_flush_impl(XMLParserObject *self) +/*[clinic end generated code: output=42fdb8795ca24509 input=effbecdb28715949]*/ +{ + if (!_check_xmlparser(self)) { + return NULL; + } + + elementtreestate *st = self->state; + + if (EXPAT(st, SetReparseDeferralEnabled) == NULL) { + Py_RETURN_NONE; + } + + // NOTE: The Expat parser in the C implementation of ElementTree is not + // exposed to the outside; as a result we known that reparse deferral + // is currently enabled, or we would not even have access to function + // XML_SetReparseDeferralEnabled in the first place (which we checked + // for, a few lines up). + + EXPAT(st, SetReparseDeferralEnabled)(self->parser, XML_FALSE); + + PyObject *res = expat_parse(st, self, "", 0, XML_FALSE); + + EXPAT(st, SetReparseDeferralEnabled)(self->parser, XML_TRUE); + + return res; +} + +/*[clinic input] _elementtree.XMLParser.feed data: object @@ -4289,6 +4323,7 @@ static PyType_Spec treebuilder_spec = { static PyMethodDef xmlparser_methods[] = { _ELEMENTTREE_XMLPARSER_FEED_METHODDEF _ELEMENTTREE_XMLPARSER_CLOSE_METHODDEF + _ELEMENTTREE_XMLPARSER_FLUSH_METHODDEF _ELEMENTTREE_XMLPARSER__PARSE_WHOLE_METHODDEF _ELEMENTTREE_XMLPARSER__SETEVENTS_METHODDEF {NULL, NULL} |
