Skip to content

Commit e269a2f

Browse files
committed
Remove the isstring hack in lxml treewalker.
This fixes html5lib#115 as a result, as we're no longer type-sniffing strings.
1 parent f130676 commit e269a2f

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

html5lib/treewalkers/lxmletree.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ def __init__(self, fragment_root, obj):
8787
self.tail = ensure_str(self.obj.tail)
8888
else:
8989
self.tail = None
90-
self.isstring = isinstance(obj, str) or isinstance(obj, bytes)
91-
# Support for bytes here is Py2
92-
if self.isstring:
93-
self.obj = ensure_str(self.obj)
9490

9591
def __getattr__(self, name):
9692
return getattr(self.obj, name)
@@ -143,7 +139,7 @@ def getNodeDetails(self, node):
143139
elif isinstance(node, Doctype):
144140
return _base.DOCTYPE, node.name, node.public_id, node.system_id
145141

146-
elif isinstance(node, FragmentWrapper) and node.isstring:
142+
elif isinstance(node, FragmentWrapper) and not hasattr(node, "tag"):
147143
return _base.TEXT, node.obj
148144

149145
elif node.tag == etree.Comment:

0 commit comments

Comments
 (0)