[issue9950] socket.sendall() crash when receiving a signal
Antoine Pitrou
report at bugs.python.org
Sat Sep 25 21:11:20 CEST 2010
Antoine Pitrou <pitrou at free.fr> added the comment:
The fix is very simple, but perhaps a test should be added.
diff -r af0d7b32d6ce Modules/socketmodule.c
--- a/Modules/socketmodule.c Fri Sep 24 20:03:12 2010 +0200
+++ b/Modules/socketmodule.c Sat Sep 25 21:09:58 2010 +0200
@@ -2581,8 +2581,8 @@ sock_sendall(PySocketSockObject *s, PyOb
return select_error();
}
- Py_BEGIN_ALLOW_THREADS
do {
+ Py_BEGIN_ALLOW_THREADS
timeout = internal_select(s, 1);
n = -1;
if (timeout)
@@ -2592,6 +2592,7 @@ sock_sendall(PySocketSockObject *s, PyOb
#else
n = send(s->sock_fd, buf, len, flags);
#endif
+ Py_END_ALLOW_THREADS
if (n < 0) {
#ifdef EINTR
/* We must handle EINTR here as there is no way for
@@ -2610,7 +2611,6 @@ sock_sendall(PySocketSockObject *s, PyOb
buf += n;
len -= n;
} while (len > 0);
- Py_END_ALLOW_THREADS
PyBuffer_Release(&pbuf);
if (timeout == 1) {
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9950>
_______________________________________
More information about the Python-bugs-list
mailing list