summaryrefslogtreecommitdiffstats
path: root/Lib/socket.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2010-01-04 04:50:36 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2010-01-04 04:50:36 (GMT)
commitaafdca895b5384455de662f89955f240daaa8caf (patch)
treeaa4290d54b444398f555a0dd141326031deaa77d /Lib/socket.py
parent960737de5932f91bd901d00d898337b6dc479236 (diff)
downloadcpython-aafdca895b5384455de662f89955f240daaa8caf.zip
cpython-aafdca895b5384455de662f89955f240daaa8caf.tar.gz
cpython-aafdca895b5384455de662f89955f240daaa8caf.tar.bz2
Merged revisions 74426 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74426 | gregory.p.smith | 2009-08-13 11:54:50 -0700 (Thu, 13 Aug 2009) | 4 lines Fix issue1628205: Socket file objects returned by socket.socket.makefile() now properly handles EINTR within the read, readline, write & flush methods. The socket.sendall() method now properly handles interrupted system calls. ........
Diffstat (limited to 'Lib/socket.py')
-rw-r--r--Lib/socket.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 9133411..a82e48d 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -49,9 +49,11 @@ from _socket import *
import os, sys, io
try:
- from errno import EBADF
+ import errno
except ImportError:
- EBADF = 9
+ errno = None
+EBADF = getattr(errno, 'EBADF', 9)
+EINTR = getattr(errno, 'EINTR', 4)
__all__ = ["getfqdn", "create_connection"]
__all__.extend(os._get_exports_list(_socket))
@@ -212,7 +214,13 @@ class SocketIO(io.RawIOBase):
def readinto(self, b):
self._checkClosed()
self._checkReadable()
- return self._sock.recv_into(b)
+ while True:
+ try:
+ return self._sock.recv_into(b)
+ except error as e:
+ if e.args[0] == EINTR:
+ continue
+ raise
def write(self, b):
self._checkClosed()