[Python-checkins] bpo-42323: Fix math.nextafter() on AIX (GH-24381)

vstinner webhook-mailer at python.org
Fri Jan 29 17:04:54 EST 2021


https://github.com/python/cpython/commit/0837f99d3367ecf200033bbddfa05d061ae9f483
commit: 0837f99d3367ecf200033bbddfa05d061ae9f483
branch: master
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2021-01-29T23:04:50+01:00
summary:

bpo-42323: Fix math.nextafter() on AIX (GH-24381)

math_nextafter_impl() must return a Python object, not a C double.

files:
M Modules/mathmodule.c

diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 8133d6b3aaefb..d0df58c63e110 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -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));



More information about the Python-checkins mailing list