diff -r 08042f0dbb67 Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst Sun Jan 08 23:30:05 2017 +0800 +++ b/Doc/library/xml.etree.elementtree.rst Sun Jan 08 19:50:25 2017 +0200 @@ -15,7 +15,6 @@ for parsing and creating XML data. .. versionchanged:: 3.3 This module will use a fast implementation whenever available. - The :mod:`xml.etree.cElementTree` module is deprecated. .. warning:: @@ -765,18 +764,6 @@ Element Objects to full name. - .. method:: getchildren() - - .. deprecated:: 3.2 - Use ``list(elem)`` or iteration. - - - .. method:: getiterator(tag=None) - - .. deprecated:: 3.2 - Use method :meth:`Element.iter` instead. - - .. method:: insert(index, subelement) Inserts *subelement* at the given position in this element. Raises @@ -881,12 +868,6 @@ ElementTree Objects Same as :meth:`Element.findtext`, starting at the root of the tree. - .. method:: getiterator(tag=None) - - .. deprecated:: 3.2 - Use method :meth:`ElementTree.iter` instead. - - .. method:: getroot() Returns the root element for this tree. @@ -1045,20 +1026,20 @@ XMLParser Objects ^^^^^^^^^^^^^^^^^ -.. class:: XMLParser(html=0, target=None, encoding=None) +.. class:: XMLParser(*, target=None, encoding=None) This class is the low-level building block of the module. It uses :mod:`xml.parsers.expat` for efficient, event-based parsing of XML. It can be fed XML data incrementally with the :meth:`feed` method, and parsing events are translated to a push API - by invoking callbacks on the *target* object. If *target* is omitted, the standard :class:`TreeBuilder` is used. - The *html* argument was historically used for backwards compatibility and is - now deprecated. If *encoding* [1]_ is given, the value overrides the + If *encoding* [1]_ is given, the value overrides the encoding specified in the XML file. - .. deprecated:: 3.4 - The *html* argument. The remaining arguments should be passed via - keyword to prepare for the removal of the *html* argument. + .. versionchanged:: 3.7 + Arguments now are :ref:`keyword-only `. + The *html* argument no longer supported. + .. method:: close() @@ -1067,13 +1048,6 @@ XMLParser Objects this is the toplevel document element. - .. method:: doctype(name, pubid, system) - - .. deprecated:: 3.2 - Define the :meth:`TreeBuilder.doctype` method on a custom TreeBuilder - target. - - .. method:: feed(data) Feeds data to the parser. *data* is encoded data. diff -r 08042f0dbb67 Lib/test/test_xml_etree.py --- a/Lib/test/test_xml_etree.py Sun Jan 08 23:30:05 2017 +0800 +++ b/Lib/test/test_xml_etree.py Sun Jan 08 19:50:25 2017 +0200 @@ -219,7 +219,6 @@ class ElementTreeTest(unittest.TestCase) check_method(element.extend) check_method(element.insert) check_method(element.remove) - check_method(element.getchildren) check_method(element.find) check_method(element.iterfind) check_method(element.findall) @@ -231,7 +230,6 @@ class ElementTreeTest(unittest.TestCase) check_method(element.items) check_method(element.iter) check_method(element.itertext) - check_method(element.getiterator) # These methods return an iterable. See bug 6472. @@ -690,20 +688,20 @@ class ElementTreeTest(unittest.TestCase) ]) - def test_getchildren(self): - # Test Element.getchildren() + def test_children(self): + # Test Element children iteration with open(SIMPLE_XMLFILE, "rb") as f: tree = ET.parse(f) - self.assertEqual([summarize_list(elem.getchildren()) + self.assertEqual([summarize_list(elem) for elem in tree.getroot().iter()], [ ['element', 'element', 'empty-element'], [], [], [], ]) - self.assertEqual([summarize_list(elem.getchildren()) - for elem in tree.getiterator()], [ + self.assertEqual([summarize_list(elem) + for elem in tree.iter()], [ ['element', 'element', 'empty-element'], [], [], @@ -711,13 +709,13 @@ class ElementTreeTest(unittest.TestCase) ]) elem = ET.XML(SAMPLE_XML) - self.assertEqual(len(elem.getchildren()), 3) - self.assertEqual(len(elem[2].getchildren()), 1) - self.assertEqual(elem[:], elem.getchildren()) + self.assertEqual(len(list(elem)), 3) + self.assertEqual(len(list(elem[2])), 1) + self.assertEqual(elem[:], list(elem)) child1 = elem[0] child2 = elem[2] del elem[1:2] - self.assertEqual(len(elem.getchildren()), 2) + self.assertEqual(len(list(elem)), 2) self.assertEqual(child1, elem[0]) self.assertEqual(child2, elem[1]) elem[0:2] = [child2, child1] @@ -725,7 +723,7 @@ class ElementTreeTest(unittest.TestCase) self.assertEqual(child1, elem[1]) self.assertNotEqual(child1, elem[0]) elem.clear() - self.assertEqual(elem.getchildren(), []) + self.assertEqual(list(elem), []) def test_writestring(self): elem = ET.XML("text") @@ -1558,7 +1556,7 @@ class BugsTest(unittest.TestCase): class EchoTarget: def close(self): return ET.Element("element") # simulate root - parser = ET.XMLParser(EchoTarget()) + parser = ET.XMLParser(target=EchoTarget()) parser.feed("some text") self.assertEqual(parser.close().tag, 'element') @@ -2113,8 +2111,12 @@ class ElementFindTest(unittest.TestCase) self.assertEqual(summarize_list(ET.ElementTree(e).findall('tag')), ['tag'] * 2) # this produces a warning - self.assertEqual(summarize_list(ET.ElementTree(e).findall('//tag')), - ['tag'] * 3) + msg = ("This search is broken in 1.3 and earlier, and will be fixed " + "in a future version. If you rely on the current behaviour, " + "change it to '.+'") + with self.assertWarnsRegex(FutureWarning, msg): + it = ET.ElementTree(e).findall('//tag') + self.assertEqual(summarize_list(it), ['tag'] * 3) class ElementIterTest(unittest.TestCase): @@ -2199,37 +2201,6 @@ class ElementIterTest(unittest.TestCase) self.assertEqual(self._ilist(doc), all_tags) self.assertEqual(self._ilist(doc, '*'), all_tags) - def test_getiterator(self): - doc = ET.XML(''' - - - bedroom1 - bedroom2 - - nothing here - - - bedroom8 - - ''') - - self.assertEqual(summarize_list(doc.getiterator('room')), - ['room'] * 3) - self.assertEqual(summarize_list(doc.getiterator('house')), - ['house'] * 2) - - # test that getiterator also accepts 'tag' as a keyword arg - self.assertEqual( - summarize_list(doc.getiterator(tag='room')), - ['room'] * 3) - - # make sure both tag=None and tag='*' return all tags - all_tags = ['document', 'house', 'room', 'room', - 'shed', 'house', 'room'] - self.assertEqual(summarize_list(doc.getiterator()), all_tags) - self.assertEqual(summarize_list(doc.getiterator(None)), all_tags) - self.assertEqual(summarize_list(doc.getiterator('*')), all_tags) - def test_copy(self): a = ET.Element('a') it = a.iter() @@ -2379,15 +2350,7 @@ class XMLParserTest(unittest.TestCase): self.assertEqual(e[0].text, '22') def test_constructor_args(self): - # Positional args. The first (html) is not supported, but should be - # nevertheless correctly accepted. - parser = ET.XMLParser(None, ET.TreeBuilder(), 'utf-8') - parser.feed(self.sample1) - self._check_sample_element(parser.close()) - - # Now as keyword args. parser2 = ET.XMLParser(encoding='utf-8', - html=[{}], target=ET.TreeBuilder()) parser2.feed(self.sample1) self._check_sample_element(parser2.close()) @@ -2400,13 +2363,6 @@ class XMLParserTest(unittest.TestCase): self._check_sample_element(parser.close()) def test_doctype_warning(self): - parser = ET.XMLParser() - with self.assertWarns(DeprecationWarning): - parser.doctype('html', '-//W3C//DTD XHTML 1.0 Transitional//EN', - 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd') - parser.feed('') - parser.close() - with warnings.catch_warnings(): warnings.simplefilter('error', DeprecationWarning) parser = ET.XMLParser() @@ -2416,21 +2372,20 @@ class XMLParserTest(unittest.TestCase): def test_subclass_doctype(self): _doctype = None class MyParserWithDoctype(ET.XMLParser): - def doctype(self, name, pubid, system): + def doctype(self, *args, **kwargs): nonlocal _doctype - _doctype = (name, pubid, system) + _doctype = (args, kwargs) parser = MyParserWithDoctype() - with self.assertWarns(DeprecationWarning): + with self.assertWarnsRegex(RuntimeWarning, 'doctype'): parser.feed(self.sample2) parser.close() - self.assertEqual(_doctype, - ('html', '-//W3C//DTD XHTML 1.0 Transitional//EN', - 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd')) + self.assertIsNone(_doctype) _doctype = _doctype2 = None with warnings.catch_warnings(): warnings.simplefilter('error', DeprecationWarning) + warnings.simplefilter('error', RuntimeWarning) class DoctypeParser: def doctype(self, name, pubid, system): nonlocal _doctype2 @@ -2448,6 +2403,7 @@ class XMLParserTest(unittest.TestCase): '''Ensure that ordinary usage is not deprecated (Issue 19176)''' with warnings.catch_warnings(): warnings.simplefilter('error', DeprecationWarning) + warnings.simplefilter('error', RuntimeWarning) class MyParserWithoutDoctype(ET.XMLParser): pass parser = MyParserWithoutDoctype() @@ -2904,46 +2860,6 @@ class NoAcceleratorTest(unittest.TestCas # -------------------------------------------------------------------- -class CleanContext(object): - """Provide default namespace mapping and path cache.""" - checkwarnings = None - - def __init__(self, quiet=False): - if sys.flags.optimize >= 2: - # under -OO, doctests cannot be run and therefore not all warnings - # will be emitted - quiet = True - deprecations = ( - # Search behaviour is broken if search path starts with "/". - ("This search is broken in 1.3 and earlier, and will be fixed " - "in a future version. If you rely on the current behaviour, " - "change it to '.+'", FutureWarning), - # Element.getchildren() and Element.getiterator() are deprecated. - ("This method will be removed in future versions. " - "Use .+ instead.", DeprecationWarning), - ("This method will be removed in future versions. " - "Use .+ instead.", PendingDeprecationWarning)) - self.checkwarnings = support.check_warnings(*deprecations, quiet=quiet) - - def __enter__(self): - from xml.etree import ElementPath - self._nsmap = ET.register_namespace._namespace_map - # Copy the default namespace mapping - self._nsmap_copy = self._nsmap.copy() - # Copy the path cache (should be empty) - self._path_cache = ElementPath._cache - ElementPath._cache = self._path_cache.copy() - self.checkwarnings.__enter__() - - def __exit__(self, *args): - from xml.etree import ElementPath - # Restore mapping and path cache - self._nsmap.clear() - self._nsmap.update(self._nsmap_copy) - ElementPath._cache = self._path_cache - self.checkwarnings.__exit__(*args) - - def test_main(module=None): # When invoked without a module, runs the Python ET tests by loading pyET. # Otherwise, uses the given module as the ET. @@ -2983,11 +2899,22 @@ def test_main(module=None): NoAcceleratorTest, ]) + # Provide default namespace mapping and path cache. + from xml.etree import ElementPath + nsmap = ET.register_namespace._namespace_map + # Copy the default namespace mapping + nsmap_copy = nsmap.copy() + # Copy the path cache (should be empty) + path_cache = ElementPath._cache + ElementPath._cache = path_cache.copy() try: - # XXX the C module should give the same warnings as the Python module - with CleanContext(quiet=(pyET is not ET)): - support.run_unittest(*test_classes) + support.run_unittest(*test_classes) finally: + from xml.etree import ElementPath + # Restore mapping and path cache + nsmap.clear() + nsmap.update(nsmap_copy) + ElementPath._cache = path_cache # don't interfere with subsequent tests ET = pyET = None diff -r 08042f0dbb67 Lib/test/test_xml_etree_c.py --- a/Lib/test/test_xml_etree_c.py Sun Jan 08 23:30:05 2017 +0800 +++ b/Lib/test/test_xml_etree_c.py Sun Jan 08 19:50:25 2017 +0200 @@ -7,8 +7,6 @@ import unittest cET = import_fresh_module('xml.etree.ElementTree', fresh=['_elementtree']) -cET_alias = import_fresh_module('xml.etree.cElementTree', - fresh=['_elementtree', 'xml.etree']) @unittest.skipUnless(cET, 'requires _elementtree') @@ -66,14 +64,6 @@ class MiscTests(unittest.TestCase): @unittest.skipUnless(cET, 'requires _elementtree') -class TestAliasWorking(unittest.TestCase): - # Test that the cET alias module is alive - def test_alias_working(self): - e = cET_alias.Element('foo') - self.assertEqual(e.tag, 'foo') - - -@unittest.skipUnless(cET, 'requires _elementtree') @support.cpython_only class TestAcceleratorImported(unittest.TestCase): # Test that the C accelerator was imported, as expected @@ -81,9 +71,6 @@ class TestAcceleratorImported(unittest.T # SubElement is a function so it retains _elementtree as its module. self.assertEqual(cET.SubElement.__module__, '_elementtree') - def test_correct_import_cET_alias(self): - self.assertEqual(cET_alias.SubElement.__module__, '_elementtree') - def test_parser_comes_from_C(self): # The type of methods defined in Python code is types.FunctionType, # while the type of methods defined inside _elementtree is @@ -123,7 +110,6 @@ def test_main(): # Run the tests specific to the C implementation support.run_unittest( MiscTests, - TestAliasWorking, TestAcceleratorImported, SizeofTest, ) diff -r 08042f0dbb67 Lib/xml/etree/ElementTree.py --- a/Lib/xml/etree/ElementTree.py Sun Jan 08 23:30:05 2017 +0800 +++ b/Lib/xml/etree/ElementTree.py Sun Jan 08 19:50:25 2017 +0200 @@ -273,19 +273,6 @@ class Element: # assert iselement(element) self._children.remove(subelement) - def getchildren(self): - """(Deprecated) Return all subelements. - - Elements are returned in document order. - - """ - warnings.warn( - "This method will be removed in future versions. " - "Use 'list(elem)' or iteration over elem instead.", - DeprecationWarning, stacklevel=2 - ) - return self._children - def find(self, path, namespaces=None): """Find first matching element by tag name or path. @@ -409,16 +396,6 @@ class Element: for e in self._children: yield from e.iter(tag) - # compatibility - def getiterator(self, tag=None): - # Change for a DeprecationWarning in 1.4 - warnings.warn( - "This method will be removed in future versions. " - "Use 'elem.iter()' or 'list(elem.iter())' instead.", - PendingDeprecationWarning, stacklevel=2 - ) - return list(self.iter(tag)) - def itertext(self): """Create text iterator. @@ -619,16 +596,6 @@ class ElementTree: # assert self._root is not None return self._root.iter(tag) - # compatibility - def getiterator(self, tag=None): - # Change for a DeprecationWarning in 1.4 - warnings.warn( - "This method will be removed in future versions. " - "Use 'tree.iter()' or 'list(tree.iter())' instead.", - PendingDeprecationWarning, stacklevel=2 - ) - return list(self.iter(tag)) - def find(self, path, namespaces=None): """Find first matching element by tag name or path. @@ -1435,7 +1402,6 @@ class TreeBuilder: class XMLParser: """Element structure builder for XML source data based on the expat parser. - *html* are predefined HTML entities (deprecated and not supported), *target* is an optional target object which defaults to an instance of the standard TreeBuilder class, *encoding* is an optional encoding string which if given, overrides the encoding specified in the XML file: @@ -1443,7 +1409,7 @@ class XMLParser: """ - def __init__(self, html=0, target=None, encoding=None): + def __init__(self, *, target=None, encoding=None): try: from xml.parsers import expat except ImportError: @@ -1596,28 +1562,14 @@ class XMLParser: return if hasattr(self.target, "doctype"): self.target.doctype(name, pubid, system[1:-1]) - elif self.doctype != self._XMLParser__doctype: - # warn about deprecated call - self._XMLParser__doctype(name, pubid, system[1:-1]) - self.doctype(name, pubid, system[1:-1]) + elif hasattr(self, "doctype"): + warnings.warn( + "The doctype() method of XMLParser is ignored. " + "Define doctype() method on the TreeBuilder target.", + RuntimeWarning) + self._doctype = None - def doctype(self, name, pubid, system): - """(Deprecated) Handle doctype declaration - - *name* is the Doctype name, *pubid* is the public identifier, - and *system* is the system identifier. - - """ - warnings.warn( - "This method of XMLParser is deprecated. Define doctype() " - "method on the TreeBuilder target.", - DeprecationWarning, - ) - - # sentinel, if doctype is redefined in a subclass - __doctype = doctype - def feed(self, data): """Feed encoded data to parser.""" try: diff -r 08042f0dbb67 Modules/_elementtree.c --- a/Modules/_elementtree.c Sun Jan 08 23:30:05 2017 +0800 +++ b/Modules/_elementtree.c Sun Jan 08 19:50:25 2017 +0200 @@ -1352,37 +1352,6 @@ static PyObject * return value; } -/*[clinic input] -_elementtree.Element.getchildren - -[clinic start generated code]*/ - -static PyObject * -_elementtree_Element_getchildren_impl(ElementObject *self) -/*[clinic end generated code: output=e50ffe118637b14f input=0f754dfded150d5f]*/ -{ - Py_ssize_t i; - PyObject* list; - - /* FIXME: report as deprecated? */ - - if (!self->extra) - return PyList_New(0); - - list = PyList_New(self->extra->length); - if (!list) - return NULL; - - for (i = 0; i < self->extra->length; i++) { - PyObject* item = self->extra->children[i]; - Py_INCREF(item); - PyList_SET_ITEM(list, i, item); - } - - return list; -} - - static PyObject * create_elementiter(ElementObject *self, PyObject *tag, int gettext); @@ -2742,12 +2711,6 @@ typedef struct { } XMLParserObject; -static PyObject* -_elementtree_XMLParser_doctype(XMLParserObject* self, PyObject* args); -static PyObject * -_elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name, - PyObject *pubid, PyObject *system); - /* helpers */ LOCAL(PyObject*) @@ -3111,10 +3074,8 @@ expat_start_doctype_handler(XMLParserObj const XML_Char *pubid, int has_internal_subset) { - PyObject *self_pyobj = (PyObject *)self; PyObject *doctype_name_obj, *sysid_obj, *pubid_obj; - PyObject *parser_doctype = NULL; - PyObject *res = NULL; + PyObject *res; if (PyErr_Occurred()) return; @@ -3151,33 +3112,15 @@ expat_start_doctype_handler(XMLParserObj res = PyObject_CallFunctionObjArgs(self->handle_doctype, doctype_name_obj, pubid_obj, sysid_obj, NULL); - Py_CLEAR(res); + Py_XDECREF(res); } - else { - /* Now see if the parser itself has a doctype method. If yes and it's - * a custom method, call it but warn about deprecation. If it's only - * the vanilla XMLParser method, do nothing. - */ - parser_doctype = PyObject_GetAttrString(self_pyobj, "doctype"); - if (parser_doctype && - !(PyCFunction_Check(parser_doctype) && - PyCFunction_GET_SELF(parser_doctype) == self_pyobj && - PyCFunction_GET_FUNCTION(parser_doctype) == - (PyCFunction) _elementtree_XMLParser_doctype)) { - res = _elementtree_XMLParser_doctype_impl(self, doctype_name_obj, - pubid_obj, sysid_obj); - if (!res) - goto clear; - Py_DECREF(res); - res = PyObject_CallFunctionObjArgs(parser_doctype, - doctype_name_obj, pubid_obj, - sysid_obj, NULL); - Py_CLEAR(res); - } + else if (PyObject_HasAttrString((PyObject *)self, "doctype")) { + PyErr_WarnEx(PyExc_RuntimeWarning, + "The doctype() method of XMLParser is ignored. " + "Define doctype() method on the TreeBuilder target.", + 1); } -clear: - Py_XDECREF(parser_doctype); Py_DECREF(doctype_name_obj); Py_DECREF(pubid_obj); Py_DECREF(sysid_obj); @@ -3229,16 +3172,16 @@ xmlparser_new(PyTypeObject *type, PyObje /*[clinic input] _elementtree.XMLParser.__init__ - html: object = NULL + * target: object = NULL encoding: str(accept={str, NoneType}) = NULL [clinic start generated code]*/ static int -_elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *html, - PyObject *target, const char *encoding) -/*[clinic end generated code: output=d6a16c63dda54441 input=155bc5695baafffd]*/ +_elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *target, + const char *encoding) +/*[clinic end generated code: output=3ae45ec6cdf344e4 input=96288fcba916cfce]*/ { self->entity = PyDict_New(); if (!self->entity) @@ -3545,30 +3488,6 @@ static PyObject * } /*[clinic input] -_elementtree.XMLParser.doctype - - name: object - pubid: object - system: object - / - -[clinic start generated code]*/ - -static PyObject * -_elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name, - PyObject *pubid, PyObject *system) -/*[clinic end generated code: output=10fb50c2afded88d input=84050276cca045e1]*/ -{ - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "This method of XMLParser is deprecated. Define" - " doctype() method on the TreeBuilder target.", - 1) < 0) { - return NULL; - } - Py_RETURN_NONE; -} - -/*[clinic input] _elementtree.XMLParser._setevents events_queue: object @@ -3712,9 +3631,6 @@ static PyMethodDef element_methods[] = { _ELEMENTTREE_ELEMENT_ITERTEXT_METHODDEF _ELEMENTTREE_ELEMENT_ITERFIND_METHODDEF - {"getiterator", (PyCFunction)_elementtree_Element_iter, METH_FASTCALL, _elementtree_Element_iter__doc__}, - _ELEMENTTREE_ELEMENT_GETCHILDREN_METHODDEF - _ELEMENTTREE_ELEMENT_ITEMS_METHODDEF _ELEMENTTREE_ELEMENT_KEYS_METHODDEF @@ -3852,7 +3768,6 @@ static PyMethodDef xmlparser_methods[] = _ELEMENTTREE_XMLPARSER_CLOSE_METHODDEF _ELEMENTTREE_XMLPARSER__PARSE_WHOLE_METHODDEF _ELEMENTTREE_XMLPARSER__SETEVENTS_METHODDEF - _ELEMENTTREE_XMLPARSER_DOCTYPE_METHODDEF {NULL, NULL} }; diff -r 08042f0dbb67 Modules/clinic/_elementtree.c.h --- a/Modules/clinic/_elementtree.c.h Sun Jan 08 23:30:05 2017 +0800 +++ b/Modules/clinic/_elementtree.c.h Sun Jan 08 19:50:25 2017 +0200 @@ -287,23 +287,6 @@ exit: return return_value; } -PyDoc_STRVAR(_elementtree_Element_getchildren__doc__, -"getchildren($self, /)\n" -"--\n" -"\n"); - -#define _ELEMENTTREE_ELEMENT_GETCHILDREN_METHODDEF \ - {"getchildren", (PyCFunction)_elementtree_Element_getchildren, METH_NOARGS, _elementtree_Element_getchildren__doc__}, - -static PyObject * -_elementtree_Element_getchildren_impl(ElementObject *self); - -static PyObject * -_elementtree_Element_getchildren(ElementObject *self, PyObject *Py_UNUSED(ignored)) -{ - return _elementtree_Element_getchildren_impl(self); -} - PyDoc_STRVAR(_elementtree_Element_iter__doc__, "iter($self, /, tag=None)\n" "--\n" @@ -585,24 +568,23 @@ exit: } static int -_elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *html, - PyObject *target, const char *encoding); +_elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *target, + const char *encoding); static int _elementtree_XMLParser___init__(PyObject *self, PyObject *args, PyObject *kwargs) { int return_value = -1; - static const char * const _keywords[] = {"html", "target", "encoding", NULL}; - static _PyArg_Parser _parser = {"|OOz:XMLParser", _keywords, 0}; - PyObject *html = NULL; + static const char * const _keywords[] = {"target", "encoding", NULL}; + static _PyArg_Parser _parser = {"|$Oz:XMLParser", _keywords, 0}; PyObject *target = NULL; const char *encoding = NULL; if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, - &html, &target, &encoding)) { + &target, &encoding)) { goto exit; } - return_value = _elementtree_XMLParser___init___impl((XMLParserObject *)self, html, target, encoding); + return_value = _elementtree_XMLParser___init___impl((XMLParserObject *)self, target, encoding); exit: return return_value; @@ -641,37 +623,6 @@ PyDoc_STRVAR(_elementtree_XMLParser__par #define _ELEMENTTREE_XMLPARSER__PARSE_WHOLE_METHODDEF \ {"_parse_whole", (PyCFunction)_elementtree_XMLParser__parse_whole, METH_O, _elementtree_XMLParser__parse_whole__doc__}, -PyDoc_STRVAR(_elementtree_XMLParser_doctype__doc__, -"doctype($self, name, pubid, system, /)\n" -"--\n" -"\n"); - -#define _ELEMENTTREE_XMLPARSER_DOCTYPE_METHODDEF \ - {"doctype", (PyCFunction)_elementtree_XMLParser_doctype, METH_VARARGS, _elementtree_XMLParser_doctype__doc__}, - -static PyObject * -_elementtree_XMLParser_doctype_impl(XMLParserObject *self, PyObject *name, - PyObject *pubid, PyObject *system); - -static PyObject * -_elementtree_XMLParser_doctype(XMLParserObject *self, PyObject *args) -{ - PyObject *return_value = NULL; - PyObject *name; - PyObject *pubid; - PyObject *system; - - if (!PyArg_UnpackTuple(args, "doctype", - 3, 3, - &name, &pubid, &system)) { - goto exit; - } - return_value = _elementtree_XMLParser_doctype_impl(self, name, pubid, system); - -exit: - return return_value; -} - PyDoc_STRVAR(_elementtree_XMLParser__setevents__doc__, "_setevents($self, events_queue, events_to_report=None, /)\n" "--\n" @@ -702,4 +653,4 @@ static PyObject * exit: return return_value; } -/*[clinic end generated code: output=b4a571a98ced3163 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=d1b96ef51d211f8d input=a9049054013a1b77]*/