Skip to content

Avoid cElementTree on Python 3 #494

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

Closed
uranusjr opened this issue May 21, 2020 · 3 comments · Fixed by #502
Closed

Avoid cElementTree on Python 3 #494

uranusjr opened this issue May 21, 2020 · 3 comments · Fixed by #502

Comments

@uranusjr
Copy link

cElementTree has been deprecated since 3.3, and is simply an alias to ElementTree right now. It will be removed in the Python 3.10.

Originally filed as: pypa/pip#8278
See also: python/cpython#19921

@gsnedders
Copy link
Member

What prompts the desire to avoid it? Avoiding the PendingDeprecationWarning proposed to be added in python/cpython#19921 but not python/cpython#20117? This this causes warnings with the perfectly sane try/except ImportError that's so prevalent and future-proof seems ridiculous.

@uranusjr
Copy link
Author

cc-ing @tiran since I do not have the knowledge to answer the question myself.

@tiran
Copy link
Contributor

tiran commented May 23, 2020

The removal of cElementTree without a deadline and deprecation warning broke a bunch of packages. I like to re-introduce the module in 3.9 with a warning and remove it in 3.10.

The warning is breaking Python's ensurepip tests. Pip depends on html5lib and html5lib triggers the warning. My patch avoids the warning and keeps the behavior of html5lib. If you want a simpler patch, then just import xml.etree.ElementTree in all Python versions. This works in Python 2, but it's going to slow down parsing on Python 2 a bit.

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

Successfully merging a pull request may close this issue.

3 participants