From 786b3ef83c2ced516d95b40e8876cd1936301590 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Fri, 11 Aug 2023 16:05:33 -0700 Subject: [PATCH] remove redundant try import, use BytesIO for byte stream.. --- src/SOAPpy/Parser.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/SOAPpy/Parser.py b/src/SOAPpy/Parser.py index 476e0b9..36d4d64 100644 --- a/src/SOAPpy/Parser.py +++ b/src/SOAPpy/Parser.py @@ -9,10 +9,7 @@ import string import xml.sax from wstools.XMLname import fromXMLname import collections -try: - from io import StringIO -except ImportError: - from io import StringIO +from io import StringIO, BytesIO try: from M2Crypto import SSL except: pass @@ -1050,7 +1047,7 @@ class EmptyEntityResolver(xml.sax.handler.EntityResolver): def _parseSOAP(xml_str, rules = None, ignore_ext=None, forbid_entities=False, forbid_external=True, forbid_dtd=False): inpsrc = xml.sax.xmlreader.InputSource() - inpsrc.setByteStream(StringIO(xml_str)) + inpsrc.setByteStream(BytesIO(xml_str)) if ignore_ext is None: ignore_ext = False