gh-94808: Cover handling non-finite numbers from round when ndigits is provided by mdboom · Pull Request #94860 · python/cpython (original) (raw)

This is an interesting corner case.

By default round returns int which can't represent non-finite numbers, so it throws various exceptions.

When ndigits is provided, round returns float, so non-finite numbers can be represented, and they just return what was passed in.

Automerge-Triggered-By: GH:brandtbucher