[issue3708] os.urandom(1.1): infinite loop

Daniel Diniz report at bugs.python.org
Thu Aug 28 21:50:55 CEST 2008


Daniel Diniz <ajaksu at gmail.com> added the comment:

Gregory,
IMHO your patch is better in all aspects.

Regarding my patch, the API wouldn't change at all, as the source reads:
        while len(bytes) < int(n):
            bytes += read(_urandomfd, n - len(bytes))

So "n - len(bytes)" restricts the API to what it was before. But it
would call int() for each loop iteration :/

@Pitrou: My patch still passed the float to read (to keep the current
behavior, warning included), but if doing that can be considered a bug,
let's get rid of the DeprecationWarning by passing an int.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3708>
_______________________________________


More information about the Python-bugs-list mailing list