This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Installing sgmlop causes xmlrpclib error
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: akuchling, bcroq, brian.curtin, cito
Priority: normal Keywords: needs review, patch

Created on 2008-12-21 21:30 by cito, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
xmlrpclib.patch cito, 2008-12-21 21:38 Patch for Issue4713 review
Messages (4)
msg78156 - (view) Author: Christoph Zwerschke (cito) * Date: 2008-12-21 21:30
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 Issue1772916 for a similar problem).
msg99131 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-02-09 17:29
The patch could use a test (which doesn't require sgmlop).
msg166220 - (view) Author: Bertrand Croq (bcroq) Date: 2012-07-23 12:01
This bug still present in Python 2.7, the proposed patch works.
msg280172 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2016-11-06 20:57
I don't believe this bug is still present in Python 2.7.  Issue #5767 removed sgmlop support from xmlrpclib in 2.7 alpha 1, and trying the test program succeeds.  Closing.
History
Date User Action Args
2022-04-11 14:56:43adminsetgithub: 48963
2016-11-06 20:57:44akuchlingsetstatus: open -> closed

nosy: + akuchling
messages: + msg280172

resolution: works for me
2012-07-23 12:01:13bcroqsetnosy: + bcroq
messages: + msg166220
2010-02-09 17:29:16brian.curtinsetpriority: normal

title: Installing sgmlop can crash xmlrpclib -> Installing sgmlop causes xmlrpclib error
keywords: + needs review
nosy: + brian.curtin

messages: + msg99131
stage: test needed
2010-02-09 16:34:47brian.curtinsettype: crash -> behavior
2008-12-21 21:38:13citosetfiles: + xmlrpclib.patch
keywords: + patch
2008-12-21 21:30:06citocreate