[New-bugs-announce] [issue7906] float("INFI") returns inf on certain platforms

Zsolt Cserna report at bugs.python.org
Thu Feb 11 14:40:32 CET 2010

New submission from Zsolt Cserna <zsolt.cserna at morganstanley.com>:

Python 2.6.4
On my system which is solaris 8/sparc, float("INFI") returns inf instead of raising ValueError, both 32 and 64-bit. (since it's case-insensitive it applies to any upper/lower combination of letters).

This issue breaks test_float regression test which has a test for that value and it expects ValueError.

Doing some research and debugging showed me that strtod(const char *str, char **endptr) function behaves differently on solaris 8 than linux.
On solaris it stores \0 in **endptr meaning that it processed the string completely - and that's the reason why python doesn't raise ValueError.
On linux, strtod() stores 'I' in **endptr, and it results the ValueError.

With python 2.6.1 there's no such issue.

components: Interpreter Core
messages: 99206
nosy: csernazs
severity: normal
status: open
title: float("INFI") returns inf on certain platforms
type: behavior
versions: Python 2.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list