diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2014-08-02 15:36:12 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2014-08-02 15:36:12 (GMT) |
commit | 6fc16d81af0ec11e79a17e2af12e8653382cef26 (patch) | |
tree | 46c2ed00a7cb5efb78bafd818c3e2b9e04a66c01 /Lib/html | |
parent | 11bec7a1b83d0edffbcff29dccbabd660f5a9a7b (diff) | |
download | cpython-6fc16d81af0ec11e79a17e2af12e8653382cef26.zip cpython-6fc16d81af0ec11e79a17e2af12e8653382cef26.tar.gz cpython-6fc16d81af0ec11e79a17e2af12e8653382cef26.tar.bz2 |
#21047: set the default value for the *convert_charrefs* argument of HTMLParser to True. Patch by Berker Peksag.
Diffstat (limited to 'Lib/html')
-rw-r--r-- | Lib/html/parser.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/html/parser.py b/Lib/html/parser.py index 5a4f9e1..390d4cc 100644 --- a/Lib/html/parser.py +++ b/Lib/html/parser.py @@ -59,7 +59,6 @@ endendtag = re.compile('>') endtagfind = re.compile('</\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>') -_default_sentinel = object() class HTMLParser(_markupbase.ParserBase): """Find tags and other markup and call handler functions. @@ -85,17 +84,12 @@ class HTMLParser(_markupbase.ParserBase): CDATA_CONTENT_ELEMENTS = ("script", "style") - def __init__(self, *, convert_charrefs=_default_sentinel): + def __init__(self, *, convert_charrefs=True): """Initialize and reset this instance. - If convert_charrefs is True (default: False), all character references + If convert_charrefs is True (the default), all character references are automatically converted to the corresponding Unicode characters. """ - if convert_charrefs is _default_sentinel: - convert_charrefs = False # default - warnings.warn("The value of convert_charrefs will become True in " - "3.5. You are encouraged to set the value explicitly.", - DeprecationWarning, stacklevel=2) self.convert_charrefs = convert_charrefs self.reset() |