From 317185a533f6d6b7fcad63ec5e7f875cea09fcb9 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 4 Jun 2009 09:00:56 +0000 Subject: Recorded merge of revisions 73201 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r73201 | georg.brandl | 2009-06-04 10:58:32 +0200 (Do, 04 Jun 2009) | 1 line #5767: remove sgmlop support from xmlrpclib; the sgmlop parser does not do much validation and is no longer much faster than e.g. the cElementTree XMLParser. ........ --- Lib/xmlrpc/client.py | 55 +--------------------------------------------------- Misc/NEWS | 2 ++ 2 files changed, 3 insertions(+), 54 deletions(-) diff --git a/Lib/xmlrpc/client.py b/Lib/xmlrpc/client.py index cc717e0..0e7621a 100644 --- a/Lib/xmlrpc/client.py +++ b/Lib/xmlrpc/client.py @@ -439,56 +439,6 @@ WRAPPERS = (DateTime, Binary) # -------------------------------------------------------------------- # XML parsers -# -# the SGMLOP parser is about 15x faster than Python's builtin -# XML parser. SGMLOP sources can be downloaded from: -# -# http://www.pythonware.com/products/xml/sgmlop.htm -# - -try: - import sgmlop - if not hasattr(sgmlop, "XMLParser"): - raise ImportError -except ImportError: - SgmlopParser = None # sgmlop accelerator not available -else: - class SgmlopParser: - def __init__(self, target): - - # setup callbacks - self.finish_starttag = target.start - self.finish_endtag = target.end - self.handle_data = target.data - self.handle_xml = target.xml - - # activate parser - self.parser = sgmlop.XMLParser() - self.parser.register(self) - self.feed = self.parser.feed - self.entity = { - "amp": "&", "gt": ">", "lt": "<", - "apos": "'", "quot": '"' - } - - def close(self): - try: - self.parser.close() - finally: - self.parser = self.feed = None # nuke circular reference - - def handle_proc(self, tag, attr): - m = re.search("encoding\s*=\s*['\"]([^\"']+)[\"']", attr) - if m: - self.handle_xml(m.group(1), 1) - - def handle_entityref(self, entity): - # entity - try: - self.handle_data(self.entity[entity]) - except KeyError: - self.handle_data("&%s;" % entity) - try: from xml.parsers import expat if not hasattr(expat, "ParserCreate"): @@ -497,8 +447,7 @@ except ImportError: ExpatParser = None # expat not available else: class ExpatParser: - # fast expat parser for Python 2.0 and later. this is about - # 50% slower than sgmlop, on roundtrip testing + # fast expat parser for Python 2.0 and later. def __init__(self, target): self._parser = parser = expat.ParserCreate(None, None) self._target = target @@ -963,8 +912,6 @@ def getparser(use_datetime=0): target = Unmarshaller(use_datetime=use_datetime) if FastParser: parser = FastParser(target) - elif SgmlopParser: - parser = SgmlopParser(target) elif ExpatParser: parser = ExpatParser(target) else: diff --git a/Misc/NEWS b/Misc/NEWS index 6c39463..e2aac90 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -21,6 +21,8 @@ Core and Builtins Library ------- +- Issue #5767: Remove sgmlop support from xmlrpc.client. + - Issue #6150: Fix test_unicode on wide-unicode builds. - Issue #6149: Fix initialization of WeakValueDictionary objects from non-empty -- cgit v0.12