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.
This commit is contained in:
Serhiy Storchaka 2017-03-30 18:12:06 +03:00 committed by GitHub
parent 722a3af092
commit 762ec97ea6
6 changed files with 120 additions and 53 deletions

View file

@ -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: