Kaydet (Commit) 313b2ad1 authored tarafından Florent Xicluna's avatar Florent Xicluna

Fix imports in xml.dom.

üst 0a9dd2f1
...@@ -47,7 +47,7 @@ class MinidomTest(unittest.TestCase): ...@@ -47,7 +47,7 @@ class MinidomTest(unittest.TestCase):
def checkWholeText(self, node, s): def checkWholeText(self, node, s):
t = node.wholeText t = node.wholeText
self.confirm(t == s, "looking for %s, found %s" % (repr(s), repr(t))) self.confirm(t == s, "looking for %r, found %r" % (s, t))
def testParseFromFile(self): def testParseFromFile(self):
with open(tstfile) as file: with open(tstfile) as file:
......
import xml.sax import xml.sax
import xml.sax.handler import xml.sax.handler
import types
START_ELEMENT = "START_ELEMENT" START_ELEMENT = "START_ELEMENT"
END_ELEMENT = "END_ELEMENT" END_ELEMENT = "END_ELEMENT"
...@@ -334,10 +333,7 @@ def parse(stream_or_string, parser=None, bufsize=None): ...@@ -334,10 +333,7 @@ def parse(stream_or_string, parser=None, bufsize=None):
return DOMEventStream(stream, parser, bufsize) return DOMEventStream(stream, parser, bufsize)
def parseString(string, parser=None): def parseString(string, parser=None):
try: from io import StringIO
from io import StringIO
except ImportError:
from io import StringIO
bufsize = len(string) bufsize = len(string)
buf = StringIO(string) buf = StringIO(string)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment