Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9dc4fb8

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

File tree

3 files changed

+3
-1
lines changed
Filter options

3 files changed

+3
-1
lines changed

‎Lib/test/test_math.py

Copy file name to clipboardExpand all lines: Lib/test/test_math.py
+1Lines changed: 1 addition & 0 deletions
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')
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed typo in :func:`math.sumprod`.

‎Modules/mathmodule.c

Copy file name to clipboardExpand all lines: Modules/mathmodule.c
+1-1Lines changed: 1 addition & 1 deletion
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.