[Python-checkins] CVS: python/dist/src/Lib socket.py,1.3,1.4

Martin v. Löwis python-dev@python.org
Tue, 19 Sep 2000 04:26:01 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv17440

Modified Files:
	socket.py 
Log Message:
Support sizehint in _fileobject.readlines, as documented.


Index: socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** socket.py	2000/09/15 12:59:46	1.3
--- socket.py	2000/09/19 11:25:58	1.4
***************
*** 229,233 ****
          return data
  
!     def readlines(self):
          list = []
          while 1:
--- 229,234 ----
          return data
  
!     def readlines(self, sizehint = 0):
!         total = 0
          list = []
          while 1:
***************
*** 235,237 ****
--- 236,241 ----
              if not line: break
              list.append(line)
+             total += len(line)
+             if sizehint and total >= sizehint:
+                 break
          return list