Repository navigation
test.test_math.MathTests.testAtan2 failure on OpenIndiana/Solaris #138573
Description
Activity
- addedtestsTests in the Lib/test dirTests in the Lib/test dir
on Sep 6, 2025 - addedinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
on Sep 6, 2025 Also occurs on our Solaris buildbot.
I actually talked about this with @kulikjak, and this is an issue on their side. So there isn't anything for us to do.
- changed the title
[-]`test.test_math.MathTests.testAtan2` failure on OpenIndiana[/-][+]`test.test_math.MathTests.testAtan2` failure on OpenIndiana/Solaris[/+]on Sep 6, 2025 Does that mean we should close this?
math.atan2 is essentially a thin wrapper over libm's atan2:
Lines 1100 to 1103 in 8554c09
FUNC2(atan2, atan2, "atan2($module, y, x, /)\n--\n\n" "Return the arc tangent (measured in radians) of y/x.\n\n" "Unlike atan(y/x), the signs of both x and y are considered.")
Lines 1014 to 1047 in 8554c09
static PyObject * math_2(PyObject *const *args, Py_ssize_t nargs, double (*func) (double, double), const char *funcname) { double x, y, r; if (!_PyArg_CheckPositional(funcname, nargs, 2, 2)) return NULL; x = PyFloat_AsDouble(args[0]); if (x == -1.0 && PyErr_Occurred()) { return NULL; } y = PyFloat_AsDouble(args[1]); if (y == -1.0 && PyErr_Occurred()) { return NULL; } errno = 0; r = (*func)(x, y); if (isnan(r)) { if (!isnan(x) && !isnan(y)) errno = EDOM; else errno = 0; } else if (isinf(r)) { if (isfinite(x) && isfinite(y)) errno = ERANGE; else errno = 0; } if (errno && is_error(r, 1)) return NULL; else return PyFloat_FromDouble(r); }
I don't think something was changed here since v3.13 other than using libm's isinf/isnan macro directly.It looks like in the given case platform's atan2 returns a nan. @mtelka, could you verify this?
Correct answer is pi, see https://en.cppreference.com/w/c/numeric/math/atan2.html (Assuming IEEE 754-compatible behavior.) @mtelka, did you test on same version of the OS? This looks as a regression for me, but not in the CPython.
Edit: I assume, that we won't add a workaround for unsupported broken platform. Or?
- addedpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
on Sep 6, 2025 math.atan2 is essentially a thin wrapper over libm's atan2:
Yes, as I said, this is an issue in their library, which they hope to fix soon.
Ok, let's close. I don't think workaround is needed.
- removedpendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is provided
on Sep 6, 2025 I tested this simple C:
#include <math.h> #include <stdio.h> int main(void) { printf("%f\n", atan2(0., -0.)); return 0; }and here is the result:
$ gcc -Wall -o test test.c $ ./test 3.141593 $How can I prove the issue is with the platform?
32 remaining items
- added a commit that references this issue
on Mar 25, 2026 (I found mentions of this behavior on our bug tracker from 1988)
Wow, this is an old bug! 😄
For completeness, here is list of failed tests on OpenIndiana with Python 3.13.7:
6 tests failed:
test.test_asyncio.test_ssl test_cext test_cppext test_embed
test_shutil test_socketI'm interested by test_cext and test_cppext failures, but also by test_embed failure. Would you mind to open an issue for test_cext+test_cppext and another one for test_embed?
Okay, it looks like the issue is really with the platform, so I reported the bug at https://www.illumos.org/issues/17602.
Oh, this issue has been fixed by the change illumos/illumos-gate@2eba8eb in the meanwhile, nice!
We do have only one libm implementation, so yes.
What is
lib_version != libm_ieeetest in the implementation? It's possible to select a "lib_version" to get different behaviors?We do have only one libm implementation, so yes.
What is
lib_version != libm_ieeetest in the implementation? It's possible to select a "lib_version" to get different behaviors?I do not think so. However, there was a discussion about this line during the code review. You can find it here: https://code.illumos.org/c/illumos-gate/+/4476
I'm interested by test_cext and test_cppext failures, but also by test_embed failure. Would you mind to open an issue for test_cext+test_cppext and another one for test_embed?
These tests pass with Python 3.14.3.
Reacted by Victor StinnerThank you for the merge. We still didn't fix (or change) the
atan2behavior, so the skip at least helps us.
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
I do see the following failure with Python-3.14.0rc2 on OpenIndiana. This is a regression from Python-3.13.7.
Linked PRs