mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Merge the trivial portion of r74426 from trunk.
socket.sendall() now handles EINTR properly internally.
This commit is contained in:
parent
aea4428fdc
commit
b585a0ff03
1 changed files with 14 additions and 1 deletions
|
@ -2572,8 +2572,21 @@ sock_sendall(PySocketSockObject *s, PyObject *args)
|
|||
#else
|
||||
n = send(s->sock_fd, buf, len, flags);
|
||||
#endif
|
||||
if (n < 0)
|
||||
if (n < 0) {
|
||||
#ifdef EINTR
|
||||
/* We must handle EINTR here as there is no way for
|
||||
* the caller to know how much was sent otherwise. */
|
||||
if (errno == EINTR) {
|
||||
/* Run signal handlers. If an exception was
|
||||
* raised, abort and leave this socket in
|
||||
* an unknown state. */
|
||||
if (PyErr_CheckSignals())
|
||||
return NULL;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
buf += n;
|
||||
len -= n;
|
||||
} while (len > 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue