Skip to content

gh-155966: Correct handling of math.tanpi poles - #155980

Merged
picnixz merged 10 commits into
python:mainfrom
jepler:issue-155966
Sep 9, 2026
Merged

gh-155966: Correct handling of math.tanpi poles#155980
picnixz merged 10 commits into
python:mainfrom
jepler:issue-155966

Conversation

@jepler

@jepler jepler commented Aug 17, 2026

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.

jepler added 3 commits August 17, 2026 17:26
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.
Comment thread Misc/NEWS.d/next/Library/2026-08-17-17-39-41.gh-issue-155966.0YOADY.rst Outdated
Comment thread Lib/test/mathdata/math_testcases.txt Outdated
Comment thread Lib/test/mathdata/math_testcases.txt Outdated
jepler and others added 4 commits August 17, 2026 20:04
…YOADY.rst

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
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.
@skirpichev
skirpichev requested a review from picnixz August 18, 2026 01:48
@skirpichev

Copy link
Copy Markdown
Member

CC @picnixz

Comment thread Lib/test/mathdata/math_testcases.txt Outdated
Comment thread Lib/test/mathdata/math_testcases.txt Outdated
@mdickinson

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

@mdickinson

Copy link
Copy Markdown
Member

Thanks for the changes! LGTM (FWTW)

@picnixz picnixz 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.

Sorry I forgot to approve!

@skirpichev

Copy link
Copy Markdown
Member

@picnixz, lets merge this.

@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
@picnixz

picnixz commented Sep 9, 2026

Copy link
Copy Markdown
Member

I forgot that Mark relinquished his commit bit

maurycy added a commit to maurycy/cpython that referenced this pull request Sep 10, 2026
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants