Message 159963 - Python tracker (original) (raw)
Here is a patch with tests.
Nope. Values just larger than DBL_MAX won't raise OverflowError here.
Isn't that a little bit. But values that rounded to DBL_MAX can raise OverflowError. In any case it's too difficult to achieve strict behavior in this corner case.
Possibly. But there's also the fact that 3.2 already returns inf here; we'd need a pretty good reason to break that.
In the end, we may add the environment variable PYTHONDONTRAISEEXCEPTIONIFFLOATOVERFLOWS to control this behaviour.
Like I said, I'm not sure which the right way to go here is.
Take a look at the tests and may be you'll see the system.