GeezerVison is showing github.com — `test.test_math.MathTests.testAtan2` failure on OpenIndiana/Solaris · Issue #138573 · python/cpython
test.test_math.MathTests.testAtan2 failure on OpenIndiana/Solaris #138573
DescriptionI do see the following failure with Python-3.14.0rc2 on OpenIndiana. This is a regression from Python-3.13.7.
======================================================================
ERROR: testAtan2 (test.test_math.MathTests.testAtan2)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/data/builds/ul-workspace/components/python/python-314/Python-3.14.0rc2/Lib/test/test_math.py", line 339, in testAtan2
self.ftest('atan2(0., -0.)', math.atan2(0., -0.), math.pi)
~~~~~~~~~~^^^^^^^^^
ValueError: math domain error
----------------------------------------------------------------------
Linked PRs
ActivityStanFromIreland commented 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, 2025terryjreedy commented on Sep 6, 2025 Does that mean we should close this? skirpichev commented on Sep 6, 2025 math.atan2 is essentially a thin wrapper over libm's atan2:
|
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.") |
|
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? StanFromIreland commented 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. skirpichev commented on Sep 6, 2025 Ok, let's close. I don't think workaround is needed. mtelka commented on Sep 6, 2025 ContributorAuthor More actions 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? skirpichev commented on Mar 25, 2026 vstinner commented 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_socket
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? vstinner commented on Mar 25, 2026 The two failing tests are now skipped on Solaris: 8e1469c. The change will be backported to 3.14 once the CI pass on the PR.
Thanks for your bug report @mtelka. vstinner commented on Mar 25, 2026
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_ieee test in the implementation? It's possible to select a "lib_version" to get different behaviors? mtelka commented on Mar 26, 2026 ContributorAuthor More actions
We do have only one libm implementation, so yes.
What is lib_version != libm_ieee test 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 mtelka commented on Mar 26, 2026 ContributorAuthor More actions
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 Stinner kulikjak commented on Mar 31, 2026 Thank you for the merge. We still didn't fix (or change) the atan2 behavior, so the skip at least helps us.
MetadataMetadataStatusShow more project fields
DevelopmentNo branches or pull requestsIssue actions
|