Skip to content

Commit 899e37b

Browse files
bpo-40263: Fixes an off-by-one error in _winapi_WaitForMultipleObjects_impl (GH-19501)
(cherry picked from commit 92b5dc7) Co-authored-by: Ray Donnelly <[email protected]>
1 parent 7d77368 commit 899e37b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a follow-on bug from https://bugs.python.org/issue26903. Once that
2+
is applied we run into an off-by-one assertion problem. The assert was not
3+
correct.

Modules/_winapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@ _winapi_WaitForMultipleObjects_impl(PyObject *module, PyObject *handle_seq,
17131713
nhandles = PySequence_Length(handle_seq);
17141714
if (nhandles == -1)
17151715
return NULL;
1716-
if (nhandles < 0 || nhandles >= MAXIMUM_WAIT_OBJECTS - 1) {
1716+
if (nhandles < 0 || nhandles > MAXIMUM_WAIT_OBJECTS - 1) {
17171717
PyErr_Format(PyExc_ValueError,
17181718
"need at most %zd handles, got a sequence of length %zd",
17191719
MAXIMUM_WAIT_OBJECTS - 1, nhandles);

0 commit comments

Comments
 (0)