Message201519
| Author |
martin.panter |
| Recipients |
Arfrever, christian.heimes, effbot, eli.bendersky, ezio.melotti, flox, georg.brandl, martin.panter, python-dev, r.david.murray |
| Date |
2013年10月28日.09:18:42 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1382951923.78.0.761880307586.issue14007@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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]) |
|