1e0ng / simhash

A Python Implementation of Simhash Algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot create Simhash instance by long integer lower than 9223372036854775808 on linux

chaikau opened this issue · comments

Python 2.7.14 64bit
x86_64 Linux
AMD64 Windows

Try:

print Simhash(4390059585430954713).value

Encounter an error:

Traceback (most recent call last): File "/home/mypc/test_simhash.py", line 4, in <module> print Simhash(4390059585430954713).value File "/home/mypc/.local/lib/python2.7/site-packages/simhash/__init__.py", line 58, in __init__ raise Exception('Bad parameter with type {}'.format(type(value))) Exception: Bad parameter with type <type 'int'>

Then I found the python's sys.maxint was 9223372036854775807 on Linux, but 2147483647 on Windows, even the Windows was a 64bit system. I examine code, and I got isinstance(value, long) at line 60 in file simhash/init.py. So I have to add isinstance(value, int) into it, for the 4390059585430954713 is low than 9223372036854775808 but great than 2147483647, and the code Simhash(4390059585430954713) executed unsuccessfully on Linux but successfully on Windows. I don't know weither this change is right because I just learn little about simhash algorithm. So I post this issue to make sure.

Thanks for your efforts!