<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: 'Lucida Sans'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">This would be best encapsulated as a context manager actually, so that we can write it simply as<br><br>with boost.python.trapping(division_by_zero=False):<br>&nbsp;&nbsp;&nbsp;&lt;here you make the call to the library that has issues with NaN and Inf&gt;<br></span></blockquote><br></div><div>I have just committed the code making it possible to use that terser syntax. In your case, again, you want instead to pass overflow=False and invalid=False to which you can still add division_by_zero=False just in case future versions of pyyaml cause problem with that too!</div><div><br></div><div>Best wishes,</div><div><br></div><div>Luc</div><div><br></div><br></body></html>