Skip to content

Installing sgmlop causes xmlrpclib error #48963

Closed

Description

@Cito
mannequin
BPO 4713
Nosy @akuchling, @Cito, @briancurtin
Files
  • xmlrpclib.patch: Patch for Issue4713
  • 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 2016-11-06.20:57:44.307>
    created_at = <Date 2008-12-21.21:30:06.077>
    labels = ['type-bug', 'library']
    title = 'Installing sgmlop causes xmlrpclib error'
    updated_at = <Date 2016-11-06.20:57:44.305>
    user = 'https://github.com/Cito'

    bugs.python.org fields:

    activity = <Date 2016-11-06.20:57:44.305>
    actor = 'akuchling'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-11-06.20:57:44.307>
    closer = 'akuchling'
    components = ['Library (Lib)']
    creation = <Date 2008-12-21.21:30:06.077>
    creator = 'cito'
    dependencies = []
    files = ['12418']
    hgrepos = []
    issue_num = 4713
    keywords = ['patch', 'needs review']
    message_count = 4.0
    messages = ['78156', '99131', '166220', '280172']
    nosy_count = 4.0
    nosy_names = ['akuchling', 'cito', 'brian.curtin', 'bcroq']
    pr_nums = []
    priority = 'normal'
    resolution = 'works for me'
    stage = 'test needed'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue4713'
    versions = ['Python 2.6']

    Activity

    1. Cito commented on Dec 21, 2008

      Citomannequin
      MannequinAuthor

      If you install sgmlop (downloadable from
      http://effbot.org/downloads/#sgmlop) under Python 2.x, then this can
      break xmlrpclib.

      You can reproduce this problem as follows (I have tested with Py 2.4,
      2.5 and 2.6):

      ------------

      data = """<?xml version="1.0" encoding="UTF-8"?>
      <methodCall><methodName>f</methodName><params>
      <param><value>k&#228;se</value></param>
      </params></methodCall>"""
      
      import xmlrpclib

      assert xmlrpclib.FastParser is None
      print xmlrpclib.SgmlopParser and 'with' or 'without', 'sgmlop'

      assert xmlrpclib.loads(data) == ((u'k\xe4se',), 'f')

      ------------

      If sgmlop is installed, this gives a UnicodeDecodeError, otherwise
      everything works well.

      This happens because xmlrpclib prefers using sgmlop over
      lib.parsers.expat, but fails to handle numeric character entities
      properly with this parser.

      Find attached a patch that fixes this problem.

      I also wonder whether lib.parsers.expat shouldn't be preferred over
      sgmlop, since the latter is somewhat outdated, and installing external
      libraries should not cause crashes or wrong behavior of standard lib
      modules (see also bpo-1772916 for a similar problem).

    2. added
      type-crashA hard crash of the interpreter, possibly with a core dump
      stdlibStandard Library Python modules in the Lib/ directory
      on Dec 21, 2008
    3. added
      type-bugAn unexpected behavior, bug, or error
      and removed
      type-crashA hard crash of the interpreter, possibly with a core dump
      on Feb 9, 2010
    4. briancurtin commented on Feb 9, 2010

      @briancurtin
      Member

      The patch could use a test (which doesn't require sgmlop).

    5. changed the title [-]Installing sgmlop can crash xmlrpclib[/-] [+]Installing sgmlop causes xmlrpclib error[/+] on Feb 9, 2010
    6. bcroq commented on Jul 23, 2012

      bcroqmannequin
      Mannequin

      This bug still present in Python 2.7, the proposed patch works.

    7. akuchling commented on Nov 6, 2016

      @akuchling
      Contributor

      I don't believe this bug is still present in Python 2.7. Issue bpo-5767 removed sgmlop support from xmlrpclib in 2.7 alpha 1, and trying the test program succeeds. Closing.

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

      stdlibStandard 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