Catching floating point errors from linked C code

John Pye john.pye at gmail.com
Thu Jan 25 00:24:29 EST 2007


Hi John,

On Jan 25, 3:43 pm, John Nagle <n... at animats.com> wrote:
> Python is probably running with floating point exceptions disabled,
> but you can enable them in your C code, and restoring the floating
> point mode when you leave, if you want.  This is probably
> only worth doing under a debugger, because otherwise you just end
> up with an aborted instance of Python.

So as far as you know, Python doesn't switch stuff like
feenableexcept(FE_EXCEPT_ALL)? Does Python use the <signal.h>
internally, or are all its FPEs detected by explicit checks beforehand?

If writing a python module with SWIG, and the module uses Python
callbacks, do I need to restore the signal handlers before running the
callback, or python do that itself?

(These might be questions better asked on the SWIG list I guess)

Cheers
JP




More information about the Python-list mailing list