classification
Title: Deprecate strict mode of HTMLParser
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: Arfrever, berker.peksag, eric.araujo, ezio.melotti, georg.brandl, python-dev, r.david.murray
Priority: normal Keywords: patch

Created on 2012-06-20 09:42 by ezio.melotti, last changed 2014-08-02 15:54 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
issue15114.diff ezio.melotti, 2012-06-21 14:50 review
issue15114-2.diff ezio.melotti, 2012-10-11 12:00 Patch for 3.4. review
issue15114-3.diff ezio.melotti, 2013-11-07 16:43 Patch for 3.5. review
Messages (12)
msg163265 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-06-20 09:42
The deprecation plan for the strict mode of HTMLParser might be as follow:

3.3 (before the beta)
strict=False default
strict arg deprecated in the doc
strict=True deprecated (raises a warning)
HTMLParseError deprecated
HTMLParser.error deprecated (raises a warning)
calls to HTMLParser.error removed/converted to asserts

3.4
strict arg deprecated (raises a warning)

3.5
strict arg removed and strict code removed
HTMLParseError removed
HTMLParser.error removed


Everything that is parsed by strict=True is parsed by strict=False too, so changing the default shouldn't be a problem.  The difference is that strict=False won't raise any error and will parse broken markup too.  Given that no errors are raised HTMLParseError and HTMLParser.error become useless and can be deprecated (3.3) and removed (3.5) too.
Once strict=False is the default (3.3), the instances should be created simply with HTMLParser(), and eventually the strict argument will be deprecated (3.4) and removed (3.5).
msg163273 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-06-20 12:38
Your plan sounds fine to me.
msg163337 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-06-21 14:50
The attached patch include these changes:
* strict=False default
* strict arg deprecated in the doc
* strict=True deprecated (raises a warning)
* HTMLParseError deprecated in the doc
* some calls to HTMLParser.error converted to asserts [0]

Regarding
* HTMLParser.error deprecated (raises a warning)
I'm not sure anymore that's a good idea.  The method is not documented, so in theory it could be removed without deprecation warnings, but that might break things if someone is using it.

[0] I made a mistake in my first message: some of the calls should actually be converted to assert, the others will stay as long as the strict mode exists (i.e. they will be removed in 3.5)
msg163570 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2012-06-23 10:14
Why not deprecate .error()? Removing it immediately as undocumented is certainly not better.

Otherwise sounds good, please commit.
msg163604 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-06-23 13:21
Regarding .error() I think the best thing to do is wait till 3.4 and then deprecate it.
msg163605 - (view) Author: Roundup Robot (python-dev) Date: 2012-06-23 13:28
New changeset 8dd2f5754b2f by Ezio Melotti in branch 'default':
#15114: the strict mode of HTMLParser and the HTMLParseError exception are deprecated now that the parser is able to parse invalid markup.
http://hg.python.org/cpython/rev/8dd2f5754b2f
msg163608 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-06-23 13:34
3.3 is done.

3.4
strict arg deprecated (raises a warning)
HTMLParser.error deprecated (raises a warning)

3.5
strict arg removed and strict code removed
HTMLParseError removed
HTMLParser.error and calls to HTMLParser.error removed
msg201976 - (view) Author: Roundup Robot (python-dev) Date: 2013-11-02 15:08
New changeset 0a56709eb798 by Ezio Melotti in branch 'default':
#15114: The html.parser module now raises a DeprecationWarning when the strict argument of HTMLParser or the HTMLParser.error method are used.
http://hg.python.org/cpython/rev/0a56709eb798
msg202363 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-11-07 16:43
3.4 is done.

3.5
strict arg removed and strict code removed
HTMLParseError removed
HTMLParser.error and calls to HTMLParser.error removed
msg224551 - (view) Author: Roundup Robot (python-dev) Date: 2014-08-02 11:10
New changeset 0e2e47c1f205 by Ezio Melotti in branch 'default':
#15114: the strict mode and argument of HTMLParser, HTMLParser.error, and the HTMLParserError exception have been removed.
http://hg.python.org/cpython/rev/0e2e47c1f205
msg224552 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2014-08-02 11:13
3.5 is done.
Closing.
msg224575 - (view) Author: Roundup Robot (python-dev) Date: 2014-08-02 15:54
New changeset 5b95f3fdcc0b by Ezio Melotti in branch 'default':
#15114, #21047: update whatsnew in Python 3.5.
http://hg.python.org/cpython/rev/5b95f3fdcc0b
History
Date User Action Args
2014-08-02 15:54:53python-devsetmessages: + msg224575
2014-08-02 11:13:18ezio.melottisetstatus: open -> closed
resolution: fixed
messages: + msg224552

stage: needs patch -> resolved
2014-08-02 11:10:49python-devsetmessages: + msg224551
2014-07-05 10:41:41berker.peksagsetnosy: + berker.peksag

versions: + Python 3.5, - Python 3.4
2014-02-14 05:29:14ezio.melottilinkissue20623 dependencies
2013-11-07 16:43:58ezio.melottisetfiles: + issue15114-3.diff

messages: + msg202363
2013-11-02 15:08:38python-devsetmessages: + msg201976
2012-11-01 20:43:48serhiy.storchakasetnosy: - serhiy.storchaka
2012-10-11 12:00:11ezio.melottisetfiles: + issue15114-2.diff
keywords: + patch
2012-06-23 17:24:12Arfreversetnosy: + Arfrever
2012-06-23 13:34:27ezio.melottisetpriority: release blocker -> normal
versions: + Python 3.4, - Python 3.3
messages: + msg163608

keywords: - patch
stage: commit review -> needs patch
2012-06-23 13:28:01python-devsetnosy: + python-dev
messages: + msg163605
2012-06-23 13:21:43ezio.melottisetmessages: + msg163604
2012-06-23 10:14:52georg.brandlsetmessages: + msg163570
2012-06-22 18:27:25ezio.melottisetstage: needs patch -> commit review
2012-06-21 14:50:15ezio.melottisetfiles: + issue15114.diff
keywords: + patch
messages: + msg163337
2012-06-20 12:38:44r.david.murraysetmessages: + msg163273
2012-06-20 10:01:34serhiy.storchakasetnosy: + serhiy.storchaka
2012-06-20 09:42:50ezio.melotticreate