Closed sandrotosi closed 10 years ago
I have the same problem on OS X:
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Levenshtein
>>> Levenshtein.seqratio("apples", "oranges")
Segmentation fault
The traceback is:
Process: Python [11538]
Path: /System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: bash [806]
PlugIn Path: /Library/Python/2.6/site-packages/python_Levenshtein-0.11.2-py2.6-macosx-10.6-universal.egg/Levenshtein.so
PlugIn Identifier: Levenshtein.so
PlugIn Version: ??? (???)
Date/Time: 2014-08-18 17:00:53.560 +0100
OS Version: Mac OS X 10.6.8 (10K549)
Report Version: 6
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: 0x000000000000000d, 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 Levenshtein.so 0x00000001001e26ea extract_stringlist + 103
1 Levenshtein.so 0x00000001001e2ca9 setseq_common + 505
2 Levenshtein.so 0x00000001001e2efa seqratio_py + 59
3 org.python.python 0x0000000100089187 PyEval_EvalFrameEx + 15317
4 org.python.python 0x000000010008acce PyEval_EvalCodeEx + 1803
5 org.python.python 0x000000010008ad61 PyEval_EvalCode + 54
6 org.python.python 0x00000001000a265a Py_CompileString + 78
7 org.python.python 0x00000001000a44dd PyRun_InteractiveOneFlags + 503
8 org.python.python 0x00000001000a4615 PyRun_InteractiveLoopFlags + 206
9 org.python.python 0x00000001000a4685 PyRun_AnyFileExFlags + 76
10 org.python.python 0x00000001000b0286 Py_Main + 2718
11 org.python.python.app 0x0000000100000e6c start + 52
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000100124ce0 rbx: 0x8447ec0077b42b75 rcx: 0x00007fff5fbff2f8 rdx: 0x0000000000000006
rdi: 0x000000010054b7e0 rsi: 0x00000001001e9324 rbp: 0x00007fff5fbff2a0 rsp: 0x00007fff5fbff250
r8: 0x00007fff5fbff308 r9: 0x00000001002fc0a4 r10: 0x000000000000001b r11: 0x000000010003dd21
r12: 0x000000010047cd40 r13: 0x000000010054b7e0 r14: 0x0000000100544ef0 r15: 0x00000001001e3b20
rip: 0x00000001001e26ea rfl: 0x0000000000010293 cr2: 0x00000001001e2ebf
Binary Images:
0x100000000 - 0x100000ff7 org.python.python.app 2.6 (2.6) <3F4A329D-3EF9-A736-6F3D-67A4B39AE8DE> /System/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python
0x100004000 - 0x100114ff7 org.python.python 2.6.1 (2.6.1) <126DA8FF-5BC2-8788-51E3-D7A29A3F9F0F> /System/Library/Frameworks/Python.framework/Versions/2.6/Python
0x1001d8000 - 0x1001daff7 readline.so ??? (???) <200F07EB-D7AC-BE0E-165E-A84266ECC26F> /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload/readline.so
0x1001e0000 - 0x1001ecfff +Levenshtein.so ??? (???) <C15F5478-3A82-6CB5-6001-CDA897477489> /Library/Python/2.6/site-packages/python_Levenshtein-0.11.2-py2.6-macosx-10.6-universal.egg/Levenshtein.so
0x100570000 - 0x10058cfe7 libedit.2.dylib 2.11.0 (compatibility 2.0.0) <8DC2232B-8AE0-E83B-1639-A78D00F33E3E> /usr/lib/libedit.2.dylib
0x7fff5fc00000 - 0x7fff5fc3bdef dyld 132.1 (???) <B536F2F1-9DF1-3B6C-1C2C-9075EA219A06> /usr/lib/dyld
0x7fff8011e000 - 0x7fff80122ff7 libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0) <95718673-FEEE-B6ED-B127-BCDBDB60D4E5> /usr/lib/system/libmathCommon.A.dylib
0x7fff828d0000 - 0x7fff82986ff7 libobjc.A.dylib 227.0.0 (compatibility 1.0.0) <03140531-3B2D-1EBA-DA7F-E12CC8F63969> /usr/lib/libobjc.A.dylib
0x7fff82a71000 - 0x7fff82a82ff7 libz.1.dylib 1.2.3 (compatibility 1.0.0) <FB5EE53A-0534-0FFA-B2ED-486609433717> /usr/lib/libz.1.dylib
0x7fff86544000 - 0x7fff865c1fef libstdc++.6.dylib 7.9.0 (compatibility 7.0.0) <35ECA411-2C08-FD7D-11B1-1B7A04921A5C> /usr/lib/libstdc++.6.dylib
0x7fff86c2f000 - 0x7fff86df0fef libSystem.B.dylib 125.2.11 (compatibility 1.0.0) <9AB4F1D1-89DC-0E8A-DC8E-A4FE4D69DB69> /usr/lib/libSystem.B.dylib
0x7fff87633000 - 0x7fff877f1fff libicucore.A.dylib 40.0.0 (compatibility 1.0.0) <97A75BFB-0DB6-6F44-36B0-97B7F7208ABB> /usr/lib/libicucore.A.dylib
0x7fff87c03000 - 0x7fff87d7afe7 com.apple.CoreFoundation 6.6.6 (550.44) <BB4E5158-E47A-39D3-2561-96CB49FA82D4> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x7fff89688000 - 0x7fff896c7fef libncurses.5.4.dylib 5.4.0 (compatibility 5.4.0) <E1F34D53-3D62-78C0-CAD8-8AD22C110A9E> /usr/lib/libncurses.5.4.dylib
0x7fff8a78b000 - 0x7fff8a7d7fff libauto.dylib ??? (???) <F7221B46-DC4F-3153-CE61-7F52C8C293CF> /usr/lib/libauto.dylib
0x7fffffe00000 - 0x7fffffe01fff libSystem.B.dylib ??? (???) <9AB4F1D1-89DC-0E8A-DC8E-A4FE4D69DB69> /usr/lib/libSystem.B.dylib
Not sure if it's relevant or not, but the C code doesn't compile cleanly on installation as I see a lot of warnings like "Levenshtein.c:694: warning: pointer targets in assignment differ in signedness".
Indeed, the seqratio should not accept bare strings.
It turns out there was always a critical bug since the beginning of Git history, that I now fixed.
Namely, the code correctly used PySequence_Fast
to create a new list from original sequence, but then reverted using the original instead of the returned object. This worked for the basic uses of the method, where the 2 arguments would have been lists or tuples; as in those case PySequence_Fast
would have returned an incremented reference to the original object.
Hello, i'm forwarding Debian bug #597609: