Skip to content

Commit 9dc4fb8

Browse files
authored
gh-111342: fix typo in math.sumprod (GH-111416)
1 parent c3bb10c commit 9dc4fb8

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

Lib/test/test_math.py

+1
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,7 @@ def test_sumprod_accuracy(self):
13251325
sumprod = math.sumprod
13261326
self.assertEqual(sumprod([0.1] * 10, [1]*10), 1.0)
13271327
self.assertEqual(sumprod([0.1] * 20, [True, False] * 10), 1.0)
1328+
self.assertEqual(sumprod([True, False] * 10, [0.1] * 20), 1.0)
13281329
self.assertEqual(sumprod([1.0, 10E100, 1.0, -10E100], [1.0]*4), 2.0)
13291330

13301331
@support.requires_resource('cpu')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed typo in :func:`math.sumprod`.

Modules/mathmodule.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2832,7 +2832,7 @@ math_sumprod_impl(PyObject *module, PyObject *p, PyObject *q)
28322832
PyErr_Clear();
28332833
goto finalize_flt_path;
28342834
}
2835-
} else if (q_type_float && (PyLong_CheckExact(p_i) || PyBool_Check(q_i))) {
2835+
} else if (q_type_float && (PyLong_CheckExact(p_i) || PyBool_Check(p_i))) {
28362836
flt_q = PyFloat_AS_DOUBLE(q_i);
28372837
flt_p = PyLong_AsDouble(p_i);
28382838
if (flt_p == -1.0 && PyErr_Occurred()) {

0 commit comments

Comments
 (0)