[issue2121] complex constructor doesn't accept string with nan and inf
report at bugs.python.org
Wed Dec 31 08:41:56 CET 2008
Cournapeau David <david at ar.media.kyoto-u.ac.jp> added the comment:
I started a patch against the trunk to handle nan/inf/infinite (I have
not yet tackled the problem of negative zero).
The patch is a bit big, because I found the function quite difficult to
follow, so I refactored it a bit first (replacing the state machine with
the big switch with a sequential parsing). One potential problem is that
I do some computation with inf to make signed infinite, I don't know if
it is safe. I don't know is setting a variable to Nan is safe either.
Although I tested the function in a simple main under valgrind for
various legit and bogus input, there is no tests in this patch. I would
like to add some, but I am not familiar with python testing, so I would
be glad to receive some indications on how to do it properly.
Added file: http://bugs.python.org/file12502/nan_parse.patch
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list