Skip to content

Commit 0941326

Browse files
committed
Fix DATrie support under Python 2.
This is a simple issue of using `str` to refer to what should be `six.text_type`.
1 parent ffa00dd commit 0941326

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

html5lib/trie/datrie.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
from itertools import chain
44

55
from datrie import Trie as DATrie
6+
from six import text_type
67

78
from ._base import Trie as ABCTrie
89

910
class Trie(ABCTrie):
1011
def __init__(self, data):
1112
chars = set()
1213
for key in data.keys():
13-
if not isinstance(key, str):
14+
if not isinstance(key, text_type):
1415
raise TypeError("All keys must be strings")
1516
for char in key:
1617
chars.add(char)

0 commit comments

Comments
 (0)