← 返回首页
gh-102837: Increase test coverage for the math module by skirpichev · Pull Request #110000 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

gh-102837: Increase test coverage for the math module#110000

Closed
skirpichev wants to merge 28 commits into
python:mainfrom
skirpichev:math-cov
Closed

gh-102837: Increase test coverage for the math module#110000
skirpichev wants to merge 28 commits into
python:mainfrom
skirpichev:math-cov

Conversation

skirpichev commented Sep 28, 2023
edited
Loading

Copy link
Copy Markdown
Member
  • Improve math_2() comment (mention real use-cases for math_2)
  • trunc: drop _PyType_IsReady() check (L2071) like floor/ceil
  • loghelper: drop inaccessible cases L2234, L2241. Here arg is nonnegative.
  • modf: more efficient (for finite x) handling of special cases (rewrite changes in gh-102837: few coverage nitpicks for the math module #102523)
  • pow

Line numbers are wrt to mathmodule.c at 54fbfa8d5e.

This is a continuation of #102523. There are still some uncovered lines/branches, so issue will not be closed. I can add more commits, but I feel it will be more difficult to review...

Comment thread Modules/mathmodule.c Outdated Show resolved Hide resolved
Comment thread Modules/mathmodule.c Outdated Show resolved Hide resolved
Comment thread Modules/mathmodule.c Outdated Show resolved Hide resolved
Comment thread Modules/mathmodule.c Show resolved Hide resolved

serhiy-storchaka 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Also, I think that one of changes in your previous PR should be reverted.

Copy link
Copy Markdown
Member Author

Also, I think that one of changes in your previous PR should be reverted.

Thanks for a suggestion. I did more efficient rewrite of that part, as discussed in the thread.

Comment thread Lib/test/test_math.py Outdated Show resolved Hide resolved
Comment thread Lib/test/test_math.py Show resolved Hide resolved
Comment thread Lib/test/test_math.py Show resolved Hide resolved
Comment thread Lib/test/test_math.py Outdated Show resolved Hide resolved
Comment thread Lib/test/test_math.py Show resolved Hide resolved

Copy link
Copy Markdown
Member

How did you write new tests? They look wildly random to me.

13 hidden items Load more…

Copy link
Copy Markdown
Member Author

How did you write new tests? They look wildly random to me.

I prefer exact results, if possible. Then I try to use arch-independent values (e.g. "big enough" integers to trigger overflows on all platforms. And they should hit mentioned lines. Otherwise, they are random.

Remove redundant test (python#111416)

encukou commented Nov 3, 2023

Copy link
Copy Markdown
Member

This PR combines

  • test improvements, which should be backported
  • refactoring (dead code removal), which IMO should not be backported, and
  • possibly a bugfix, which should be backported together with a previously failing test

To make the backporting easier, would it make sense to split the PR along those lines?

Copy link
Copy Markdown
Member Author

@encukou, sorry, I wasn't aware that tests are systematically backported (based on #102067 and #102523).

possibly a bugfix, which should be backported together with a previously failing test

Probably, you are about typo in sumprod(). This is fixed and backported, see #111342. Or something else?

encukou commented Nov 9, 2023

Copy link
Copy Markdown
Member

The backporting is a fairly new policy.

But, another benefit of splitting this would be that the test additions could be merged right now, without waiting for @mdickinson to comment on the removed code :)

Thanks for the typo fix!

Copy link
Copy Markdown
Member Author

@encukou, tests now added in #111930

Comment thread Modules/mathmodule.c Show resolved Hide resolved
skirpichev marked this pull request as draft December 9, 2023 05:21

Copy link
Copy Markdown
Member

Please could some kind person remove the request for review for me?

serhiy-storchaka removed the request for review from mdickinson August 13, 2024 18:22
skirpichev marked this pull request as ready for review October 25, 2024 05:07

Copy link
Copy Markdown
Member Author

@serhiy-storchaka, I'm going to close this (together with the issue) on same ground as #109642. It seems, CPython devs not welcoming now code coverage improvements.

skirpichev closed this Oct 25, 2024
skirpichev deleted the math-cov branch October 25, 2024 05:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Footer

© 2026 GitHub, Inc.