diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-03-30 15:12:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-30 15:12:06 (GMT) |
commit | 762ec97ea68a1126b8855996c61fa8239dc9fff7 (patch) | |
tree | 8addf50d8a5ed50492790532396b08d1d25737bd /Lib/xml/etree/ElementTree.py | |
parent | 722a3af092b94983aa26f5e591fb1b45e2c2a0ff (diff) | |
download | cpython-762ec97ea68a1126b8855996c61fa8239dc9fff7.zip cpython-762ec97ea68a1126b8855996c61fa8239dc9fff7.tar.gz cpython-762ec97ea68a1126b8855996c61fa8239dc9fff7.tar.bz2 |
bpo-29204: Emit warnings for already deprecated ElementTree features. (#773)
Element.getiterator() and the html parameter of XMLParser() were
deprecated only in the documentation (since Python 3.2 and 3.4 correspondintly).
Now using them emits a deprecation warning.
* Don’t need check_warnings any more.
Diffstat (limited to 'Lib/xml/etree/ElementTree.py')
-rw-r--r-- | Lib/xml/etree/ElementTree.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index 7354056..7944cf1 100644 --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -1430,6 +1430,7 @@ class TreeBuilder: self._tail = 1 return self._last +_sentinel = ['sentinel'] # also see ElementTree and TreeBuilder class XMLParser: @@ -1443,7 +1444,11 @@ class XMLParser: """ - def __init__(self, html=0, target=None, encoding=None): + def __init__(self, html=_sentinel, target=None, encoding=None): + if html is not _sentinel: + warnings.warn( + "The html argument of XMLParser() is deprecated", + DeprecationWarning, stacklevel=2) try: from xml.parsers import expat except ImportError: |