pytries / datrie

Fast, efficiently stored Trie for Python. Uses libdatrie.
http://pypi.python.org/pypi/datrie/
GNU Lesser General Public License v2.1
530 stars 88 forks source link

Improper KeyError #55

Open Madwand99 opened 5 years ago

Madwand99 commented 5 years ago

This code results in an error:

import datrie
from struct import *

ascii=[pack('B',x).decode('latin-1') for x in range(256)]
t=datrie.Trie(ascii)
oneskey=''.join([ascii[x] for x in [255,139,234,21,94,4,210,70]])
t[oneskey]=5
t[oneskey]

Traceback (most recent call last): File "datriefail.py", line 8, in t[oneskey] File "src/datrie.pyx", line 677, in datrie.Trie.getitem (src/datrie.c:12741) File "src/datrie.pyx", line 192, in datrie.BaseTrie._getitem (src/datrie.c:4958) KeyError: 'ÿ\x8bê\x15^\x04ÒF'

I can't figure out why it's causing a problem.