[Numpy-discussion] bus error in embedded numpy

Robin robince at gmail.com
Fri Nov 13 13:24:34 EST 2009

On Fri, Nov 13, 2009 at 6:13 PM, Robert Kern <robert.kern at gmail.com> wrote:
> On Fri, Nov 13, 2009 at 12:05, Travis Oliphant <oliphant at enthought.com> wrote:
>> I wonder if this is related to the fact that you can't "unload" a
>> dynamically linked module (like NumPy has).   So, when you call
>> Py_Finalize you are not really "finalizing" your usage of Python
>> extension modules.
>> I'm not sure though.
> Right. We do some global things when numpy is imported. Since there is
> no unload step for extension modules, we can't undo them. The second
> time the interpreter starts up, it doesn't know that numpy has already
> been loaded and that numpy shouldn't try to do those global things
> again.

Thanks for the quick responses...

I'm sure you're right - in fact it looks like there was a similar issue here:

I had assumed when matlab unloads the mex function it would also
unload python - but it looks like other dynamic libs pulled in from
the mex function (in this case python and in turn numpy) aren't

I wonder if it would be possible to link python statically to my mex
function, so it really is unloaded when the mex function is... but I'm
getting a bit out of my depth with linker options, and I guess numpy
is always loaded dynamically anyway and will stick around.

Easy enough to work around it anyway - but just wanted to check what
was going on.



More information about the NumPy-Discussion mailing list