[New-bugs-announce] [issue14028] random.choice hits ValueError: cannot convert float NaN to integer
Gregory P. Smith
report at bugs.python.org
Thu Feb 16 08:57:53 CET 2012
New submission from Gregory P. Smith <greg at krypto.org>:
Using a 32-bit Python 2.6.5 on a Linux system at work we observed the following:
File "/.../lib/python2.6/tempfile.py", line 349, in mktemp
name = names.next()
File "/.../lib/python2.6/tempfile.py", line 134, in next
letters = [choose(c) for dummy in "123456"]
File "/.../lib/python2.6/random.py", line 261, in choice
return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty
ValueError: cannot convert float NaN to integer
This is rare and hard to reproduce. The hardware appears to be healthy and this was on a server with ECC.
Some searching reveals that other people have hit this in random.choice in Python 2.7 as well: https://bugs.launchpad.net/ubuntu/+source/desktopcouch/+bug/886159
The ubuntu developer seems to think this is related to time.time() returning NaN at some point (I haven't looked into that myself).
----------
messages: 153464
nosy: gregory.p.smith, tim_one
priority: normal
severity: normal
status: open
title: random.choice hits ValueError: cannot convert float NaN to integer
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14028>
_______________________________________
More information about the New-bugs-announce
mailing list