[Python-Dev] Fix or remove XMLParser.doctype()

Serhiy Storchaka storchaka at gmail.com
Mon Jun 8 11:02:55 CEST 2015

There are issues with the doctype() method of XMLParser.

1. Using subclass of XMLParser emits a deprecation warning [1].

2. There is behavior difference between Python and C implementations if 
implement doctype() [2].

This method was deprecated for long time, and the simplest solution is 
to completely remove it. The questions are:

1. Can doctype() be removed or there is significant risk to break 
someone's code?

2. If fix doctype() instead of removing it (in any case should be done 
in maintained releases), what behavior should be preserved? Should 
target's doctype() be called instead of XMLParser.doctype() (Python 
implementation) or be called in addition to XMLParser.doctype() (C 

Eli suggested to ask on Python-Dev.

[1] http://bugs.python.org/issue19176
[2] http://bugs.python.org/issue19176#msg238783

More information about the Python-Dev mailing list