]> granicus.if.org Git - python/commit
This should fix issue2632. A long description of the two competing
authorGregory P. Smith <greg@mad-scientist.com>
Fri, 2 May 2008 07:26:52 +0000 (07:26 +0000)
committerGregory P. Smith <greg@mad-scientist.com>
Fri, 2 May 2008 07:26:52 +0000 (07:26 +0000)
commitf8cc64017ca0f33b1e21b1c9c9f5f30ebdc4da31
tree95a9a74e85ba4b09ef95e1c9dad2de5fba56076b
parentb457ddaff2094a0ec02176184beb74f600178ed4
This should fix issue2632.  A long description of the two competing
problems is in the bug report (one old, one recently introduced trying
to fix the old one).  In short:

buffer data during socket._fileobject.read() and readlines() within a
cStringIO object instead of a [] of str()s returned from the recv()
call.

This prevents excessive memory use due to the size parameter being
passed to recv() being grossly larger than the actual size of the data
returned *and* prevents excessive cpu usage due to looping in python
calling recv() with a very tiny size value if min() is used as the
previous memory-use bug "fix" did.

It also documents what the socket._fileobject._rbufsize member is
actually used for.

This is a candidate for back porting to 2.5.
Lib/socket.py