bpo-32978: Fix reading huge floats in AIFC files. by serhiy-storchaka · Pull Request #5952 · python/cpython (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the issue discussion, I'd suggest just letting the OverflowError propagate. If we encounter a value like this. But in that case, we should probably also raise for an infinity or NaN above.

So if we want to be internally consistent, I guess the choices are:

I find it hard to see any justification for option (2) (especially, turning a nan into sys.float_info.max seems completely nonsensical) other than that that's what the current code does. Backwards compatibility seems unlikely to be a concern here.