Mercurial > cpython-lru_cache-weakref
diff Lib/socket.py @ 24634:778093533a46 legacy-trunk
"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.)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 07 Aug 2002 15:46:19 +0000 |
| parents | f828f32206ba |
| children | 224c516bc11f |
line wrap: on
line diff
--- a/Lib/socket.py Wed Aug 07 15:44:53 2002 +0000 +++ b/Lib/socket.py Wed Aug 07 15:46:19 2002 +0000 @@ -174,11 +174,14 @@ class _fileobject: """Implements a file object on top of a regular socket object.""" - def __init__(self, sock, mode='rb', bufsize=8192): + def __init__(self, sock, mode='rb', bufsize=-1): self._sock = sock self._mode = mode if bufsize <= 0: - bufsize = 512 + if bufsize == 0: + bufsize = 1 # Unbuffered mode + else: + bufsize = 8192 self._rbufsize = bufsize self._wbufsize = bufsize self._rbuf = [ ]
