Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(54)

Unified Diff: Lib/html/parser.py

Issue 21047: html.parser.HTMLParser: convert_charrefs should become True by default
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Doc/whatsnew/3.5.rst ('k') | Lib/test/test_htmlparser.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/html/parser.py
+++ b/Lib/html/parser.py
@@ -118,37 +118,31 @@ class HTMLParser(_markupbase.ParserBase)
longer split in chunks), otherwise they are passed by calling
self.handle_entityref() or self.handle_charref() with the string
containing respectively the named or numeric reference as the
argument.
"""
CDATA_CONTENT_ELEMENTS = ("script", "style")
- def __init__(self, strict=_default_sentinel, *,
- convert_charrefs=_default_sentinel):
+ def __init__(self, strict=_default_sentinel, *, 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 strict is set to False (the default) the parser will parse invalid
markup, otherwise it will raise an error. Note that the strict mode
and argument are deprecated.
"""
if strict is not _default_sentinel:
warnings.warn("The strict argument and mode are deprecated.",
DeprecationWarning, stacklevel=2)
else:
strict = False # default
self.strict = strict
- 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()
def reset(self):
"""Reset this instance. Loses all unprocessed data."""
self.rawdata = ''
self.lasttag = '???'
self.interesting = interesting_normal
« no previous file with comments | « Doc/whatsnew/3.5.rst ('k') | Lib/test/test_htmlparser.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+