Fix off-by-one-error in _winapi_WaitForMultipleObjects_impl

This commit is contained in:
Ray Donnelly 2020-04-12 18:22:21 +02:00 committed by distro-bot@anaconda.com
parent 0c13e1f96a
commit cf49f0267b
2 changed files with 4 additions and 1 deletions

View File

@ -0,0 +1,3 @@
This is a follow-on bug from https://bugs.python.org/issue26903. Once that
is applied we run into an off-by-one assertion problem. The assert was not
correct.

View File

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