<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Jul 21, 2008 at 2:17 PM, Victor Stinner &lt;<a href="mailto:victor.stinner@haypocalc.com">victor.stinner@haypocalc.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
Since Python 2.4 (maybe 2.2 or older), fileobj.read(4.2) displays an error and<br>
works as fileobj.read(4).<br>
<br>
&gt;&gt;&gt; i=open(&#39;/etc/issue&#39;)<br>
&gt;&gt;&gt; i.read(4.2)<br>
__main__:1: DeprecationWarning: integer argument expected, got float</blockquote><div><br>This warning is actually given by the argument parser when &quot;i&quot; gets a Python non-integer.<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
It should raises an error instead of a warning, it has no sense to read a<br>
partial byte :-) But that should breaks some applications?</blockquote><div><br>This doesn&#39;t come into effect until 3.0. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
Well, the real problem is os.urandom(4.2) which goes to an unlimited loop:<br>
<br>
 &nbsp;while len(bytes) &lt; n:<br>
 &nbsp; &nbsp; &nbsp;bytes += read(_urandomfd, n - len(bytes))<br>
<br>
because read(0.2) works as read(0) :-/<br>
<br>
Victor<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-dev" target="_blank">http://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="http://mail.python.org/mailman/options/python-dev/musiccomposition%40gmail.com" target="_blank">http://mail.python.org/mailman/options/python-dev/musiccomposition%40gmail.com</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Cheers,<br>Benjamin Peterson<br>&quot;There&#39;s no place like <a href="http://127.0.0.1">127.0.0.1</a>.&quot;
</div>