[issue14613] time.time can return None or NaN

Michael Foord report at bugs.python.org
Wed Apr 18 14:26:28 CEST 2012


New submission from Michael Foord <michael at voidspace.org.uk>:

time.time() can return None, or sometimes NaN. If it can't get a "proper" value from the OS then I would expect it to throw an exception. The docs don't mention anything about error conditions.

This was originally reported to Ubuntu One and there has been discussion / attempts to reproduce (it affects several people and so wasn't an isolated case):

https://bugs.launchpad.net/ubuntu/+source/ubuntuone-control-panel/+bug/844435

The issue is that with the unexpected response from time.time(), a ValueError was caused later when converting the time:

https://launchpadlibrarian.net/79283418/Traceback.txt

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ubuntuone-control-panel/ubuntuone/controlpanel/web_client/libsoup.py", line 55, in _handler
    msg.status_code, msg.get_uri().to_string(False))
  File "/usr/lib/python2.7/logging/__init__.py", line 1120, in debug
    self._log(DEBUG, msg, args, **kwargs)
  File "/usr/lib/python2.7/logging/__init__.py", line 1249, in _log
    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
  File "/usr/lib/python2.7/logging/__init__.py", line 1223, in makeRecord
    rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
  File "/usr/lib/python2.7/logging/__init__.py", line 280, in __init__
    self.msecs = (ct - long(ct)) * 1000
ValueError: cannot convert float NaN to integer

----------
assignee: haypo
messages: 158608
nosy: haypo, michael.foord
priority: normal
severity: normal
status: open
title: time.time can return None or NaN

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


More information about the Python-bugs-list mailing list