[Numpy-discussion] bus error in embedded numpy

Robin robince@gmail....
Fri Nov 13 11:56:01 CST 2009


>> I'm trying to embed Python in a MATLAB mex file. I've been coming
>> under some pressure to make my Python code available to my MATLAB
>> colleagues so I am trying to come up with a relatively general way of
>> calling numerical python code from Matlab.

I get a similar but different error trying to do the same with scipy -
(importing scipy after a Py_Finalize and matlab function clear) - this
time in umath.so:

------------------------------------------------------------------------
             Bus error detected at Fri Nov 13 17:53:43 2009
------------------------------------------------------------------------

Configuration:
  MATLAB Version:   7.8.0.347 (R2009a)
  MATLAB License:   161051
  Operating System: Darwin 10.0.0 Darwin Kernel Version 10.0.0: Fri
Jul 31 22:47:34 PDT 2009; root:xnu-1456.1.25~1/RELEASE_I386 i386
  Window System:    The X.Org Foundation (10402000), display
/tmp/launch-2p1ZWg/:0
  Current Visual:   0x24 (class 4, depth 24)
  Processor ID:     x86 Family 6 Model 15 Stepping 10, GenuineIntel
  Virtual Machine:  Java 1.6.0_15-b03-219 with Apple Inc. Java
HotSpot(TM) Client VM mixed mode
  Default Encoding:  ISO-8859-1

Fault Count: 1

Register State:
  eax = 33028046  ebx = 327464cb
  ecx = 3382b110  edx = 330180b0
  esi = 304d6ac0  edi = 336e6660
  ebp = b08fa8f8  esp = b08fa8cc
  eip = 23810006  flg = 00010a92

Stack Trace:
  [0] 0x23810006(0x336e6660, 0x3352e415 "remainder", 0x32824d74, 0)
  [1] umath.so:initumath~(0xb08faebb "numpy.core.umath", 0xb08faec6
"umath", 0xb08faa07 "/Library/Frameworks/Python.frame..", 0xa043aab0)
+ 2152 bytes
  [2] Python:_PyImport_LoadDynamicModule~(0xb08faebb
"numpy.core.umath", 0xb08faa07 "/Library/Frameworks/Python.frame..",
0xa043aab0, 0x331ae7d3) + 153 bytes
  [3] Python:load_module~(3, 0, 0xb08fae08 "∞™C†", 0xb08fae0c) + 203 bytes
  [4] Python:import_submodule~(0xb08faec6 "umath", 0x326eecd4 "umath",
5, 0x33148fc9) + 293 bytes
  [5] Python:load_next~(0xb08faebb "numpy.core.umath", 0xb08fb2bc,
0xb08faf68, 0x331a75e6) + 195 bytes
  [6] Python:import_module_level~(0x33200aa0, 0xffffffff, 0xee9e70b3,
0x33189f4d "«E") + 142 bytes
  [7] Python:PyImport_ImportModuleLevel~(0x326eecd4 "umath",
0x336340c0, 0x336340c0, 0x33200aa0) + 45 bytes
  [8] Python:builtin___import__~(0, 0x33845ea0, 0, 0x3318fcfe) + 156 bytes
  [9] Python:PyObject_Call~(0x326ba7b0, 0x33845ea0, 0, 0x3313f3cd) + 45 bytes
  [10] Python:PyEval_CallObjectWithKeywords~(0x326ba7b0, 0x33845ea0,
0, 0x336340c0) + 112 bytes
  [11] Python:PyEval_EvalFrameEx~(0x304d5fd0, 0, 0x336340c0,
0x336340c0) + 8138 bytes
  [12] Python:PyEval_EvalCodeEx~(0x30386e30, 0x336340c0, 0x336340c0,
0) + 1819 bytes
  [13] Python:PyEval_EvalCode~(0x30386e30, 0x336340c0, 0x336340c0,
0x9325378f) + 87 bytes
  [14] Python:PyImport_ExecCodeModuleEx~(0xb08fc4cb "numpy.core",
0x30386e30, 0xb08fb76f "/Library/Frameworks/Python.frame..",
0x4adc73cc) + 193 bytes
  [15] Python:load_source_module~(1, 0, 0xb08fbfbc "X™C†0D80†370", 0)
+ 726 bytes
  [16] Python:load_package~(5, 0, 0xb08fc418, 0xb08fc41c) + 427 bytes
  [17] Python:import_submodule~(0xb08fc4d1 "core", 0x3384512a
"core.numeric", 4, 0x33148fc9) + 293 bytes
  [18] Python:load_next~(0xb08fc4cb "numpy.core", 0xb08fc8cc, 9,
0x331a75e6) + 195 bytes
  [19] Python:import_module_level~(0x33200aa0, 0xffffffff, 0x746e6920,
0x33189f4d "«E") + 213 bytes
  [20] Python:PyImport_ImportModuleLevel~(0x33845124
"numpy.core.numeric", 0x33634ae0, 0x33634ae0, 0x33200aa0) + 45 bytes
  [21] Python:builtin___import__~(0, 0x33845f30, 0, 0x3318fcfe) + 156 bytes
  [22] Python:PyObject_Call~(0x326ba7b0, 0x33845f30, 0, 0x3313f3cd) + 45 bytes
  [23] Python:PyEval_CallObjectWithKeywords~(0x326ba7b0, 0x33845f30,
0, 0x33634ae0) + 112 bytes
  [24] Python:PyEval_EvalFrameEx~(0x304caf70, 0, 0x33634ae0,
0x33634ae0) + 8138 bytes
  [25] Python:PyEval_EvalCodeEx~(0x30386e78, 0x33634ae0, 0x33634ae0,
0) + 1819 bytes
  [26] Python:PyEval_EvalCode~(0x30386e78, 0x33634ae0, 0x33634ae0,
0x9325378f) + 87 bytes
  [27] Python:PyImport_ExecCodeModuleEx~(0xb08fd68b
"numpy.lib.type_check", 0x30386e78, 0xb08fcd7f
"/Library/Frameworks/Python.frame..", 6771) + 193 bytes
  [28] Python:load_source_module~(1, 0, 0xb08fd5d8, 0xb08fd5dc) + 726 bytes
  [29] Python:import_submodule~(0xb08fd695 "type_check", 0x3038a494
"type_check", 10, 0x33148fc9) + 293 bytes
  [30] Python:load_next~(0xb08fd68b "numpy.lib.type_check",
0xb08fda8c, 0xb08fd738, 0x331a75e6) + 195 bytes
  [31] Python:import_module_level~(0x32703e30, 0xffffffff, 0xee9e70b3,
0x33189f4d "«E") + 142 bytes
  [32] Python:PyImport_ImportModuleLevel~(0x3038a494 "type_check",
0x33634150, 0x33634150, 0x32703e30) + 45 bytes
  [33] Python:builtin___import__~(0, 0x33845540, 0, 0x3318fcfe) + 156 bytes
  [34] Python:PyObject_Call~(0x326ba7b0, 0x33845540, 0, 0x3313f3cd) + 45 bytes
  [35] Python:PyEval_CallObjectWithKeywords~(0x326ba7b0, 0x33845540,
0, 0x33634150) + 112 bytes
  [36] Python:PyEval_EvalFrameEx~(0x304b4fd0, 0, 0x33634150,
0x33634150) + 8138 bytes
  [37] Python:PyEval_EvalCodeEx~(0x32727bf0, 0x33634150, 0x33634150,
0) + 1819 bytes
  [38] Python:PyEval_EvalCode~(0x32727bf0, 0x33634150, 0x33634150,
0x9325378f) + 87 bytes
  [39] Python:PyImport_ExecCodeModuleEx~(0xb08fec9b "numpy.lib",
0x32727bf0, 0xb08fdf3f "/Library/Frameworks/Python.frame..",
0x4adc73cd) + 193 bytes
  [40] Python:load_source_module~(1, 0, 0xb08fe78c "®©C†0D80†370", 0)
+ 726 bytes
  [41] Python:load_package~(5, 0, 0xb08febe8, 0xb08febec) + 427 bytes
  [42] Python:import_submodule~(0xb08feca1 "lib", 0x3271b4b4 "lib", 3,
0x33148fc9) + 293 bytes
  [43] Python:load_next~(0xb08fec9b "numpy.lib", 0xb08ff09c, 5,
0x331a75e6) + 195 bytes
  [44] Python:import_module_level~(0x303975f0, 0xffffffff, 0xb08ff128,
0x33189f4d "«E") + 142 bytes
  [45] Python:PyImport_ImportModuleLevel~(0x3271b4b4 "lib",
0x336346f0, 0x336346f0, 0x303975f0) + 45 bytes
  [46] Python:builtin___import__~(0, 0x33845ae0, 0, 0x3318fcfe) + 156 bytes
  [47] Python:PyObject_Call~(0x326ba7b0, 0x33845ae0, 0, 0x3313f3cd) + 45 bytes
  [48] Python:PyEval_CallObjectWithKeywords~(0x326ba7b0, 0x33845ae0,
0, 0x336346f0) + 112 bytes
  [49] Python:PyEval_EvalFrameEx~(0x304b6570, 0, 0x336346f0,
0x336346f0) + 8138 bytes
  [50] Python:PyEval_EvalCodeEx~(0x327274a0, 0x336346f0, 0x336346f0,
0) + 1819 bytes
  [51] Python:PyEval_EvalCode~(0x327274a0, 0x336346f0, 0x336346f0,
0x9325378f) + 87 bytes
  [52] Python:PyImport_ExecCodeModuleEx~(0xb08ffe5b
"numpy.add_newdocs", 0x327274a0, 0xb08ff54f
"/Library/Frameworks/Python.frame..", 0x331491e4) + 193 bytes
  [53] Python:load_source_module~(1, 0, 0xb08ffda8 "P©C†", 0xb08ffdac)
+ 726 bytes
  [54] Python:import_submodule~(0xb08ffe61 "add_newdocs", 0x33629df4
"add_newdocs", 11, 0x33148fc9) + 293 bytes
  [55] Python:load_next~(0xb08ffe5b "numpy.add_newdocs", 0xb090025c,
0xb08fff08, 0x331a75e6) + 195 bytes
  [56] Python:import_module_level~(0x33200aa0, 0xffffffff, 0xe17a9024,
0x33189f4d "«E") + 142 bytes
  [57] Python:PyImport_ImportModuleLevel~(0x33629df4 "add_newdocs",
0x3384e780, 0x3384e780, 0x33200aa0) + 45 bytes
  [58] Python:builtin___import__~(0, 0x33845750, 0, 0x3318fcfe) + 156 bytes
  [59] Python:PyObject_Call~(0x326ba7b0, 0x33845750, 0, 0x3313f3cd) + 45 bytes
  [60] Python:PyEval_CallObjectWithKeywords~(0x326ba7b0, 0x33845750,
0, 0x3384e780) + 112 bytes
  [61] Python:PyEval_EvalFrameEx~(0x304bcad0, 0, 0x3384e780,
0x3384e780) + 8138 bytes
  [62] Python:PyEval_EvalCodeEx~(0x33821848, 0x3384e780, 0x3384e780,
0) + 1819 bytes
  [63] Python:PyEval_EvalCode~(0x33821848, 0x3384e780, 0x3384e780,
0x9325378f) + 87 bytes
  [64] Python:PyImport_ExecCodeModuleEx~(0xb0901471 "numpy",
0x33821848, 0xb090070f "/Library/Frameworks/Python.frame..",
0x4adc73cd) + 193 bytes
  [65] Python:load_source_module~(1, 0, 0xb0900f5c "¯®C† D80 D80", 0)
+ 726 bytes
  [66] Python:load_package~(5, 0, 0xb09013b8, 0xb09013bc) + 427 bytes
  [67] Python:import_submodule~(0xb0901471 "numpy", 0x326b0474
"numpy", 5, 0x33148fc9) + 293 bytes
  [68] Python:load_next~(0xb090146b "scipy.numpy", 0xb090186c,
0xb0901518, 0x331a75e6) + 313 bytes
  [69] Python:import_module_level~(0x30392cd0, 0xffffffff, 0x304bf7e0,
0x33189f4d "«E") + 142 bytes
  [70] Python:PyImport_ImportModuleLevel~(0x326b0474 "numpy",
0x33584a50, 0x33584a50, 0x30392cd0) + 45 bytes
  [71] Python:builtin___import__~(0, 0x3360c510, 0, 0x3318fcfe) + 156 bytes
  [72] Python:PyObject_Call~(0x326ba7b0, 0x3360c510, 0, 0x3313f3cd) + 45 bytes
  [73] Python:PyEval_CallObjectWithKeywords~(0x326ba7b0, 0x3360c510,
0, 0x33584a50) + 112 bytes
  [74] Python:PyEval_EvalFrameEx~(0x304bc7a0, 0, 0x33584a50,
0x33584a50) + 8138 bytes
  [75] Python:PyEval_EvalCodeEx~(0x338213c8, 0x33584a50, 0x33584a50,
0) + 1819 bytes
  [76] Python:PyEval_EvalCode~(0x338213c8, 0x33584a50, 0x33584a50,
0x9325378f) + 87 bytes
  [77] Python:PyImport_ExecCodeModuleEx~(0xb0902a7b "scipy",
0x338213c8, 0xb0901d1f "/Library/Frameworks/Python.frame..",
0x4adc73ef) + 193 bytes
  [78] Python:load_source_module~(1, 0, 0xb090256c, 0) + 726 bytes
  [79] Python:load_package~(5, 0, 0xb09029c8, 0xb09029cc) + 427 bytes
  [80] Python:import_submodule~(0xb0902a7b "scipy", 0x326b00f4
"scipy", 5, 0x3313d553) + 293 bytes
  [81] Python:load_next~(0xb0902a7b "scipy", 0xb0902e7c, 0xb0902b28,
0x331a75e6) + 195 bytes
  [82] Python:import_module_level~(0x33200aa0, 0xffffffff, 0x3049d1e0,
0x33189f4d "«E") + 142 bytes
  [83] Python:PyImport_ImportModuleLevel~(0x326b00f4 "scipy",
0x30376540, 0x30376540, 0x33200aa0) + 45 bytes
  [84] Python:builtin___import__~(0, 0x3360c960, 0, 0x3318fcfe) + 156 bytes
  [85] Python:PyObject_Call~(0x326ba7b0, 0x3360c960, 0, 0x3313f3cd) + 45 bytes
  [86] Python:PyEval_CallObjectWithKeywords~(0x326ba7b0, 0x3360c960,
0, 0x30376540) + 112 bytes
  [87] Python:PyEval_EvalFrameEx~(0x304bdee0, 0, 0x30376540,
0x30376540) + 8138 bytes
  [88] Python:PyEval_EvalCodeEx~(0x33551530, 0x30376540, 0x30376540,
0) + 1819 bytes
  [89] Python:PyEval_EvalCode~(0x33551530, 0x30376540, 0x30376540,
0x304d8ae0) + 87 bytes
  [90] Python:PyRun_StringFlags~(0x304c9910 "import scipy", 257,
0x30376540, 0x30376540) + 243 bytes
  [91] Python:PyRun_SimpleStringFlags~(0x304c9910 "import scipy", 0,
1, 0xb0903b88 "Ë!Z(") + 72 bytes
  [92] libmex.dylib:mexRunMexFile(0, 0xb0903b28, 1, 0xb0903b88 "Ë!Z(")
+ 107 bytes
  [93] libmex.dylib:Mfh_mex::runMexFileWithSignalProtection(int,
mxArray_tag**, int, mxArray_tag**)(0x304b1290, 0, 0xb0903b28, 1) + 111
bytes
  [94] libmex.dylib:Mfh_mex::dispatch_file(int, mxArray_tag**, int,
mxArray_tag**)(0x304b1290, 0, 0xb0903b28, 1) + 250 bytes
  [95] libmwm_dispatcher.dylib:Mfh_file::dispatch_fh(int,
mxArray_tag**, int, mxArray_tag**)(0x304b1290, 0, 0xb0903b28, 1) + 256
bytes
  [96] libmwm_interpreter.dylib:ResolverFunctionDesc::CallFunction(int,
mxArray_tag**, int, mxArray_tag**)(0xb0904118 "‡Gs", 0, 0xb0903b28, 1)
+ 793 bytes
  [97] libmwm_interpreter.dylib:Resolver::CallMFunction(int, int,
_m_operand*, m_operand_storage*, int, _m_operand*, m_operand_storage*,
int*)(0xb0903cf4, 0, 1, 0x304a8f50) + 1446 bytes
  [98] libmwm_interpreter.dylib:inResolveMFunctionCall(_m_function_desc*,
int, int, _m_operand*, m_operand_storage*, int, _m_operand*,
m_operand_storage*, int*, inMarshalType*, int, mpsTypeSequenceNlhs
const*, mxArray_tag* (*)(int))(0x3049d5c0, 0, 1, 0x304a8f50) + 474
bytes
  [99] libmwm_interpreter.dylib:accelImpl::MFunctionCall(_accelOp**)(0xb0904264,
0xb0904278, 0x304d32f0, 0x2fff5b20 "`ÊI0") + 269 bytes
  [100] libmwm_interpreter.dylib:accelImpl::Exec()(0xb0904264,
0x0358a000, 0xb09042a8, 0x3049ca14) + 199 bytes
  [101] libmwm_interpreter.dylib:accelCode::Call(inMarshalType*, int*)
const(0x3049e8c0, 0xb09043d8, 0xb09043d4, 0x009d6e60) + 100 bytes
  [102] libmwm_interpreter.dylib:inJit::ExecuteHotSegment(_inJitAccelInfo*,
opcodes*, int*, int*)(0xb0904458, 0xb0904468, 0xb0904464 "ˇˇˇˇ",
0xb0904460) + 1338 bytes
  [103] libmwm_interpreter.dylib:inExecuteMFunctionOrScript(Mfh_mp*,
bool)(0x3049e660, 1, 0xb090499c, 0) + 704 bytes
  [104] libmwm_interpreter.dylib:inRunMfile(int, mxArray_tag**, int,
mxArray_tag**, Mfh_mp*, inWorkSpace_tag*)(0, 0xb090499c, 0, 0) + 696
bytes
  [105] libmwm_interpreter.dylib:Mfh_mp::dispatch_file(int,
mxArray_tag**, int, mxArray_tag**)(0x3049e660, 0, 0xb090499c, 0) + 56
bytes
  [106] libmwm_dispatcher.dylib:Mfh_file::dispatch_fh(int,
mxArray_tag**, int, mxArray_tag**)(0x3049e660, 0, 0xb090499c, 0) + 256
bytes
  [107] libmwm_interpreter.dylib:inEvalPcodeHeaderToWord(_memory_context*,
int, mxArray_tag**, _pcodeheader*, Mfh_mp*, unsigned int)(0x000a2ac8
"§*\n", 0, 0xb090499c, 0xb090483c) + 252 bytes
  [108] libmwm_interpreter.dylib:inEvalStringWithIsVarFcn(_memory_context*,
char const*, EvalType, int, mxArray_tag**, inDebugCheck,
_pcodeheader*, int*, bool (*)(void*, char const*), void*, bool,
bool)(0, 0xb090499c, 0, 0) + 1835 bytes
  [109] libmwm_interpreter.dylib:inEvalCmdWithLocalReturn(char const*,
int*, bool, bool, bool (*)(void*, char const*))(1, 0x004aeb20, 0, 0) +
148 bytes
  [110] libmwm_interpreter.dylib:inEvalCmdWithLocalReturn(0x05531000
"pytest('import scipy')\n", 0, 0, 1) + 66 bytes
  [111] libmwbridge.dylib:evalCommandWithLongjmpSafety(char
const*)(0x05531000 "pytest('import scipy')\n", 1, 0x3041e7c8, 4073223)
+ 108 bytes
  [112] libmwbridge.dylib:mnParser(0xb0904b34, 0x0384fc00, 1, 0) + 666 bytes
  [113] libmwmcr.dylib:mcrInstance::mnParser_on_interpreter_thread()(0x0384fc00,
8, 0x05035000, 4) + 43 bytes
  [114] libmwmcr.dylib:boost::function0<void>::operator()()
const(0x3041beb4 "ˆA", 0, 0xb0904c68, 171953) + 41 bytes
  [115] libmwmcr.dylib:mcr::runtime::InterpreterThread::Impl::NoResultInvocationRequest::run()(0x3041bea0,
0, 0xb0904be8, 172001) + 21 bytes
  [116] libmwmcr.dylib:mcr::runtime::InterpreterThread::Impl::invocation_request_handler(long)(0x3041bea0,
0, 0xb0904c38, 3636709) + 24 bytes
  [117] libmwuix.dylib:uix_DispatchOrProcess(_XEvent*, _XtAppStruct*,
int, bool)(0, 15, 0x000f4240 "put_target_string_with_length",
0x4afd9d18) + 476 bytes
  [118] libmwuix.dylib:ws_ProcessPendingEventsHelper(int, int,
bool)(1, 0xffffffff, 0, 852585) + 469 bytes
  [119] libmwmcr.dylib:mcr::runtime::InterpreterThread::Impl::process_events(boost::shared_ptr<mcr::runtime::InterpreterThread::Impl>
const&)(0x0363b7a0, 0xb0904e68, 0, 0x036148e0
"/Applications/MATLAB_R2009a.app/..") + 376 bytes
  [120] libmwmcr.dylib:mcr::runtime::InterpreterThread::Impl::run(boost::shared_ptr<mcr::runtime::InterpreterThread::Impl>
const&, mcr::runtime::InterpreterThread::Impl::init_context*)(0x0363b7a0,
0xb0904e68, 0xb0984cac, 4078061) + 410 bytes
  [121] libmwmcr.dylib:run_init_and_handle_events(void*)(0xb0984cac,
0, 0, 0) + 52 bytes
  [122] MATLAB:create_mcrInstance_and_run_mnParser(0xb0904f00 "@†A",
8816, 0, 0) + 553 bytes
  [123] MATLAB:start(2, 0xbffff4d0 "§ıˇøÓıˇø", 0xb0905000 "DRHT",
0xffffffff) + -2223 bytes
  [124] libmwmcr.dylib:runMcrMain(void*)(0xbffff440 "‡%", 0x04000000,
1, 0) + 39 bytes
  [125] libSystem.B.dylib:_pthread_start~(0xb0905000 "DRHT", 13827,
0x004075f0, 0xbffff440 "‡%") + 345 bytes
  [126] libSystem.B.dylib:thread_start~(0, 0, 0, 0x54485244) + 34 bytes


More information about the NumPy-Discussion mailing list