Skip to content

Commit

Permalink
pythongh-111342: fix typo in math.sumprod (pythonGH-111416)
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev authored and iritkatriel committed Oct 29, 2023
1 parent 2e74589 commit 1b70f83
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Lib/test/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,7 @@ def test_sumprod_accuracy(self):
sumprod = math.sumprod
self.assertEqual(sumprod([0.1] * 10, [1]*10), 1.0)
self.assertEqual(sumprod([0.1] * 20, [True, False] * 10), 1.0)
self.assertEqual(sumprod([True, False] * 10, [0.1] * 20), 1.0)
self.assertEqual(sumprod([1.0, 10E100, 1.0, -10E100], [1.0]*4), 2.0)

@support.requires_resource('cpu')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed typo in :func:`math.sumprod`.
2 changes: 1 addition & 1 deletion Modules/mathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2832,7 +2832,7 @@ math_sumprod_impl(PyObject *module, PyObject *p, PyObject *q)
PyErr_Clear();
goto finalize_flt_path;
}
} else if (q_type_float && (PyLong_CheckExact(p_i) || PyBool_Check(q_i))) {
} else if (q_type_float && (PyLong_CheckExact(p_i) || PyBool_Check(p_i))) {
flt_q = PyFloat_AS_DOUBLE(q_i);
flt_p = PyLong_AsDouble(p_i);
if (flt_p == -1.0 && PyErr_Occurred()) {
Expand Down

0 comments on commit 1b70f83

Please sign in to comment.