[Numpy-discussion] Recovering from a STOP ?

Pierre GM pgmdevlist@gmail....
Tue Mar 20 05:20:05 CDT 2012

Pauli, Chris,
Thanks for your inputs.

Pauli, I think that when f2py encounters a STOP statement, it just
stops the execution of the process. Alas, it's the same process as the
interpreter... So we need a trick not to interrupt the whole process.

I eventually resorted to patching f2py as suggested in
which amounts to let f2py trap the SIGINT. That's good enough for what I need.

However, that stresses the need to have a more robust way to deal with
these interruptions and make sure that several objects calling one (or
several temporary) fortran extension don't interact the ones with the

And I'm coming to the same conclusion as Chris', that I have to use
the `multiprocessing` module, with several processes calling their own
fortran extension. But that's another story.

Thanks y'all for your help

On 3/14/12, Chris Barker <chris.barker@noaa.gov> wrote:
> On Wed, Mar 14, 2012 at 9:25 AM, Pauli Virtanen <pav@iki.fi> wrote:
>> Or, maybe the whole Fortran stuff can be run in a separate process, so
>> that crashing doesn't matter.
> That's what I was going to suggest -- even if you can get it not to
> crash, it may well be in a bad state -- memory leaks, and who know
> what else.
> We did something similar with some C code that called the system
> exit() function when it encountered errors -- it may not have been too
> hard to replace those calls, but making sure the memory was all
> cleaned up was going to be a trick -- so we just used the multiprocess
> module to call it in another process.
> HTH,
> -Chris
> --
> Christopher Barker, Ph.D.
> Oceanographer
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
> Chris.Barker@noaa.gov
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list