mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue 3551: Raise ValueError if the size causes ERROR_NO_SYSTEM_RESOURCES
This commit is contained in:
parent
238cedcd63
commit
5053fbbb38
4 changed files with 21 additions and 4 deletions
|
|
@ -23,6 +23,12 @@ conn_send_string(ConnectionObject *conn, char *string, size_t length)
|
|||
Py_BEGIN_ALLOW_THREADS
|
||||
ret = WriteFile(conn->handle, string, length, &amount_written, NULL);
|
||||
Py_END_ALLOW_THREADS
|
||||
|
||||
if (ret == 0 && GetLastError() == ERROR_NO_SYSTEM_RESOURCES) {
|
||||
PyErr_Format(PyExc_ValueError, "Cannnot send %" PY_FORMAT_SIZE_T "d bytes over connection", length);
|
||||
return MP_STANDARD_ERROR;
|
||||
}
|
||||
|
||||
return ret ? MP_SUCCESS : MP_STANDARD_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue