This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients martin.panter
Date 2013-10-06.06:42:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1381041750.41.0.637077946349.issue19176@psf.upfronthosting.co.za>
In-reply-to
Content
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.

http://hg.python.org/cpython/file/50ea4dccb03e/Modules/_elementtree.c#l3091

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.
History
Date User Action Args
2013-10-06 06:42:30martin.pantersetrecipients: + martin.panter
2013-10-06 06:42:30martin.pantersetmessageid: <1381041750.41.0.637077946349.issue19176@psf.upfronthosting.co.za>
2013-10-06 06:42:30martin.panterlinkissue19176 messages
2013-10-06 06:42:29martin.pantercreate