[issue14028] random.choice hits ValueError: cannot convert float NaN to integer
report at bugs.python.org
Thu Feb 16 11:43:27 CET 2012
Mark Dickinson <dickinsm at gmail.com> added the comment:
Hmm, this is a little odd. For 2.7 at least, the error message is coming from PyLong_FromDouble in Objects/longobject.c. I can't immediately see how PyLong_FromDouble could be called by the random seeding process.
So it seems more likely that the error is really coming from the int() call in the traceback. But now that implies that the random call is returning NaN, which looks unpossible from the code (random_random in Modules/_randommodule.c).
static PyObject *
unsigned long a=genrand_int32(self)>>5, b=genrand_int32(self)>>6;
So despite your comments about healthy hardware, my bet's on corrupted memory. :-)
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list