[Matrix-SIG] minor NumPy + (Mac)Freeze problem & weird crash

Just van Rossum just@letterror.com
Sat, 24 Apr 1999 12:14:11 +0200


Folks,

On the Mac, I compile the NumPy C extensions as separate DLLs (I think this
is standard procedure, right?). It turns out I get a weird crash (when
importing Numeric) in _PyImport_LoadDynamicModule() if the _numpy DLL is
not available. Now, this could be caused by the Mac-specific code in
_PyImport_LoadDynamicModule(), but I'm not sure: I can't really tell what's
going on -- debugging shared libs has never been my strength ;-).

I found this out when trying to freeze a NumPy testscript on the Mac.
MacPython now has the option of creating a standalone binary without
compiler. This works because on the Mac you can merge multiple "code
fragments" (DLL's) into one file. Now, because _numpy is not imported by
any Python code, only by C code, (Mac)Freeze fails to see that the _numpy
module is being used, so it doesn't get included in the standalone app.
Kaboom!

Anyway, I don't care much about that crash, since it's easy to avoid. For
instance by adding these two lines to Numeric.py:

# make sure freeze knows _numpy is needed (it's only used by C code!)
import _numpy


Paul, would you consider adding them?

Thanks,

Just