New submission from Gregory P. Smith <g...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue14028>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to