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.
........
This commit is contained in:
Gregory P. Smith 2010-01-04 04:50:36 +00:00
parent 960737de59
commit aafdca895b
3 changed files with 128 additions and 3 deletions

View file

@ -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()