Skip to content

Commit 266f490

Browse files
ahcubvstinner
authored andcommitted
bpo-34563: Fix for invalid assert on big output of multiprocessing.Process (GH-9027)
Fix for invalid assert on big output of multiprocessing.Process.
1 parent 7917aad commit 266f490

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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).

Modules/_winapi.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ _winapi_PeekNamedPipe_impl(PyObject *module, HANDLE handle, int size)
13381338
}
13391339
if (_PyBytes_Resize(&buf, nread))
13401340
return NULL;
1341-
return Py_BuildValue("Nii", buf, navail, nleft);
1341+
return Py_BuildValue("NII", buf, navail, nleft);
13421342
}
13431343
else {
13441344
Py_BEGIN_ALLOW_THREADS
@@ -1347,22 +1347,22 @@ _winapi_PeekNamedPipe_impl(PyObject *module, HANDLE handle, int size)
13471347
if (!ret) {
13481348
return PyErr_SetExcFromWindowsErr(PyExc_OSError, 0);
13491349
}
1350-
return Py_BuildValue("ii", navail, nleft);
1350+
return Py_BuildValue("II", navail, nleft);
13511351
}
13521352
}
13531353

13541354
/*[clinic input]
13551355
_winapi.ReadFile
13561356
13571357
handle: HANDLE
1358-
size: int
1358+
size: DWORD
13591359
overlapped as use_overlapped: bool(accept={int}) = False
13601360
[clinic start generated code]*/
13611361

13621362
static PyObject *
1363-
_winapi_ReadFile_impl(PyObject *module, HANDLE handle, int size,
1363+
_winapi_ReadFile_impl(PyObject *module, HANDLE handle, DWORD size,
13641364
int use_overlapped)
1365-
/*[clinic end generated code: output=492029ca98161d84 input=3f0fde92f74de59a]*/
1365+
/*[clinic end generated code: output=d3d5b44a8201b944 input=08c439d03a11aac5]*/
13661366
{
13671367
DWORD nread;
13681368
PyObject *buf;

Modules/clinic/_winapi.c.h

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)