[Python-checkins] python/dist/src/Lib socket.py,1.24,1.25

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Wed, 07 Aug 2002 08:46:21 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv29169

Modified Files:
	socket.py 
Log Message:
"Unbuffered" mode of class _fileobject wasn't actually unbuffered,
and this broke a Zope "pipelining" test which read multiple responses
from the same connection (this attaches a new file object to the
socket for each response).  Added a test for this too.

(I want to do some code cleanup too, but I thought I'd first fix
the problem with as little code as possible, and add a unit test
for this case.  So that's what this checkin is about.)


Index: socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** socket.py	31 Jul 2002 17:48:02 -0000	1.24
--- socket.py	7 Aug 2002 15:46:19 -0000	1.25
***************
*** 175,183 ****
      """Implements a file object on top of a regular socket object."""
  
!     def __init__(self, sock, mode='rb', bufsize=8192):
          self._sock = sock
          self._mode = mode
          if bufsize <= 0:
!             bufsize = 512
          self._rbufsize = bufsize
          self._wbufsize = bufsize
--- 175,186 ----
      """Implements a file object on top of a regular socket object."""
  
!     def __init__(self, sock, mode='rb', bufsize=-1):
          self._sock = sock
          self._mode = mode
          if bufsize <= 0:
! 	    if bufsize == 0:
! 	        bufsize = 1 # Unbuffered mode
! 	    else:
!                 bufsize = 8192
          self._rbufsize = bufsize
          self._wbufsize = bufsize