aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-01-20 15:20:13 +0100
committerGitHub <noreply@github.com>2021-01-20 15:20:13 +0100
commitc1c3493fb7a3af8efdc50175e592d29e8cb93886 (patch)
treed389163c67da00b1d6e838cf240311155346b48e /Modules
parentbpo-42780: Fix set_inheritable() for O_PATH file descriptors on Linux (GH-24172) (diff)
downloadcpython-c1c3493fb7a3af8efdc50175e592d29e8cb93886.tar.gz
cpython-c1c3493fb7a3af8efdc50175e592d29e8cb93886.tar.bz2
cpython-c1c3493fb7a3af8efdc50175e592d29e8cb93886.zip
bpo-42323: Fix math.nextafter() for NaN on AIX (GH-24265)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/mathmodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 86b64fb4226..8133d6b3aae 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -3473,6 +3473,12 @@ math_nextafter_impl(PyObject *module, double x, double y)
Bug fixed in bos.adt.libm 7.2.2.0 by APAR IV95512. */
return PyFloat_FromDouble(y);
}
+ if (Py_IS_NAN(x)) {
+ return x;
+ }
+ if (Py_IS_NAN(y)) {
+ return y;
+ }
#endif
return PyFloat_FromDouble(nextafter(x, y));
}