You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
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.
Activity
Cito commentedon Dec 21, 2008
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):
------------
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).
briancurtin commentedon Feb 9, 2010
The patch could use a test (which doesn't require sgmlop).
[-]Installing sgmlop can crash xmlrpclib[/-][+]Installing sgmlop causes xmlrpclib error[/+]bcroq commentedon Jul 23, 2012
This bug still present in Python 2.7, the proposed patch works.
akuchling commentedon Nov 6, 2016
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.