make StringStore.__contains__() return True for the empty string (which is also contained in iteration)

This commit is contained in:
Stefan Behnel 2016-03-24 15:40:12 +01:00
parent f2cfbfc412
commit f18805ee1c
1 changed files with 3 additions and 1 deletions

View File

@ -116,7 +116,9 @@ cdef class StringStore:
else:
raise TypeError(type(string_or_id))
def __contains__(self, unicode string):
def __contains__(self, unicode string not None):
if len(string) == 0:
return True
cdef hash_t key = hash_string(string)
return self._map.get(key) is not NULL