roy-ht/editdistance

Bug with strings longer than 32 chars when compiled on windows

Closed this issue · 3 comments

I get:

s="123456789012345678901234567890123"
editdistance.eval(s,s)
64L

I'm running on:
Windows 8 64bit
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Compiled with (I think):
Microsoft Visual C++ Compiler Package for Python 2.7
I also have Visual Studio 2013 installed

Took a look at the source code, and I'm guessing it's related to the compilation on a 32-bit python distribution since you're using bit operations on 64-bit variables. I guess one of the variables is wrongly defined as size_t instead of uint64_t

OK, found it. Using (1L << 63) with a 32-bit doesn't work as intended. Solved by replacing all 1L with 1LL. See PR #5

aflc commented

Thanks @zoharby, merged it :)