5454 errno = None
5555EBADF = getattr (errno , 'EBADF' , 9 )
5656EINTR = getattr (errno , 'EINTR' , 4 )
57+ EAGAIN = getattr (errno , 'EAGAIN' , 11 )
58+ EWOULDBLOCK = getattr (errno , 'EWOULDBLOCK' , 11 )
5759
5860__all__ = ["getfqdn" , "create_connection" ]
5961__all__ .extend (os ._get_exports_list (_socket ))
@@ -249,6 +251,13 @@ def __init__(self, sock, mode):
249251 self ._writing = "w" in mode
250252
251253 def readinto (self , b ):
254+ """Read up to len(b) bytes into the writable buffer *b* and return
255+ the number of bytes read. If the socket is non-blocking and no bytes
256+ are available, None is returned.
257+
258+ If *b* is non-empty, a 0 return value indicates that the connection
259+ was shutdown at the other end.
260+ """
252261 self ._checkClosed ()
253262 self ._checkReadable ()
254263 while True :
@@ -260,17 +269,28 @@ def readinto(self, b):
260269 raise
261270
262271 def write (self , b ):
272+ """Write the given bytes or bytearray object *b* to the socket
273+ and return the number of bytes written. This can be less than
274+ len(b) if not all data could be written. If the socket is
275+ non-blocking and no bytes could be written None is returned.
276+ """
263277 self ._checkClosed ()
264278 self ._checkWritable ()
265279 return self ._sock .send (b )
266280
267281 def readable (self ):
282+ """True if the SocketIO is open for reading.
283+ """
268284 return self ._reading and not self .closed
269285
270286 def writable (self ):
287+ """True if the SocketIO is open for writing.
288+ """
271289 return self ._writing and not self .closed
272290
273291 def fileno (self ):
292+ """Return the file descriptor of the underlying socket.
293+ """
274294 self ._checkClosed ()
275295 return self ._sock .fileno ()
276296
@@ -283,6 +303,9 @@ def mode(self):
283303 return self ._mode
284304
285305 def close (self ):
306+ """Close the SocketIO object. This doesn't close the underlying
307+ socket, except if all references to it have disappeared.
308+ """
286309 if self .closed :
287310 return
288311 io .RawIOBase .close (self )
0 commit comments