On 11 Apr 2016, at 10:11, [email protected] wrote:
Will also help with graphics programs etc too! Often get crashes in matplotlib from this...
This is indeed another very good point. We’ve had issues with wxPython as well and I remember having to sandwich some call calling into wxPython with an enabling/disabling of traps. Note that I did write a long time ago a nice utility which can be used both in C++ and Python:
In Python, it uses a context:
>>> import boost.python
>>> from scitbx.array_family import flex
>>> a = flex.double((0, 0, 0))
>>> with boost.python.trapping(division_by_zero=False):
>>> b = 1/a
>>> tuple(b)
(inf, inf, inf)
>>> 1/a
... CRASH ...
In C++, it uses the guard pattern:
#include