[Numpy-discussion] Floating point exception with numpy and embedded python interpreter

Arkaitz Bitorika arkaitz.bitorika at gmail.com
Wed Apr 19 10:30:03 CDT 2006


Hi,

I'm embedding Python in a big C++ program (the NS network simulator) and I
have problems when importing the numpy module, I get a Floating Point
exception. The C code that causes the exception is:

    Py_Initialize();
    PyObject* module = PyImport_ImportModule("numpy");
    Py_DECREF(module);


I'm running Ubuntu Breezy on a dual processor Dell machine, with the stock
python and numpy 0.9.6. One strange thing is that I haven't been able to
reproduce the crash by writing a minimal C program with the code above, it
only crashes when added to my program. I've been embedding Python for ages
on the same program and other modules work fine, only numpy fails.

I've debugged the issue a bit and I've seen that the exception is thrown
when the numpy __init__.py tries to import the core module. The GDB
backtrace is pasted at the end.
Any idea what may be going wrong?

Thanks,
Arkaitz



0xb7900fd2 in initumath () at build/src/numpy/core/src/umathmodule.c:10321
10321           pinf *= mul;
(gdb) bt
#0  0xb7900fd2 in initumath () at
build/src/numpy/core/src/umathmodule.c:10321
#1  0xb7e4e310 in _PyImport_LoadDynamicModule () from
/usr/lib/libpython2.4.so.1.0
#2  0xb7e4c450 in _PyImport_FindModule () from /usr/lib/libpython2.4.so.1.0
#3  0xb7e4cc01 in PyImport_ReloadModule () from /usr/lib/libpython2.4.so.1.0
#4  0xb7e4ce26 in PyImport_ReloadModule () from /usr/lib/libpython2.4.so.1.0
#5  0xb7e4d2c6 in PyImport_ImportModuleEx () from
/usr/lib/libpython2.4.so.1.0
#6  0xb7e22d9e in _PyUnicodeUCS4_ToLowercase () from
/usr/lib/libpython2.4.so.1.0
#7  0xb7df5923 in PyCFunction_Call () from /usr/lib/libpython2.4.so.1.0
#8  0xb7dc8fdf in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
#9  0xb7e2a92c in PyEval_CallObjectWithKeywords () from
/usr/lib/libpython2.4.so.1.0
#10 0xb7e2e8f9 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0
#11 0xb7e31a2d in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0
#12 0xb7e31b76 in PyEval_EvalCode () from /usr/lib/libpython2.4.so.1.0
#13 0xb7e4a525 in PyImport_ExecCodeModuleEx () from
/usr/lib/libpython2.4.so.1.0
#14 0xb7e4a8e9 in PyImport_ExecCodeModule () from
/usr/lib/libpython2.4.so.1.0
#15 0xb7e4c73e in _PyImport_FindModule () from /usr/lib/libpython2.4.so.1.0
#16 0xb7e4cc01 in PyImport_ReloadModule () from /usr/lib/libpython2.4.so.1.0
#17 0xb7e4ce26 in PyImport_ReloadModule () from /usr/lib/libpython2.4.so.1.0
#18 0xb7e4d2c6 in PyImport_ImportModuleEx () from
/usr/lib/libpython2.4.so.1.0
#19 0xb7e22d9e in _PyUnicodeUCS4_ToLowercase () from
/usr/lib/libpython2.4.so.1.0
#20 0xb7df5923 in PyCFunction_Call () from /usr/lib/libpython2.4.so.1.0
#21 0xb7dc8fdf in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
#22 0xb7e2a92c in PyEval_CallObjectWithKeywords () from
/usr/lib/libpython2.4.so.1.0
#23 0xb7e2e8f9 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0
#24 0xb7e31a2d in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0
#25 0xb7e31b76 in PyEval_EvalCode () from /usr/lib/libpython2.4.so.1.0
#26 0xb7e5667f in PyRun_String () from /usr/lib/libpython2.4.so.1.0
#27 0xb7e2fce6 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0
#28 0xb7e31a2d in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0
#29 0xb7e3011a in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0
#30 0xb7e31a2d in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0
#31 0xb7de31b6 in PyFunction_SetClosure () from /usr/lib/libpython2.4.so.1.0
#32 0xb7dc8fdf in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
#33 0xb7dd079b in PyMethod_New () from /usr/lib/libpython2.4.so.1.0
#34 0xb7dc8fdf in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
#35 0xb7dcfd7b in PyInstance_NewRaw () from /usr/lib/libpython2.4.so.1.0
#36 0xb7dc8fdf in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
#37 0xb7e2f5d2 in PyEval_EvalFrame () from /usr/lib/libpython2.4.so.1.0
#38 0xb7e31a2d in PyEval_EvalCodeEx () from /usr/lib/libpython2.4.so.1.0
#39 0xb7e31b76 in PyEval_EvalCode () from /usr/lib/libpython2.4.so.1.0
#40 0xb7e4a525 in PyImport_ExecCodeModuleEx () from
/usr/lib/libpython2.4.so.1.0
#41 0xb7e4a8e9 in PyImport_ExecCodeModule () from
/usr/lib/libpython2.4.so.1.0
#42 0xb7e4c73e in _PyImport_FindModule () from /usr/lib/libpython2.4.so.1.0
#43 0xb7e4cc01 in PyImport_ReloadModule () from /usr/lib/libpython2.4.so.1.0
#44 0xb7e4ce26 in PyImport_ReloadModule () from /usr/lib/libpython2.4.so.1.0
#45 0xb7e4d2c6 in PyImport_ImportModuleEx () from
/usr/lib/libpython2.4.so.1.0
#46 0xb7e22d9e in _PyUnicodeUCS4_ToLowercase () from
/usr/lib/libpython2.4.so.1.0
#47 0xb7df5923 in PyCFunction_Call () from /usr/lib/libpython2.4.so.1.0
#48 0xb7dc8fdf in PyObject_Call () from /usr/lib/libpython2.4.so.1.0
#49 0xb7dcc6c0 in PyObject_CallFunction () from /usr/lib/libpython2.4.so.1.0
#50 0xb7e4d745 in PyImport_Import () from /usr/lib/libpython2.4.so.1.0
#51 0xb7e4d918 in PyImport_ImportModule () from /usr/lib/libpython2.4.so.1.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060419/5672932c/attachment.html 


More information about the Numpy-discussion mailing list