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

Remove old-deprecated ElementTree features #73395

Closed
serhiy-storchaka opened this issue Jan 8, 2017 · 9 comments
Closed

Remove old-deprecated ElementTree features #73395

serhiy-storchaka opened this issue Jan 8, 2017 · 9 comments
Labels
3.8 only security fixes extension-modules C modules in the Modules dir stdlib Python modules in the Lib dir topic-XML type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

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']

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life extension-modules C modules in the Modules dir stdlib Python modules in the Lib dir topic-XML type-feature A feature request or enhancement labels Jan 8, 2017
    @scoder
    Copy link
    Contributor

    scoder commented Jan 13, 2018

    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.

    @csabella
    Copy link
    Contributor

    Serhiy,

    Did you want to revive this for 3.8?

    @serhiy-storchaka
    Copy link
    Member Author

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

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @serhiy-storchaka
    Copy link
    Member Author

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

    @serhiy-storchaka serhiy-storchaka added 3.8 only security fixes and removed 3.7 (EOL) end of life labels May 12, 2018
    @serhiy-storchaka
    Copy link
    Member Author

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

    @jdemeyer
    Copy link
    Contributor

    jdemeyer commented Apr 5, 2019

    This should be closed.

    @serhiy-storchaka
    Copy link
    Member Author

    The rest will be removed in bpo-36543.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    nueces added a commit to nueces/jenkins-job-wrecker that referenced this issue Oct 30, 2023
    The getchildren method was deprecated in python2.7 and is removed 3.10
    See:
    - python/cpython#73395
    - python/cpython#80724
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes extension-modules C modules in the Modules dir stdlib Python modules in the Lib dir topic-XML type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants