Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop using deprecated HTMLParser.unescape #1788

Merged
merged 1 commit into from Jun 19, 2019
Merged

stop using deprecated HTMLParser.unescape #1788

merged 1 commit into from Jun 19, 2019

Conversation

@methane
Copy link
Contributor

@methane methane commented Jun 18, 2019

Summary of changes

HTMLParser.unescape is deprecated since Python 3.4.

Pull Request Checklist

  • N/A Changes have tests
  • News fragment added in changelog.d. See documentation for details
@methane
Copy link
Contributor Author

@methane methane commented Jun 18, 2019

Should this type of change require News fragment and test?

Note that this change is executed always when this module is imported...

@pganssle
Copy link
Member

@pganssle pganssle commented Jun 18, 2019

It took me a second to realize how this was different from the current formulation, but it's because as is, HtmlParser().unescape is always executed, even if unused.

I think a changelog entry would be wise, because when people start using Python 3.9, they'll want to know the minimum version of setuptools to pin.

I don't think a separate test for this is necessary.

Thanks!

HTMLParser.unescape is accessed even when unused - this will cause an
exception when `HTMLParser.unescape` is removed in Python 3.9.
@pganssle
Copy link
Member

@pganssle pganssle commented Jun 19, 2019

Thanks @methane, I've squashed the current commits and marked this for auto-merge, so it should merge as soon as the CI passes.

Glad to have people getting us ahead of the curve on avoiding deprecation warnings / breaking changes. Much better for the versions of setuptools that work with Python 3.9 to be released well in advance of 3.9.

@mergify mergify bot merged commit 62bd483 into pypa:master Jun 19, 2019
6 checks passed
@methane methane deleted the patch-1 branch Jul 24, 2019
Copy link

@GegX GegX left a comment

I encounter that issue with python 3.9 while installing
python3 -m pip install robotframework-debugger
so this would do the trick

´´´
Collecting tkinterhtml (from robotframework-debugger)
Downloading https://files.pythonhosted.org/packages/37/be/86c2db091f663667686726aa7c45dc5fa198683b018986e6a5854006dbd7/tkinterhtml-0.7.zip (930kB)
100% |████████████████████████████████| 931kB 1.9MB/s
Exception:
File "/usr/share/python-wheels/setuptools-39.0.1-py2.py3-none-any.whl/setuptools/py33compat.py", line 54, in
unescape = getattr(html, 'unescape', html_parser.HTMLParser().unescape)
AttributeError: 'HTMLParser' object has no attribute 'unescape
´´´

my params:
setuptools-50.3.2
python 3.9.0
pip 9.0.1

@methane
Copy link
Contributor Author

@methane methane commented Oct 29, 2020

What version of setuptools do you use?
Don't you just using very old setuptools?

@joergent
Copy link

@joergent joergent commented Dec 15, 2020

The file py33compat.py is buggy placing the test for the html module in the bottom of the file probably inside a class where the html module import is hidden and not just after importing html. This is my interpretation as I don't program in python.
However the py33compat.py file is omitted in version 51.0.0 and the wrong test for html.unescape is thus history.

This incorrect test prevented me in using letsencrypt as it was upgrading itself automatically.
I changed the setuptool lines in certbot-auto to this

('12/e1/b9a2926a3c5a3fb055b8f85052f5baa890106a0e21b64a977c10affea751/'
'setuptools-51.0.0.zip',
'029c49fd713e9230f6a41c0298e6e1f5839f2cde7104c0ad5e053a37777e7688'),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants