PyYAML: Ticket #289: Use of undefined operation to create inf & nan
http://pyyaml.org/ticket/289
<p>
In <tt>constructor.py</tt>, around line 256, the following lines are used to create an <tt>inf</tt> and a <tt>nan</tt>:
</p>
<pre class="wiki"> inf_value = 1e300
while inf_value != inf_value*inf_value:
inf_value *= inf_value
nan_value = -inf_value/inf_value # Trying to make a quiet NaN (like C99).
</pre><p>
The problem is that this code makes use of undefined operations. Some strict environments trap undefined operations and raise an exception, causing this code to crash the interpreter when such exceptions are not caught.
</p>
<p>
A defined way to create an <tt>inf</tt> and <tt>nan</tt> is simply:
</p>
<pre class="wiki"> inf_value = float('inf')
nan_nan = float('nan')
</pre><p>
The latter is preferred because it will not crash the interpreter in strict environments and also its intent is clearer.
</p>
en-usPyYAML/static/pyyaml.png
http://pyyaml.org/ticket/289
Trac 0.12.2