Message201519
There is an issue in Python 2.7 (and 3.2 if that matters) with the DeprecationWarning for the doctype() method being triggered internally. It is a bit different from this issue but I think a solution has already been committed for 3.3, and the commit message references this issue. Let me know if I should raise a separate report.
The warning is triggered for the Python version of the ElementTree module:
$ python2.7 -Wall
Python 2.7.5 (default, Sep 6 2013, 09:55:21)
[GCC 4.8.1 20130725 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.etree import ElementTree
>>> ElementTree.XML(b'<!DOCTYPE blaua SYSTEM "id"><elem/>')
/usr/lib/python2.7/xml/etree/ElementTree.py:1627: DeprecationWarning: This method of XMLParser is deprecated. Define doctype() method on the TreeBuilder target.
DeprecationWarning,
/usr/lib/python2.7/xml/etree/ElementTree.py:1627: DeprecationWarning: This method of XMLParser is deprecated. Define doctype() method on the TreeBuilder target.
DeprecationWarning,
<Element 'elem' at 0xd47910>
>>>
Possible solution is the patch hunk below, taken from this commit:
http://hg.python.org/cpython/diff/47016103185f/Lib/xml/etree/ElementTree.py#l1.99
@@ -1636,7 +1627,7 @@ class XMLParser:
pubid = pubid[1:-1]
if hasattr(self.target, "doctype"):
self.target.doctype(name, pubid, system[1:-1])
- elif self.doctype is not self._XMLParser__doctype:
+ 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]) |
|
Date |
User |
Action |
Args |
2013-10-28 09:18:43 | martin.panter | set | recipients:
+ martin.panter, effbot, georg.brandl, christian.heimes, ezio.melotti, Arfrever, r.david.murray, eli.bendersky, flox, python-dev |
2013-10-28 09:18:43 | martin.panter | set | messageid: <1382951923.78.0.761880307586.issue14007@psf.upfronthosting.co.za> |
2013-10-28 09:18:43 | martin.panter | link | issue14007 messages |
2013-10-28 09:18:42 | martin.panter | create | |
|