classification
Title: Define an __all__ for html.parser
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ezio.melotti Nosy List: ezio.melotti, maker, merwok, orsenthil, python-dev, vinay.sajip
Priority: normal Keywords: 3.2regression, patch

Created on 2012-04-26 20:06 by vinay.sajip, last changed 2013-05-01 13:11 by ezio.melotti. This issue is now closed.

Files
File name Uploaded Description Edit
issue14679.diff ezio.melotti, 2013-03-29 23:53 review
Messages (6)
msg159421 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-04-26 20:06
The change to html.parser.tagfind in ba4baaddac8d is causing third-party code (Django) to fail. See

http://mail.python.org/pipermail/python-dev/2012-April/119074.html

for more information.

Other patterns which changed (e.g. attrfind_tolerant) might also lead to problems. As suggested in the python-dev thread, private versions of these patterns should be used and the existing public ones deprecated, where appropriate.
msg171353 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-09-26 18:43
The issue with Django seems to be solved, but as Terry suggested in http://mail.python.org/pipermail/python-dev/2012-April/119087.html, adding an __all__ would be a good idea.  I'm changing the scope of the issue accordingly.
msg171423 - (view) Author: Michele OrrĂ¹ (maker) * Date: 2012-09-28 09:29
"# Internal" appears only in HTMLParser's methods; how could __all__ fix this?
msg185528 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-03-29 23:53
The module only defines 2 public objects: HTMLParser and HTMLParseError.  
The attached patch adds an __all__ with only HTMLParser.  Should HTMLParseError be included too, even though it's deprecated and will be removed in 3.5?

@Michele:
__all__ won't fix that, but at least it will make clear that the module-level regex (like tagfind) are not public.  Renaming the methods is not a good idea IMHO, we could move the "# internal" comments in the docstrings though.
msg185789 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-04-02 01:44
I think, HTMLParseError should also be defined __all__ (all also servers as what public classes/methods to look for sometimes and sets some expectation while reading the code.) 

There is no deprecation warning added in the class here.
msg188220 - (view) Author: Roundup Robot (python-dev) Date: 2013-05-01 13:09
New changeset 1f7ce8af3356 by Ezio Melotti in branch 'default':
#14679: add an __all__ (that contains only HTMLParser) to html.parser.
http://hg.python.org/cpython/rev/1f7ce8af3356
History
Date User Action Args
2013-05-01 13:11:38ezio.melottisetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2013-05-01 13:09:49python-devsetnosy: + python-dev
messages: + msg188220
2013-04-02 01:44:34orsenthilsetnosy: + orsenthil
messages: + msg185789
2013-03-29 23:53:43ezio.melottisetfiles: + issue14679.diff
keywords: + patch
messages: + msg185528

stage: needs patch -> patch review
2012-09-28 09:29:52makersetnosy: + maker
messages: + msg171423
2012-09-26 18:43:32ezio.melottisetversions: + Python 3.4, - Python 3.3
title: Changes to html.parser break third-party code -> Define an __all__ for html.parser
messages: + msg171353

assignee: ezio.melotti
components: + Library (Lib)
stage: needs patch
2012-04-26 20:11:42merwoksetnosy: + merwok
2012-04-26 20:06:12vinay.sajipcreate