Author martin.panter
Recipients martin.panter
Date 2013-10-06.06:42:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I am using the C version of Element Tree via the main ElementTree module. I have subclassed XMLParser, and created my own target object. I am not that interested in XML doctypes, but the following simplified code raises a DeprecationWarning:

$ python3.3 -Wall
Python 3.3.2 (default, May 16 2013, 23:40:52) 
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.etree.ElementTree import XMLParser
>>> class CustomParser(XMLParser): pass
>>> CustomParser().feed("<!DOCTYPE blaua>")
__main__:1: DeprecationWarning: This method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder target.

Looking at the C code, the logic is wrong. Subclasses of XMLParser will normally always have a doctype() method, at least by inheritance. So the code should compare the method with the XMLParser.doctype() base method rather than just checking that it exists. The native Python version seems to get it right.

It looks like this may not be an issue for Python 3.4 because according to Issue 13248 the deprecated doctype() method is due to be removed.
Date User Action Args
2013-10-06 06:42:30martin.pantersetrecipients: + martin.panter
2013-10-06 06:42:30martin.pantersetmessageid: <>
2013-10-06 06:42:30martin.panterlinkissue19176 messages
2013-10-06 06:42:29martin.pantercreate