Skip to content

ElementTree.Element and cElementTree.Element have slightly different repr #50479

Closed

Description

@NeilMuller
mannequin
BPO 6230
Nosy @florentx
Superseder
  • bpo-6472: Update ElementTree with upstream changes
  • Files
  • repr-fix.diff: Fix & test case for repr behaviour
  • 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 2010-03-11.14:59:13.377>
    created_at = <Date 2009-06-07.14:08:15.277>
    labels = ['expert-XML', 'type-bug']
    title = 'ElementTree.Element and cElementTree.Element have slightly different repr'
    updated_at = <Date 2010-03-11.14:59:13.375>
    user = 'https://bugs.python.org/NeilMuller'

    bugs.python.org fields:

    activity = <Date 2010-03-11.14:59:13.375>
    actor = 'flox'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-03-11.14:59:13.377>
    closer = 'flox'
    components = ['XML']
    creation = <Date 2009-06-07.14:08:15.277>
    creator = 'Neil Muller'
    dependencies = []
    files = ['14212']
    hgrepos = []
    issue_num = 6230
    keywords = ['patch']
    message_count = 4.0
    messages = ['89035', '89053', '99405', '100864']
    nosy_count = 6.0
    nosy_names = ['effbot', 'hodgestar', 'Neil Muller', 'jerith', 'russell', 'flox']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = '6472'
    type = 'behavior'
    url = 'https://bugs.python.org/issue6230'
    versions = ['Python 2.6', 'Python 3.1', 'Python 2.7']

    Activity

    1. NeilMuller commented on Jun 7, 2009

      NeilMullermannequin
      MannequinAuthor

      ElementTree and cElementTree give slightly different results for
      repr(Element):

      >>> import xml.etree.ElementTree as ET
      >>> import xml.etree.cElementTree as cET
      >>> repr(ET.ElementTree('tag'))
      '<Element tag at b7cf506c>'
      >>> repr(cET.ElementTree('tag')
      "<Element 'tag' at 0xb7c266f8>"

      The quoting around the tag name is missing from ElementTree.

      This inconsistency seems pointless.

      Attached patch changes ElementTree to match cElementTree behaviour, and
      adds a test.

    2. added
      stdlib
      type-bug
      on Jun 7, 2009
    3. NeilMuller commented on Jun 7, 2009

      NeilMullermannequin
      MannequinAuthor

      Same issue affects python 3k - the patch applies there cleanly as well.

    4. florentx commented on Feb 16, 2010

      florentxmannequin
      Mannequin

      Fixed with upstream. See bpo-6472.

    5. added and removed
      stdlib
      on Feb 16, 2010
    6. florentx commented on Mar 11, 2010

      florentxmannequin
      Mannequin

      Fixed in trunk with bpo-6472.

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

    Assignees

    No one assigned

      Labels

      topic-XMLtype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions