We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 156c337 commit 011ea47Copy full SHA for 011ea47
Lib/xml/dom/pulldom.py
@@ -1,5 +1,11 @@
1
import xml.sax
2
import xml.sax.handler
3
+import types
4
+
5
+try:
6
+ _StringTypes = [types.StringType, types.UnicodeType]
7
+except AttributeError:
8
+ _StringTypes = [types.StringType]
9
10
START_ELEMENT = "START_ELEMENT"
11
END_ELEMENT = "END_ELEMENT"
@@ -235,7 +241,7 @@ def characters(self, chars):
235
241
def parse(stream_or_string, parser=None, bufsize=None):
236
242
if bufsize is None:
237
243
bufsize = default_bufsize
238
- if type(stream_or_string) in [type(""), type(u"")]:
244
+ if type(stream_or_string) in _StringTypes:
239
245
stream = open(stream_or_string)
240
246
else:
247
stream = stream_or_string
0 commit comments