Skip to content

Avoid cElementTree on Python 3 #494

Closed

Description

@uranusjr

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

Activity

  1. gsnedders commented on May 22, 2020

    @gsnedders
    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.

  2. uranusjr commented on May 22, 2020

    @uranusjr
    Author

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

  3. tiran commented on May 23, 2020

    @tiran
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions