Skip to content

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

Merged
brandtbucher merged 1 commit into
python:mainfrom
mdboom:coverage-floatobject
Jul 14, 2022
Merged

gh-94808: Cover handling non-finite numbers from round when ndigits is provided#94860
brandtbucher merged 1 commit into
python:mainfrom
mdboom:coverage-floatobject

Conversation

@mdboom

@mdboommdboom commented Jul 14, 2022

Copy link
Copy Markdown
Contributor

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

@brandtbucherbrandtbucher left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown

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 <mdboom@gmail.com>
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 <mdboom@gmail.com>
Automerge-Triggered-By: GH:brandtbucher
@mdboommdboom added the needs backport to 3.11 only security fixes label Aug 8, 2022
@miss-islington

Copy link
Copy Markdown
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
Copy Markdown
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

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@mdboom@miss-islington@bedevere-bot@brandtbucher@kumaraditya303