Skip to content

Commit e8ca880

Browse files
miss-islingtonahcub
authored andcommitted
bpo-34563: Fix for invalid assert on big output of multiprocessing.Process (GH-9027) (GH-9064)
Fix for invalid assert on big output of multiprocessing.Process. (cherry picked from commit 266f490) Co-authored-by: Alexander Buchkovsky <[email protected]>
1 parent 20a8392 commit e8ca880

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
@@ -1337,7 +1337,7 @@ _winapi_PeekNamedPipe_impl(PyObject *module, HANDLE handle, int size)
13371337
}
13381338
if (_PyBytes_Resize(&buf, nread))
13391339
return NULL;
1340-
return Py_BuildValue("Nii", buf, navail, nleft);
1340+
return Py_BuildValue("NII", buf, navail, nleft);
13411341
}
13421342
else {
13431343
Py_BEGIN_ALLOW_THREADS
@@ -1346,22 +1346,22 @@ _winapi_PeekNamedPipe_impl(PyObject *module, HANDLE handle, int size)
13461346
if (!ret) {
13471347
return PyErr_SetExcFromWindowsErr(PyExc_OSError, 0);
13481348
}
1349-
return Py_BuildValue("ii", navail, nleft);
1349+
return Py_BuildValue("II", navail, nleft);
13501350
}
13511351
}
13521352

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

13611361
static PyObject *
1362-
_winapi_ReadFile_impl(PyObject *module, HANDLE handle, int size,
1362+
_winapi_ReadFile_impl(PyObject *module, HANDLE handle, DWORD size,
13631363
int use_overlapped)
1364-
/*[clinic end generated code: output=492029ca98161d84 input=3f0fde92f74de59a]*/
1364+
/*[clinic end generated code: output=d3d5b44a8201b944 input=08c439d03a11aac5]*/
13651365
{
13661366
DWORD nread;
13671367
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)