You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> import mmh3
>>> import numpy as np
>>> a = np.zeros(2**30, dtype=np.int8)
>>> mmh3.hash_bytes(a)
b"O\xc5\xf1\xf2\x80';s\x1b\xddc\xa1E\x8d\xe3r"
>>> a = np.zeros(2**32, dtype=np.int8)
>>> mmh3.hash_bytes(a)
Traceback (most recent call last):
File "<ipython-input-9-918a38167947>", line 1, in <module>
mmh3.hash_bytes(a)
OverflowError: size does not fit in an int
The solution is to either use the s* code instead of s# in PyArg_ParseTuple(), or define the PY_SSIZET_CLEAN macro and change size fields from int to Py_ssize_t. See https://docs.python.org/2.7/c-api/arg.html . I can also make a PR if you want.
Also, there's no test suite?
The text was updated successfully, but these errors were encountered:
Hi pitrou. Thank you so much for your suggestion and providing concrete solutions to improve the code. I just updated this library to incorporate your suggestion. Feel free to ask me if you still need other features.
mmh3
cannot hash data larger than 2**31 bytes:The solution is to either use the
s*
code instead ofs#
in PyArg_ParseTuple(), or define thePY_SSIZET_CLEAN
macro and change size fields fromint
toPy_ssize_t
. See https://docs.python.org/2.7/c-api/arg.html . I can also make a PR if you want.Also, there's no test suite?
The text was updated successfully, but these errors were encountered: