[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
Mark Dickinson
report at bugs.python.org
Fri May 4 16:50:01 CEST 2012
Mark Dickinson <dickinsm at gmail.com> added the comment:
I don't think this change should be made for 2.7 or 3.2, since it has potential to break existing code.
Though technically, conversion of an out-of-range double to a float gives undefined behaviour (C99 6.3.1.5p2), I'm willing to bet that most current compilers just happily return +-infinity in these cases, and there's probably code out there that would break if we changed this.
So for 2.7 or 3.2, we could just return +-inf here instead. Though even that isn't quite right if you're picky about corner cases, since there are some values *just* outside [-FLOAT_MAX, FLOAT_MAX] that should still round to +-FLOAT_MAX under round-to-nearest.
I suggest leaving this alone for 2.7 and 3.2
For 3.3, it's not clear to me whether it's better to return +-inf or to raise here.
----------
nosy: +mark.dickinson
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14722>
_______________________________________
More information about the Python-bugs-list
mailing list