Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-94808: Cover handling non-finite numbers from round when ndigits is provided #94860

Merged
merged 1 commit into from
Jul 14, 2022

Conversation

mdboom
Copy link
Contributor

@mdboom mdboom commented Jul 14, 2022

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

Copy link
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

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

Interesting indeed!

@miss-islington
Copy link
Contributor

Thanks @mdboom for the PR, and @brandtbucher for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Jul 15, 2022
@bedevere-bot
Copy link

GH-94882 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 15, 2022
…gits is provided (pythonGH-94860)

(cherry picked from commit 625ba9b)

Co-authored-by: Michael Droettboom <[email protected]>
miss-islington added a commit that referenced this pull request Jul 15, 2022
…igits is provided (GH-94860) (GH-94882)

(cherry picked from commit 625ba9b)


Co-authored-by: Michael Droettboom <[email protected]>

Automerge-Triggered-By: GH:brandtbucher
@mdboom mdboom added the needs backport to 3.11 only security fixes label Aug 8, 2022
@miss-islington
Copy link
Contributor

Thanks @mdboom for the PR, and @brandtbucher for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @mdboom and @brandtbucher, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 625ba9bdff51baddf9d5e156e5facf05fa1003d6 3.11

@mdboom mdboom removed the needs backport to 3.11 only security fixes label Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants