[Numpy-discussion] core dump during import

Skip Montanaro skip at pobox.com
Tue Aug 17 15:57:41 EDT 2004

(I posted this last week to scipy-user but received no responses.  Since it
seems to involve Numeric I thought I'd try here.)


I'm the "python guy" at work which by default makes me the "scipy
installation guy" as well, though I'm not using it for any of my own
projects.  Awhile ago I performed a very basic installation:

    install latest f2py
    install Numeric 23.1
    install SciPy_complete-0.3

The platform is Solaris 9 on Intel.  I'm using Python 2.3.4 (though
originally installed using 2.3.3).  GCC and G77 are both at 3.3.2.

The installation goes fine with the one caveat that I needed to point
LD_RUN_PATH at the g77 lib dir so libg2c.so.0 could be found at runtime.

If I execute

    from scipy.stats import distribution

at the interpreter prompt I get a segfault.  Here's the beginning of the gdb

    #0  0x20ec8356 in ?? ()
    #1  0xdd2d7e24 in Cephes_InitOperators (dictionary=0x8486dfc)
        at Lib/special/cephesmodule.c:413
    #2  0xdd2d7a7a in initcephes () at Lib/special/cephesmodule.c:1105
    #3  0x080d082e in _PyImport_LoadDynamicModule (
        name=0x8040500 "scipy.special.cephes", 
        pathname=0x8040070 "/opt/lang/python/lib/python2.3/site-packages/scipy/special/cephes.so", fp=0x8148780) at ../Python/importdl.c:53
    #4  0x080cd637 in load_module (name=0x8040500 "scipy.special.cephes", 
        buf=0x8040070 "/opt/lang/python/lib/python2.3/site-packages/scipy/special/cephes.so", type=3, loader=0x0) at ../Python/import.c:1708
    #5  0x080ce345 in import_submodule (mod=0x8149fa4, subname=0x804050e "cephes", 
        fullname=0x8040500 "scipy.special.cephes") at ../Python/import.c:2291
    #6  0x080cdea4 in load_next (mod=0x8149fa4, altmod=0x81265e0, 
        p_name=0x8040930, buf=0x8040500 "scipy.special.cephes", p_buflen=0x80404fc)
        at ../Python/import.c:2111
    #7  0x080cfbf1 in import_module_ex (name=0x0, globals=0x8486c64, 
        locals=0x8486c64, fromlist=0x83e256c) at ../Python/import.c:1957
    #8  0x080ced40 in PyImport_ImportModuleEx (name=0x8369c34 "cephes", 
        globals=0x8486c64, locals=0x8486c64, fromlist=0x83e256c)
        at ../Python/import.c:1998
    #9  0x080a1bde in builtin___import__ (self=0x0, args=0x8483d4c)
        at ../Python/bltinmodule.c:45
    #10 0x080fac78 in PyCFunction_Call (func=0x8151bec, arg=0x8483d4c, kw=0x0)
        at ../Objects/methodobject.c:108
    #11 0x08062e90 in PyObject_Call (func=0x8151bec, arg=0x8483d4c, kw=0x0)
        at ../Objects/abstract.c:1755

Since I don't use SciPy, Cephes or f2py outside of installing SciPy I don't
really know where to start poking.  Frame 1 is at this line:

    413    f = PyUFunc_FromFuncAndData(cephes3a_functions, bdtr_data, cephes_4_types, 2, 3, 1, PyUFunc_None, "bdtr", bdtr_doc, 0);

and cephes3a_functions looks suspicious:

    (gdb) p cephes3a_functions
    $2 = {0x5, 0x6}

I presume considering the variable name those are supposed to be valid
function pointers.  Stepping through initcephes leads me to this:

    (gdb) n
    393         cephes3a_functions[0] = PyUFunc_fff_f_As_iid_d;
    (gdb) n
    391         cephes3_functions[2] = PyUFunc_ffF_F_As_ddD_D;
    (gdb) n
    392         cephes3_functions[3] = PyUFunc_ddD_D;
    (gdb) n
    394         cephes3a_functions[1] = PyUFunc_ddd_d_As_iid_d;
    (gdb) n
    395         cephes3_2_functions[0] = PyUFunc_fff_ff_As_ddd_dd;
    (gdb) p cephes3a_functions
    $9 = {0x5, 0x6}
    (gdb) p PyUFunc_ddD_D
    $10 = {void (char **, int *, int *, void *)} 0xdd2e4720 <PyUFunc_ddD_D>
    (gdb) p PyUFunc_ddd_d_As_iid_d
    $11 = {void (char **, int *, int *, 
        void *)} 0xdd2e4a20 <PyUFunc_ddd_d_As_iid_d>

It seems there's something amiss with the cephes3a_functions initialization.
In fact, other cephes*_functions variables appear bogus as well:

    (gdb) p cephes3_functions
    $12 = {0, 0, 0x3, 0x4}
    (gdb) p cephes1_functions
    $13 = {0x464c457f, 0x10101}
    (gdb) p cephes2_4_functions
    $14 = {0x7e34, 0x7}

Does this ring a bell with anybody?  Any clues about how to proceed would be


Skip Montanaro
Got spam? http://www.spambayes.org/
skip at pobox.com

More information about the NumPy-Discussion mailing list