[sword-devel] Python bindings cause python crash

Jon Brisbin jon at jbrisbin.com
Wed Dec 19 08:25:04 MST 2007


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:

Process:         Python [3639]
Path:            /System/Library/Frameworks/Python.framework/Versions/ 
2.5/Resources/Python.app/Contents/MacOS/Python
Identifier:      Python
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  bash [3571]

Date/Time:       2007-12-19 09:17:11.661 -0600
OS Version:      Mac OS X 10.5.1 (9B18)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread:  0

Thread 0 Crashed:
0   libSystem.B.dylib             	0xffff07d4 __memcpy + 52
1   _Sword.so                     	0x004a71da sword::SWBuf::SWBuf(sword::SWBuf 
  const&, unsigned long) + 170
2   _Sword.so                     	0x0048fc27 swig::traits_from<sword::SWBuf 
 >::from(sword::SWBuf const&) + 49 (Sword.cxx:3485)
3   _Sword.so                     	0x0048ffc1  
swig::traits_from<std::pair<sword::SWBuf const, sword::SWModule*>  
 >::from(std::pair<sword::SWBuf const, sword::SWModule*> const&) + 33  
(Sword.cxx:4393)
4   _Sword.so                     	0x004882c7  
swig::PySwigIterator::next() + 23 (Sword.cxx:2726)
5   _Sword.so                     	0x00415c33  
_wrap_PySwigIterator_next + 297 (Sword.cxx:5700)
6   org.python.python             	0x0011fd5d PyObject_Call + 50
7   org.python.python             	0x0018dfd8 PyEval_EvalFrameEx + 19086
8   org.python.python             	0x0018f47b PyEval_EvalCodeEx + 1638
9   org.python.python             	0x0018daa5 PyEval_EvalFrameEx + 17755
10  org.python.python             	0x0018f47b PyEval_EvalCodeEx + 1638
11  org.python.python             	0x0018f568 PyEval_EvalCode + 87
12  org.python.python             	0x001a6a0c PyErr_Display + 1896
13  org.python.python             	0x001a867b  
PyRun_InteractiveOneFlags + 523
14  org.python.python             	0x001a87c9  
PyRun_InteractiveLoopFlags + 216
15  org.python.python             	0x001a8bfb PyRun_AnyFileExFlags + 85
16  org.python.python             	0x001b3c23 Py_Main + 3095
17  org.python.pythonapp          	0x00001fca 0x1000 + 4042

Thread 0 crashed with X86 Thread State (32-bit):
   eax: 0xffff07a0  ebx: 0x004a713b  ecx: 0x00000000  edx: 0x00000002
   edi: 0x0032d860  esi: 0x00000000  ebp: 0xbfffeca8  esp: 0xbfffeca0
    ss: 0x0000001f  efl: 0x00010202  eip: 0xffff07d4   cs: 0x00000017
    ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
   cr2: 0x00000000

Binary Images:
     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
    0x49000 -    0x4afff  readline.so ??? (???)  
<64946ffe456c7bf202eb236c1afaa0c4> /System/Library/Frameworks/ 
Python.framework/Versions/2.5/lib/python2.5/lib-dynload/readline.so
   0x118000 -   0x1e3ffb  org.python.python 2.5 (2.5)  
<ce7182a9e975861a321dfeeca76f54db> /System/Library/Frameworks/ 
Python.framework/Versions/2.5/Python
   0x2b0000 -   0x2c6fea  libedit.2.dylib ??? (???)  
<be5a6f391887bb96bdeeafd443cf19fb> /usr/lib/libedit.2.dylib
   0x400000 -   0x613fe7 +_Sword.so ??? (???)  
<cb87ac42234856be59203679fcefd578> /Users/jbrisbin/scratch/_Sword.so
0x8fe00000 - 0x8fe2d883  dyld 95.3 (???)  
<3896c718b33f3e065e199a659baf1a2b> /usr/lib/dyld
0x90780000 - 0x907ddffb  libstdc++.6.dylib ??? (???)  
<04b812dcec670daa8b7d2852ab14be60> /usr/lib/libstdc++.6.dylib
0x90b58000 - 0x90b5ffe9  libgcc_s.1.dylib ??? (???)  
<a9ab135a5f81f6e345527df87f51bfc9> /usr/lib/libgcc_s.1.dylib
0x91da1000 - 0x91dafffd  libz.1.dylib ??? (???)  
<5ddd8539ae2ebfd8e7cc1c57525385c7> /usr/lib/libz.1.dylib
0x92592000 - 0x92593fef  libmathCommon.A.dylib ??? (???) /usr/lib/ 
system/libmathCommon.A.dylib
0x9431d000 - 0x9434cff7  libncurses.5.4.dylib ??? (???)  
<3b2ac2ca8190942b6b81d2a7012ea859> /usr/lib/libncurses.5.4.dylib
0x963ba000 - 0x96514fe3  libSystem.B.dylib ??? (???)  
<08d9ec2f36455fc197b9b44adf62f304> /usr/lib/libSystem.B.dylib
0xffff0000 - 0xffff1780  libSystem.B.dylib ??? (???) /usr/lib/ 
libSystem.B.dylib

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:

+-( ~/scratch ):> python
Python 2.5.1 (r251:54863, Oct  9 2007, 20:39:46)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> from Sword import *
 >>> mf = MarkupFilterMgr(FMT_WEBIF)
 >>> mgr = SWMgr(mf)
 >>> mods = mgr.getModules()
 >>> mods
<Sword.ModuleMap; proxy of <Swig Object of type 'std::map<sword::SWBuf,sword::SWModule 
  *,std::less<sword::SWBuf >,std::allocator<std::pair<sword::SWBuf  
const,sword::SWModule * > > > *' at 0x3282e8> >
 >>> mod = mods.begin()
 >>> mod
<Sword.PySwigIterator; proxy of <Swig Object of type  
'swig::PySwigIterator *' at 0x315db0> >
 >>> mod.next()
Bus error

Same thing happens with I try and read anything from the iterator. It  
just crashes python.

Any ideas?

Thanks!

Jon Brisbin
http://jbrisbin.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.crosswire.org/pipermail/sword-devel/attachments/20071219/4772f756/attachment.html 


More information about the sword-devel mailing list