@@ -393,7 +393,7 @@ cdef class {{name}}HashTable(HashTable):
393
393
def __cinit__(self, int64_t size_hint=1):
394
394
self.table = kh_init_{{dtype}}()
395
395
if size_hint is not None:
396
- size_hint = min(size_hint, SIZE_HINT_LIMIT)
396
+ size_hint = min(kh_get_bucket_n( size_hint) , SIZE_HINT_LIMIT)
397
397
kh_resize_{{dtype}}(self.table, size_hint)
398
398
399
399
def __len__(self) -> int:
@@ -741,7 +741,7 @@ cdef class StringHashTable(HashTable):
741
741
def __init__(self, int64_t size_hint=1):
742
742
self.table = kh_init_str()
743
743
if size_hint is not None:
744
- size_hint = min(size_hint, SIZE_HINT_LIMIT)
744
+ size_hint = min(kh_get_bucket_n( size_hint) , SIZE_HINT_LIMIT)
745
745
kh_resize_str(self.table, size_hint)
746
746
747
747
def __dealloc__(self):
@@ -1063,7 +1063,7 @@ cdef class PyObjectHashTable(HashTable):
1063
1063
def __init__(self, int64_t size_hint=1):
1064
1064
self.table = kh_init_pymap()
1065
1065
if size_hint is not None:
1066
- size_hint = min(size_hint, SIZE_HINT_LIMIT)
1066
+ size_hint = min(kh_get_bucket_n( size_hint) , SIZE_HINT_LIMIT)
1067
1067
kh_resize_pymap(self.table, size_hint)
1068
1068
1069
1069
def __dealloc__(self):
0 commit comments