Skip to content

DeprecationWarning when parse ElementTree with a doctype in 2.7 #74134

Closed

Description

@serhiy-storchaka
BPO 29948
Nosy @scoder, @serhiy-storchaka
Dependencies
  • bpo-15083: Rewrite ElementTree tests in a cleaner and safer way
  • Superseder
  • bpo-30365: Backport warnings in ElementTree/cElementTree modules and fix bugs
  • 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 = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2017-05-18.17:58:55.506>
    created_at = <Date 2017-03-30.15:03:07.869>
    labels = ['expert-XML', 'type-bug']
    title = 'DeprecationWarning when parse ElementTree with a doctype in 2.7'
    updated_at = <Date 2017-05-18.17:58:55.505>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-05-18.17:58:55.505>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2017-05-18.17:58:55.506>
    closer = 'serhiy.storchaka'
    components = ['XML']
    creation = <Date 2017-03-30.15:03:07.869>
    creator = 'serhiy.storchaka'
    dependencies = ['15083']
    files = []
    hgrepos = []
    issue_num = 29948
    keywords = []
    message_count = 2.0
    messages = ['290846', '293933']
    nosy_count = 3.0
    nosy_names = ['scoder', 'eli.bendersky', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = '30365'
    type = 'behavior'
    url = 'https://bugs.python.org/issue29948'
    versions = ['Python 2.7']

    Activity

    1. serhiy-storchaka commented on Mar 30, 2017

      @serhiy-storchaka
      MemberAuthor

      DeprecationWarning is emitted when parse ElementTree with a doctype in 2.7.

      $ python2.7 -Wa
      Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
      [GCC 5.4.0 20160609] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import xml.etree.ElementTree as ET
      >>> ET.XML('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>text</html>')
      /usr/lib/python2.7/xml/etree/ElementTree.py:1638: DeprecationWarning: This method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder target.
        DeprecationWarning,
      /usr/lib/python2.7/xml/etree/ElementTree.py:1638: DeprecationWarning: This method of XMLParser is deprecated.  Define doctype() method on the TreeBuilder target.
        DeprecationWarning,
      <Element 'html' at 0xb7025b4c>
    2. added
      type-bug
      on Mar 30, 2017
    3. serhiy-storchaka commented on May 18, 2017

      @serhiy-storchaka
      MemberAuthor

      Fixed in bpo-30365.

    4. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    topic-XMLtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions