Skip to content

Commit bccb7b9

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 369d148 commit bccb7b9

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
@@ -1722,7 +1722,7 @@ _winapi_WaitForMultipleObjects_impl(PyObject *module, PyObject *handle_seq,
17221722
nhandles = PySequence_Length(handle_seq);
17231723
if (nhandles == -1)
17241724
return NULL;
1725-
if (nhandles < 0 || nhandles >= MAXIMUM_WAIT_OBJECTS - 1) {
1725+
if (nhandles < 0 || nhandles > MAXIMUM_WAIT_OBJECTS - 1) {
17261726
PyErr_Format(PyExc_ValueError,
17271727
"need at most %zd handles, got a sequence of length %zd",
17281728
MAXIMUM_WAIT_OBJECTS - 1, nhandles);

0 commit comments

Comments
 (0)