Skip to content

Remove old-deprecated ElementTree features #73395

Closed

Description

@serhiy-storchaka
BPO 29209
Nosy @scoder, @ned-deily, @serhiy-storchaka, @jdemeyer, @csabella, @GPHemsley
PRs
  • bpo-29209: Remove old-deprecated features in ElementTree. #6769
  • Dependencies
  • bpo-29204: Add code deprecations in ElementTree
  • Files
  • etree_remove_deprecated.patch
  • etree_remove_deprecated_getiterator.diff: Remove getchildren() and getiterator()
  • etree_remove_deprecated_cElementTree.diff: Remove xml.etree.cElementTree
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-04-06.16:16:03.335>
    created_at = <Date 2017-01-08.17:56:24.989>
    labels = ['extension-modules', 'expert-XML', '3.8', 'type-feature', 'library']
    title = 'Remove old-deprecated ElementTree features'
    updated_at = <Date 2019-04-06.16:16:03.333>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2019-04-06.16:16:03.333>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-04-06.16:16:03.335>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules', 'Library (Lib)', 'XML']
    creation = <Date 2017-01-08.17:56:24.989>
    creator = 'serhiy.storchaka'
    dependencies = ['29204']
    files = ['46216', '47584', '47585']
    hgrepos = []
    issue_num = 29209
    keywords = ['patch']
    message_count = 9.0
    messages = ['285000', '309891', '311330', '316422', '316423', '316424', '322280', '339489', '339534']
    nosy_count = 7.0
    nosy_names = ['scoder', 'ned.deily', 'eli.bendersky', 'serhiy.storchaka', 'jdemeyer', 'cheryl.sabella', 'gphemsley']
    pr_nums = ['6769']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue29209'
    versions = ['Python 3.8']

    Activity

    1. serhiy-storchaka commented on Jan 8, 2017

      @serhiy-storchaka
      MemberAuthor

      Proposed patch removes old-deprecated ElementTree features.

      • Methods Element.getchildren(), Element.getiterator() and ElementTree.getiterator() deprecated in 2.7 and 3.2.
        Use list(elem) or iteration instead of getchildren(), methods iter() instead of getiterator().

      • The html argument of XMLParser deprecated in 3.4.
        The rest of arguments are keyword-only now (passing them as keywords was recommended in the documentatin).

      • The support of the doctype() method of XMLParser subclasses and its default implementation. Deprecated in 3.2. Define the doctype() method on a custom TreeBuilder target instead.

      • The xml.etree.cElementTree module deprecated in 3.3.

      Unfortunately some of these deprecations are in the documentation only or in Python implementatation, but not in C implementatation. Perhaps missed warnings should be added first (see bpo-29204). But if commit the patch from bpo-29204 in 3.6, perhaps deprecated features could be removed in 3.7.

    2. scoder commented on Jan 13, 2018

      @scoder
      Contributor

      Patch looks right to me.

      I'd personally be ok with applying it to 3.7, but I'll leave the decision to you. Most of the removed "features" are non-controversial, except:

      • "getchildren()" is probably still in use, also because it's more efficient than "list(elem)" in lxml (and has never been deprecated there), so code that supports both libraries might have preferred it

      • cElementTree is probably still imported by quite a bit of code

      So, this will have an impact on user code, despite any previous deprecation warnings. But it's easy to resolve in a backwards compatible way.

    3. csabella commented on Jan 31, 2018

      @csabella
      Contributor

      Serhiy,

      Did you want to revive this for 3.8?

    4. serhiy-storchaka commented on May 12, 2018

      @serhiy-storchaka
      MemberAuthor

      getchildren() and getiterator() have deprecation notes in their docstrings in lxml.etree.

    5. serhiy-storchaka commented on May 12, 2018

      @serhiy-storchaka
      MemberAuthor

      PR 6769 removes the html parameter and the doctype() method. getchildren() and getiterator() emit now a DeprecationWarning instead of PendingDeprecationWarning and will be removed in 3.9.

    6. serhiy-storchaka commented on May 12, 2018

      @serhiy-storchaka
      MemberAuthor

      The following two patches will remove getchildren() and getiterator() (in 3.9) and xml.etree.cElementTree (in an unspecified future).

    7. serhiy-storchaka commented on Jul 24, 2018

      @serhiy-storchaka
      MemberAuthor

      New changeset 02ec92f by Serhiy Storchaka in branch 'master':
      bpo-29209: Remove old-deprecated features in ElementTree. (GH-6769)
      02ec92f

    8. jdemeyer commented on Apr 5, 2019

      @jdemeyer
      Contributor

      This should be closed.

    9. serhiy-storchaka commented on Apr 6, 2019

      @serhiy-storchaka
      MemberAuthor

      The rest will be removed in bpo-36543.

    10. transferred this issue fromon Apr 10, 2022
    11. added a commit that references this issue on Oct 30, 2023
    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

      3.8 (EOL)end of lifeextension-modulesC modules in the Modules dirstdlibStandard Library Python modules in the Lib/ directorytopic-XMLtype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions