ifduyue / python-xxhash

Python Binding for xxHash

Home Page:https://pypi.org/project/xxhash/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot hash data larger than 2GB

pitrou opened this issue · comments

>>> xxhash.xxh64(b'x' * 2**30)
<xxhash.xxh64 at 0x7f8e528d14f0>
>>> xxhash.xxh64(b'x' * 2**31)
Traceback (most recent call last):
  File "<ipython-input-31-0560f5d338db>", line 1, in <module>
    xxhash.xxh64(b'x' * 2**31)
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.

@pitrou Hello, PR would be awesome.