Skip to content

Commit cf49f02

Browse files
mingwandroiddistro-bot@anaconda.com
authored andcommitted
Fix off-by-one-error in _winapi_WaitForMultipleObjects_impl
1 parent 0c13e1f commit cf49f02

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
@@ -1705,7 +1705,7 @@ _winapi_WaitForMultipleObjects_impl(PyObject *module, PyObject *handle_seq,
17051705
nhandles = PySequence_Length(handle_seq);
17061706
if (nhandles == -1)
17071707
return NULL;
1708-
if (nhandles < 0 || nhandles >= MAXIMUM_WAIT_OBJECTS - 1) {
1708+
if (nhandles < 0 || nhandles > MAXIMUM_WAIT_OBJECTS - 1) {
17091709
PyErr_Format(PyExc_ValueError,
17101710
"need at most %zd handles, got a sequence of length %zd",
17111711
MAXIMUM_WAIT_OBJECTS - 1, nhandles);

0 commit comments

Comments
 (0)