A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-July/081493.html below:

[Python-Dev] fileobj.read(float): warning or error?

[Python-Dev] fileobj.read(float): warning or error? [Python-Dev] fileobj.read(float): warning or error?"Martin v. Löwis" martin at v.loewis.de
Tue Jul 22 07:01:42 CEST 2008
> Well, the real problem is os.urandom(4.2) which goes to an unlimited loop:
> 
>   while len(bytes) < n:
>       bytes += read(_urandomfd, n - len(bytes))
> 
> because read(0.2) works as read(0) :-/

I can't quite accept that as a bug in the library. If you give invalid
parameters, Python should not crash, but it may start to behave in a
nonsensical way.

Of course, it would be possible to move the conversion warning one layer
up, into os.urandom; if the argument is float, raise a warning, and then
truncate.

Regards,
Martin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4