Skip to content

elementtree serialization bug for weird namespace urls #47401

Closed

Description

@xrotwang
mannequin
BPO 3151
Nosy @amauryfa, @florentx
Superseder
  • bpo-6472: Update ElementTree with upstream changes
  • Files
  • etree.patch
  • 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:53:28.315>
    created_at = <Date 2008-06-20.15:16:20.608>
    labels = ['easy', 'type-bug', 'library']
    title = 'elementtree serialization bug for weird namespace urls'
    updated_at = <Date 2010-03-11.14:53:28.313>
    user = 'https://bugs.python.org/xrotwang'

    bugs.python.org fields:

    activity = <Date 2010-03-11.14:53:28.313>
    actor = 'flox'
    assignee = 'effbot'
    closed = True
    closed_date = <Date 2010-03-11.14:53:28.315>
    closer = 'flox'
    components = ['Library (Lib)']
    creation = <Date 2008-06-20.15:16:20.608>
    creator = 'xrotwang'
    dependencies = []
    files = ['10678']
    hgrepos = []
    issue_num = 3151
    keywords = ['patch', 'easy']
    message_count = 4.0
    messages = ['68463', '68475', '99397', '100862']
    nosy_count = 4.0
    nosy_names = ['effbot', 'amaury.forgeotdarc', 'xrotwang', 'flox']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = '6472'
    type = 'behavior'
    url = 'https://bugs.python.org/issue3151'
    versions = ['Python 2.7', 'Python 3.2']

    Activity

    1. xrotwang commented on Jun 20, 2008

      xrotwangmannequin
      MannequinAuthor

      when serializing elementtrees with weird namespaces like {$stuff}, the
      generated xml is not valid:

      Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12)
      [GCC 4.1.3 2007092 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2

      IDLE 1.2.1 ==== No Subprocess ====

      >>> from xml.etree import ElementTree as et
      >>> e = et.fromstring('<prefix:localname xmlns:prefix="${stuff}"/>')
      >>> e.tag
      '{${stuff}}localname'
      >>> t = et.ElementTree(e)
      >>> from StringIO import StringIO
      >>> f = StringIO()
      >>> t.write(f)
      >>> f.seek(0)
      >>> print f.read()
      <ns0:}localname xmlns:ns0="${stuff" />
    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Jun 20, 2008
    3. amauryfa commented on Jun 20, 2008

      @amauryfa
      Contributor

      A one-letter fix :-)
      (the localname cannot contain special characters)

    4. florentx commented on Feb 16, 2010

      florentxmannequin
      Mannequin

      Thanks for the one-letter fix.

      Test added to the upgrade proposed on bpo-6472.

    5. florentx commented on Mar 11, 2010

      florentxmannequin
      Mannequin

      Fixed in trunk.

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

      easystdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions