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

Unified Diff: Doc/library/html.parser.rst

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 | « no previous file | Doc/whatsnew/3.5.rst » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Doc/library/html.parser.rst
+++ b/Doc/library/html.parser.rst
@@ -11,25 +11,23 @@
**Source code:** :source:`Lib/html/parser.py`
--------------
This module defines a class :class:`HTMLParser` which serves as the basis for
parsing text files formatted in HTML (HyperText Mark-up Language) and XHTML.
-.. class:: HTMLParser(strict=False, *, convert_charrefs=False)
+.. class:: HTMLParser(strict=False, *, convert_charrefs=True)
Create a parser instance.
- If *convert_charrefs* is ``True`` (default: ``False``), all character
- references (except the ones in ``script``/``style`` elements) are
- automatically converted to the corresponding Unicode characters.
- The use of ``convert_charrefs=True`` is encouraged and will become
- the default in Python 3.5.
+ If *convert_charrefs* is ``True`` (the default), all character references
+ (except the ones in ``script``/``style`` elements) are automatically
+ converted to the corresponding Unicode characters.
If *strict* is ``False`` (the default), the parser will accept and parse
invalid markup. If *strict* is ``True`` the parser will raise an
:exc:`~html.parser.HTMLParseError` exception instead [#]_ when it's not
able to parse the markup. The use of ``strict=True`` is discouraged and
the *strict* argument is deprecated.
An :class:`.HTMLParser` instance is fed HTML data and calls handler methods
@@ -45,16 +43,19 @@ parsing text files formatted in HTML (Hy
.. deprecated-removed:: 3.3 3.5
The *strict* argument and the strict mode have been deprecated.
The parser is now able to accept and parse invalid markup too.
.. versionchanged:: 3.4
*convert_charrefs* keyword argument added.
+ .. versionchanged:: 3.5
+ The default value for argument *convert_charrefs* is now ``True``.
+
An exception is defined as well:
.. exception:: HTMLParseError
Exception raised by the :class:`HTMLParser` class when it encounters an error
while parsing and *strict* is ``True``. This exception provides three
attributes: :attr:`msg` is a brief message explaining the error,
« no previous file with comments | « no previous file | Doc/whatsnew/3.5.rst » ('j') | no next file with comments »

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