diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2002-06-13 22:18:39 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2002-06-13 22:18:39 (GMT) |
commit | 2b3429005517673ee5903d4030990ee2b5c29171 (patch) | |
tree | 5262b0e73d806dbe484d99683165edb3de0e7f3e /Lib/socket.py | |
parent | 4178515035af42b6343bcd3e5df92d052c6f13dd (diff) | |
download | cpython-2b3429005517673ee5903d4030990ee2b5c29171.zip cpython-2b3429005517673ee5903d4030990ee2b5c29171.tar.gz cpython-2b3429005517673ee5903d4030990ee2b5c29171.tar.bz2 |
Cleanup a little
Diffstat (limited to 'Lib/socket.py')
-rw-r--r-- | Lib/socket.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Lib/socket.py b/Lib/socket.py index 04e2e33..bd0bfd7 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -197,7 +197,7 @@ class _fileobject: self._sock.sendall(buffer) self._wbuf = [ ] - def fileno (self): + def fileno(self): return self._sock.fileno() def write(self, data): @@ -235,19 +235,19 @@ class _fileobject: break buf_len += len(data) self._rbuf.append(data) - data = ''.join(self._rbuf) # Clear the rbuf at the end so we're not affected by # an exception during a recv + data = ''.join(self._rbuf) self._rbuf = [ ] if buf_len > size and size >= 0: - self._rbuf.append(data[size:]) - data = data[:size] + self._rbuf.append(data[size:]) + data = data[:size] return data def readline(self, size=-1): index = -1 buf_len = self.__get_rbuf_len() - if len (self._rbuf): + if self._rbuf: index = min([x.find('\n') for x in self._rbuf]) while index < 0 and (size < 0 or buf_len < size): recv_size = max(self._rbufsize, size - buf_len) @@ -275,7 +275,8 @@ class _fileobject: list = [] while 1: line = self.readline() - if not line: break + if not line: + break list.append(line) total += len(line) if sizehint and total >= sizehint: |