]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-42323: Fix math.nextafter() on AIX (GH-24381)
authorVictor Stinner <vstinner@python.org>
Fri, 29 Jan 2021 22:04:50 +0000 (23:04 +0100)
committerGitHub <noreply@github.com>
Fri, 29 Jan 2021 22:04:50 +0000 (23:04 +0100)
math_nextafter_impl() must return a Python object, not a C double.

Modules/mathmodule.c

index 8133d6b3aaefb8341924476aaaafa5370ed24078..d0df58c63e110e0863b086e96f8a9ce56ae69de6 100644 (file)
@@ -3474,10 +3474,10 @@ math_nextafter_impl(PyObject *module, double x, double y)
         return PyFloat_FromDouble(y);
     }
     if (Py_IS_NAN(x)) {
-        return x;
+        return PyFloat_FromDouble(x);
     }
     if (Py_IS_NAN(y)) {
-        return y;
+        return PyFloat_FromDouble(y);
     }
 #endif
     return PyFloat_FromDouble(nextafter(x, y));