GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-155966: Correct handling of `math.tanpi` poles by jepler · Pull Request #155980 · python/cpython

Conversation

@jepler

@jepler jepler commented Aug 17, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

As pointed out in #155966, the exceptional half-integer (0.5, 1.5, etc) inputs of tanpi were not handled properly.

Now, these raise ValueError and this is tested by test.test_math through its list of test cases.

In the process of working on this, I noticed that I had incorrectly added duplicate test ids and that this was not treated as an error by the test harness. I have corrected this and made it part of the test.

  • Issue: math.tanpi is untested at its poles and no test-file flag fits #155966

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
jepler added 3 commits August 17, 2026 17:26
@jepler
pythongh-155966: Correct handling of tanpi(0.5) (python#155966)
886d4ac
As pointed out in the issue, the exceptional half-integer
(0.5, 1.5, etc) inputs of tanpi were not handled properly.

Now, these raise ValueError and this is tested by `test.test_math`
through its list of test cases.
@jepler
math_testcases: Fix duplicate test ids
faa1799
@jepler
test_math: Treat duplicate test ids as failure.
198937d
@bedevere-app bedevere-app Bot added the awaiting review label Aug 17, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Aug 17, 2026
math.tanpi is untested at its poles and no test-file flag fits #155966
Closed
@jepler
Add news entry
5bd16b9
skirpichev
skirpichev requested changes Aug 18, 2026
View reviewed changes
Comment thread Misc/NEWS.d/next/Library/2026-08-17-17-39-41.gh-issue-155966.0YOADY.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/mathdata/math_testcases.txt Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/mathdata/math_testcases.txt Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Aug 18, 2026
jepler and others added 4 commits August 17, 2026 20:04
@jepler @skirpichev
Update Misc/NEWS.d/next/Library/2026-08-17-17-39-41.gh-issue-155966.0…
e59375b
…YOADY.rst

Co-authored-by: Sergey B Kirpichev <[email protected]>
@jepler
fix sign of infinity in test cases
9dff17a
the test harness cannot verify the sign of infinity, it can
only verify the exception; but it's good for it to be correct
anyhow.
@jepler
Revert "math_testcases: Fix duplicate test ids"
b4b4484
This reverts commit faa1799.
@jepler
fix only minimal set of testcase IDs
38f4d61
skirpichev
skirpichev approved these changes Aug 18, 2026
View reviewed changes
@skirpichev
skirpichev requested a review from picnixz August 18, 2026 01:48
@skirpichev

skirpichev commented Aug 18, 2026

Copy link
Copy Markdown
Member

CC @picnixz

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mdickinson
mdickinson reviewed Aug 18, 2026
View reviewed changes
Comment thread Lib/test/mathdata/math_testcases.txt Resolved

Uh oh!

There was an error while loading. Please reload this page.

skirpichev
skirpichev reviewed Aug 18, 2026
View reviewed changes
Comment thread Lib/test/mathdata/math_testcases.txt Resolved

Uh oh!

There was an error while loading. Please reload this page.

@skirpichev
Apply suggestion from @skirpichev
216f1da
@mdickinson

mdickinson commented Aug 18, 2026

Copy link
Copy Markdown
Member

Mildly off-topic: in case anyone's interested, there's some fun reading here: https://grouper.ieee.org/groups/msc/ANSI_IEEE-Std-754-2019/background/tanpi.txt

skirpichev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@skirpichev
Merge branch 'main' into issue-155966
f7a4d0a
@mdickinson

mdickinson commented Aug 21, 2026

Copy link
Copy Markdown
Member

Thanks for the changes! LGTM (FWTW)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

picnixz
picnixz approved these changes Aug 21, 2026
View reviewed changes

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Sorry I forgot to approve!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Aug 21, 2026
@skirpichev

skirpichev commented Sep 9, 2026

Copy link
Copy Markdown
Member

@picnixz, lets merge this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@picnixz picnixz changed the title gh-155966: Correct handling of tanpi(0.5) (#155966) gh-155966: Correct handling of math.tanpi poles Sep 9, 2026
@picnixz
picnixz merged commit 894af95 into python:main Sep 9, 2026
58 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Sep 9, 2026
@picnixz

picnixz commented Sep 9, 2026

Copy link
Copy Markdown
Member

I forgot that Mark relinquished his commit bit

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

maurycy added a commit to maurycy/cpython that referenced this pull request Sep 10, 2026
@maurycy
Merge branch 'main' into tachyon-native-callable
e028ff5
* main: (158 commits)
  pythongh-156924: Try reifying lazy imports in `ForwarRef.evaluate()` (python#156940)
  pythongh-156233: Fix typos and code snippet errors in the docs (python#156475)
  pythongh-156837: Refer to yield expressions in generator function definitions (pythonGH-156863)
  pythongh-155292: Skip updating unicodedata with mismatched interpreter (pythonGH-157066)
  pythongh-157170: Document the scope of global curses settings (pythonGH-157207)
  pythongh-155966: Correct handling of `math.tanpi` poles (python#155980)
  pythongh-157170: Restore use_env() after test_use_prescr_screen in test_curses (pythonGH-157171)
  pythongh-156910: fix deadlock in type_set_abstractmethods under free-threading (python#156948)
  pythongh-155648: Write the empty and placeholder IDLE tests (python#156260)
  pythongh-153569: centralize formatted-string state and source spans (python#156484)
  pythongh-157137: Mark the PEP 820 soft deprecations as 3.15, not `next` (python#157138)
  pythongh-152433: Use regular LoadLibrary in UWP for Windows system libs (pythonGH-156972)
  pythongh-121617: Fix Py_CLEAR() memcpy in C++: replace NULL with _Py_NULL (python#157188)
  pythongh-157135: Fix documentation errors in the `math.atan{2}pi` functions (python#157136)
  pythongh-121617: Fix Py_CLEAR() in C++: replace NULL with _Py_NULL (python#157067)
  pythongh-156774: Speed up pdb startup with asyncio guard (python#156775)
  pythongh-156109: Allow static, non-framework iOS builds (python#156110)
  pythongh-156780: Emscripten: add missing EM_JS_DEPS (python#156798)
  pythongh-152936: Make privileged functions available on Android (python#152977)
  pythongh-123018: Keep the libedit history file header when truncating (pythonGH-157165)
  ...
clin1234 pushed a commit to clin1234/cpython that referenced this pull request Sep 12, 2026
@jepler @clin1234
pythongh-155966: Correct handling of math.tanpi poles (python#155980)
ccb0cd7
``math.tanpi`` now raises a ``ValueError`` for half-integer values
(e.g., ``tanpi(0.5)``), as these are poles of the function.
johnslavik pushed a commit to johnslavik/cpython that referenced this pull request Sep 14, 2026
@jepler @johnslavik
pythongh-155966: Correct handling of math.tanpi poles (python#155980)
4f8cf8d
``math.tanpi`` now raises a ``ValueError`` for half-integer values
(e.g., ``tanpi(0.5)``), as these are poles of the function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@skirpichev skirpichev skirpichev approved these changes
@picnixz picnixz picnixz approved these changes
+1 more reviewer
@mdickinson mdickinson mdickinson left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@jepler @skirpichev @mdickinson @picnixz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.