[Numpy-discussion] Re: ANN: numarray-1.2.3 -- segfault in in my C program

Sebastian Haase haase at msg.ucsf.edu
Thu Mar 3 11:41:32 EST 2005

After upgrading from numarray 1.1  (now 1.2.3)
We get a Segmentation fault in our C++ program on Linux (python2.2,gcc2.95) , 
gdb says this: 

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1087498336 (LWP 8279)]
0x406d68d5 in PyObject_GetAttrString () from /usr/lib/libpython2.2.so.0.0
(gdb) where
#0  0x406d68d5 in PyObject_GetAttrString () from /usr/lib/libpython2.2.so.0.0
#1  0x410f905e in deferred_libnumarray_init () at Src/libnumarraymodule.c:149
#2  0x410f98a8 in NA_NewAllFromBuffer (ndim=3, shape=0xbffff2e4, 
type=tFloat32, bufferObject=0x8a03988, byteoffset=0,
<nl>    bytestride=0, byteorder=0, aligned=1, writeable=1) at Src/
#3  0x0805b159 in MyApp::OnInit (this=0x8108f50) at omx_app.cpp:519
#4  0x4026f616 in wxEntry () from /jws30/haase/PrLin0/wxGtkLibs/
#5  0x0805a91a in main (argc=1, argv=0xbffff414) at omx_app.cpp:247

To initialize libnumarray I was using this:
//      import_libnumarray();
        PyObject *module = PyImport_ImportModule("numarray.libnumarray");
        if (!module)
              Py_FatalError("Can't import module 'numarray.libnumarray'");
        if (module != NULL) {
          PyObject *module_dict = PyModule_GetDict(module);
          PyObject *c_api_object =
                 PyDict_GetItemString(module_dict, "_C_API");
          if (PyCObject_Check(c_api_object)) {
            libnumarray_API = (void **)PyCObject_AsVoidPtr(c_api_object);
          } else {
            Py_FatalError("Can't get API for module 'numarray.libnumarray'");

Any idea ?

Sebastian Haase

More information about the NumPy-Discussion mailing list