<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I've got my _Sword.so module to compile and I statically linked libsword.a and libclucene.a into it. So far, I'm able to create the objects fine, but when I try to get my modules, Python crashes with the following trace:<div><br class="webkit-block-placeholder"></div><div><div><font class="Apple-style-span" face="Courier">Process: Python [3639]</font></div><div><font class="Apple-style-span" face="Courier">Path: /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python</font></div><div><font class="Apple-style-span" face="Courier">Identifier: Python</font></div><div><font class="Apple-style-span" face="Courier">Version: ??? (???)</font></div><div><font class="Apple-style-span" face="Courier">Code Type: X86 (Native)</font></div><div><font class="Apple-style-span" face="Courier">Parent Process: bash [3571]</font></div><div><font class="Apple-style-span" face="Courier"><br class="webkit-block-placeholder"></font></div><div><font class="Apple-style-span" face="Courier">Date/Time: 2007-12-19 09:17:11.661 -0600</font></div><div><font class="Apple-style-span" face="Courier">OS Version: Mac OS X 10.5.1 (9B18)</font></div><div><font class="Apple-style-span" face="Courier">Report Version: 6</font></div><div><font class="Apple-style-span" face="Courier"><br class="webkit-block-placeholder"></font></div><div><font class="Apple-style-span" face="Courier">Exception Type: EXC_BAD_ACCESS (SIGBUS)</font></div><div><font class="Apple-style-span" face="Courier">Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000</font></div><div><font class="Apple-style-span" face="Courier">Crashed Thread: 0</font></div><div><font class="Apple-style-span" face="Courier"><br class="webkit-block-placeholder"></font></div><div><font class="Apple-style-span" face="Courier">Thread 0 Crashed:</font></div><div><font class="Apple-style-span" face="Courier">0 libSystem.B.dylib </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0xffff07d4 __memcpy + 52</font></div><div><font class="Apple-style-span" face="Courier">1 _Sword.so </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x004a71da <a href="sword::SWBuf::SWBuf(sword::SWBuf">sword::SWBuf::SWBuf(sword::SWBuf</a> const&, unsigned long) + 170</font></div><div><font class="Apple-style-span" face="Courier">2 _Sword.so </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x0048fc27 swig::traits_from<<a href="sword::SWBuf">sword::SWBuf</a>>::from(<a href="sword::SWBuf">sword::SWBuf</a> const&) + 49 (Sword.cxx:3485)</font></div><div><font class="Apple-style-span" face="Courier">3 _Sword.so </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x0048ffc1 swig::traits_from<std::pair<<a href="sword::SWBuf">sword::SWBuf</a> const, <a href="sword::SWModule*">sword::SWModule*</a>> >::from(std::pair<<a href="sword::SWBuf">sword::SWBuf</a> const, <a href="sword::SWModule*">sword::SWModule*</a>> const&) + 33 (Sword.cxx:4393)</font></div><div><font class="Apple-style-span" face="Courier">4 _Sword.so </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x004882c7 swig::PySwigIterator::next() + 23 (Sword.cxx:2726)</font></div><div><font class="Apple-style-span" face="Courier">5 _Sword.so </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x00415c33 _wrap_PySwigIterator_next + 297 (Sword.cxx:5700)</font></div><div><font class="Apple-style-span" face="Courier">6 org.python.python </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x0011fd5d PyObject_Call + 50</font></div><div><font class="Apple-style-span" face="Courier">7 org.python.python </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x0018dfd8 PyEval_EvalFrameEx + 19086</font></div><div><font class="Apple-style-span" face="Courier">8 org.python.python </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x0018f47b PyEval_EvalCodeEx + 1638</font></div><div><font class="Apple-style-span" face="Courier">9 org.python.python </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x0018daa5 PyEval_EvalFrameEx + 17755</font></div><div><font class="Apple-style-span" face="Courier">10 org.python.python </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x0018f47b PyEval_EvalCodeEx + 1638</font></div><div><font class="Apple-style-span" face="Courier">11 org.python.python </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x0018f568 PyEval_EvalCode + 87</font></div><div><font class="Apple-style-span" face="Courier">12 org.python.python </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x001a6a0c PyErr_Display + 1896</font></div><div><font class="Apple-style-span" face="Courier">13 org.python.python </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x001a867b PyRun_InteractiveOneFlags + 523</font></div><div><font class="Apple-style-span" face="Courier">14 org.python.python </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x001a87c9 PyRun_InteractiveLoopFlags + 216</font></div><div><font class="Apple-style-span" face="Courier">15 org.python.python </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x001a8bfb PyRun_AnyFileExFlags + 85</font></div><div><font class="Apple-style-span" face="Courier">16 org.python.python </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x001b3c23 Py_Main + 3095</font></div><div><font class="Apple-style-span" face="Courier">17 org.python.pythonapp </font><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span><font class="Apple-style-span" face="Courier">0x00001fca 0x1000 + 4042</font></div><div><font class="Apple-style-span" face="Courier"><br class="webkit-block-placeholder"></font></div><div><font class="Apple-style-span" face="Courier">Thread 0 crashed with X86 Thread State (32-bit):</font></div><div><font class="Apple-style-span" face="Courier"> eax: 0xffff07a0 ebx: 0x004a713b ecx: 0x00000000 edx: 0x00000002</font></div><div><font class="Apple-style-span" face="Courier"> edi: 0x0032d860 esi: 0x00000000 ebp: 0xbfffeca8 esp: 0xbfffeca0</font></div><div><font class="Apple-style-span" face="Courier"> ss: 0x0000001f efl: 0x00010202 eip: 0xffff07d4 cs: 0x00000017</font></div><div><font class="Apple-style-span" face="Courier"> ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037</font></div><div><font class="Apple-style-span" face="Courier"> cr2: 0x00000000</font></div><div><font class="Apple-style-span" face="Courier"><br class="webkit-block-placeholder"></font></div><div><font class="Apple-style-span" face="Courier">Binary Images:</font></div><div><font class="Apple-style-span" face="Courier"> 0x1000 - 0x1ffe org.python.pythonapp 2.5.0 (2.5.0a0) <fccdb19d43071ba163b93b4fddd2a7d0> /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python</font></div><div><font class="Apple-style-span" face="Courier"> 0x49000 - 0x4afff readline.so ??? (???) <64946ffe456c7bf202eb236c1afaa0c4> /System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload/readline.so</font></div><div><font class="Apple-style-span" face="Courier"> 0x118000 - 0x1e3ffb org.python.python 2.5 (2.5) <ce7182a9e975861a321dfeeca76f54db> /System/Library/Frameworks/Python.framework/Versions/2.5/Python</font></div><div><font class="Apple-style-span" face="Courier"> 0x2b0000 - 0x2c6fea libedit.2.dylib ??? (???) <be5a6f391887bb96bdeeafd443cf19fb> /usr/lib/libedit.2.dylib</font></div><div><font class="Apple-style-span" face="Courier"> 0x400000 - 0x613fe7 +_Sword.so ??? (???) <cb87ac42234856be59203679fcefd578> /Users/jbrisbin/scratch/_Sword.so</font></div><div><font class="Apple-style-span" face="Courier">0x8fe00000 - 0x8fe2d883 dyld 95.3 (???) <3896c718b33f3e065e199a659baf1a2b> /usr/lib/dyld</font></div><div><font class="Apple-style-span" face="Courier">0x90780000 - 0x907ddffb libstdc++.6.dylib ??? (???) <04b812dcec670daa8b7d2852ab14be60> /usr/lib/libstdc++.6.dylib</font></div><div><font class="Apple-style-span" face="Courier">0x90b58000 - 0x90b5ffe9 libgcc_s.1.dylib ??? (???) <a9ab135a5f81f6e345527df87f51bfc9> /usr/lib/libgcc_s.1.dylib</font></div><div><font class="Apple-style-span" face="Courier">0x91da1000 - 0x91dafffd libz.1.dylib ??? (???) <5ddd8539ae2ebfd8e7cc1c57525385c7> /usr/lib/libz.1.dylib</font></div><div><font class="Apple-style-span" face="Courier">0x92592000 - 0x92593fef libmathCommon.A.dylib ??? (???) /usr/lib/system/libmathCommon.A.dylib</font></div><div><font class="Apple-style-span" face="Courier">0x9431d000 - 0x9434cff7 libncurses.5.4.dylib ??? (???) <3b2ac2ca8190942b6b81d2a7012ea859> /usr/lib/libncurses.5.4.dylib</font></div><div><font class="Apple-style-span" face="Courier">0x963ba000 - 0x96514fe3 libSystem.B.dylib ??? (???) <08d9ec2f36455fc197b9b44adf62f304> /usr/lib/libSystem.B.dylib</font></div><div><font class="Apple-style-span" face="Courier">0xffff0000 - 0xffff1780 libSystem.B.dylib ??? (???) /usr/lib/libSystem.B.dylib</font></div><div><br class="webkit-block-placeholder"></div><div>I'm just playing around, reading the example C++ files and trying to translate that into python. Here's what I did to cause the error:</div><div><br class="webkit-block-placeholder"></div><div><div><font class="Apple-style-span" face="Courier">+-( ~/scratch ):> python</font></div><div><font class="Apple-style-span" face="Courier">Python 2.5.1 (r251:54863, Oct 9 2007, 20:39:46) </font></div><div><font class="Apple-style-span" face="Courier">[GCC 4.0.1 (Apple Inc. build 5465)] on darwin</font></div><div><font class="Apple-style-span" face="Courier">Type "help", "copyright", "credits" or "license" for more information.</font></div><div><font class="Apple-style-span" face="Courier">>>> from Sword import *</font></div><div><font class="Apple-style-span" face="Courier">>>> mf = MarkupFilterMgr(FMT_WEBIF)</font></div><div><font class="Apple-style-span" face="Courier">>>> mgr = SWMgr(mf)</font></div><div><font class="Apple-style-span" face="Courier">>>> mods = mgr.getModules()</font></div><div><font class="Apple-style-span" face="Courier">>>> mods</font></div><div><font class="Apple-style-span" face="Courier"><Sword.ModuleMap; proxy of <Swig Object of type 'std::map<<a href="sword::SWBuf,sword::SWModule">sword::SWBuf,sword::SWModule</a> *,std::less<<a href="sword::SWBuf">sword::SWBuf</a> >,std::allocator<std::pair<<a href="sword::SWBuf">sword::SWBuf</a> const,<a href="sword::SWModule">sword::SWModule</a> * > > > *' at 0x3282e8> ></font></div><div><font class="Apple-style-span" face="Courier">>>> mod = mods.begin()</font></div><div><font class="Apple-style-span" face="Courier">>>> mod</font></div><div><font class="Apple-style-span" face="Courier"><Sword.PySwigIterator; proxy of <Swig Object of type 'swig::PySwigIterator *' at 0x315db0> ></font></div><div><font class="Apple-style-span" face="Courier">>>> mod.next()</font></div><div><font class="Apple-style-span" face="Courier">Bus error</font></div><div><br class="webkit-block-placeholder"></div><div>Same thing happens with I try and read anything from the iterator. It just crashes python.</div><div><br class="webkit-block-placeholder"></div><div>Any ideas?</div></div><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div><br class="Apple-interchange-newline">Thanks!</div><div><br></div><div>Jon Brisbin</div><div><a href="http://jbrisbin.com">http://jbrisbin.com</a></div><div><br></div></span><br class="Apple-interchange-newline"> </div><br></div></body></html>