Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
On Windows, fix multiprocessing.Connection for very large read: fix _winapi.PeekNamedPipe() and _winapi.ReadFile() for read larger than INT_MAX (usually 2^31-1).
10 changes: 5 additions & 5 deletions Modules/_winapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ _winapi_PeekNamedPipe_impl(PyObject *module, HANDLE handle, int size)
}
if (_PyBytes_Resize(&buf, nread))
return NULL;
return Py_BuildValue("Nii", buf, navail, nleft);
return Py_BuildValue("NII", buf, navail, nleft);
}
else {
Py_BEGIN_ALLOW_THREADS
Expand All @@ -1347,22 +1347,22 @@ _winapi_PeekNamedPipe_impl(PyObject *module, HANDLE handle, int size)
if (!ret) {
return PyErr_SetExcFromWindowsErr(PyExc_OSError, 0);
}
return Py_BuildValue("ii", navail, nleft);
return Py_BuildValue("II", navail, nleft);
}
}

/*[clinic input]
_winapi.ReadFile

handle: HANDLE
size: int
size: DWORD

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... how come you changed this and the generated code didn't change? Did you run make clinic to update all files?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, sorry, I was not aware of the process and I thought that the files are regenerated on the build somehow, I committed the changes to the generated section

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the checks passed this time it seems, can you recheck if all good @pitrou?

overlapped as use_overlapped: bool(accept={int}) = False
[clinic start generated code]*/

static PyObject *
_winapi_ReadFile_impl(PyObject *module, HANDLE handle, int size,
_winapi_ReadFile_impl(PyObject *module, HANDLE handle, DWORD size,
int use_overlapped)
/*[clinic end generated code: output=492029ca98161d84 input=3f0fde92f74de59a]*/
/*[clinic end generated code: output=d3d5b44a8201b944 input=08c439d03a11aac5]*/
{
DWORD nread;
PyObject *buf;
Expand Down
8 changes: 4 additions & 4 deletions Modules/clinic/_winapi.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.