msg60460 - (view) |
Author: Jean M. Brouwers (jbrouwers) |
Date: 2004-01-18 19:37 |
There is a bug in the line buffering code in the Lib/socket.py module. The write() method in the _fileobject class will flush the buffered data at every call even if there no new line character present in the data. The problem is that the third part of the last if statement will always be True if self._wbufsize equals 1. if (self._wbufsize == 0 or self._wbufsize == 1 and '\n' in data or self._get_wbuf_len() >= self._wbufsize): self.flush() A possible fix would be the following: if (self._wbufsize == 0 or self._wbufsize == 1 and '\n' in data or self._wbufsize > 1 and self._get_wbuf_len() >= self._wbufsize): self.flush() |
|
|
msg82012 - (view) |
Author: Daniel Diniz (ajaksu2) *  |
Date: 2009-02-14 11:34 |
The code described by Jean is still present. |
|
|
msg114312 - (view) |
Author: Mark Lawrence (BreamoreBoy) * |
Date: 2010-08-19 00:35 |
I'm just wondering if the original code could be the cause of subtle bugs with socket.py, anyone? (I'm no sockets guru). There's a proposed inline patch that's never been implemented, what do you (plural) make of it?. |
|
|
msg177458 - (view) |
Author: Kristján Valur Jónsson (kristjan.jonsson) *  |
Date: 2012-12-14 11:29 |
Here's a patch for the current 2.7 stuff, from issue #16680 (which was deemed duplicate). Unless anyone objects, I'll commit that to 2.7 soon. Eight years, this has taken. |
|
|
msg177464 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2012-12-14 16:34 |
Would be nice to add a test... |
|
|
msg177471 - (view) |
Author: Kristján Valur Jónsson (kristjan.jonsson) *  |
Date: 2012-12-14 17:09 |
Good point, will do. |
|
|
msg177816 - (view) |
Author: Kristján Valur Jónsson (kristjan.jonsson) *  |
Date: 2012-12-20 13:41 |
New patch, with unittest. |
|
|
msg177982 - (view) |
Author: oleg chubin (0lejka) * |
Date: 2012-12-23 12:50 |
I just have updated patch for current version of code. It looks good for me. |
|
|
msg177986 - (view) |
Author: Andrew Svetlov (asvetlov) *  |
Date: 2012-12-23 13:47 |
LGTM. Kristján, would you like to commit? |
|
|
msg178020 - (view) |
Author: Kristján Valur Jónsson (kristjan.jonsson) *  |
Date: 2012-12-23 23:01 |
Sure, Leave it to me. |
|
|
msg178123 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2012-12-25 13:06 |
New changeset 5be3fa83d436 by Kristján Valur Jónsson in branch '2.7': issue #879399 http://hg.python.org/cpython/rev/5be3fa83d436 |
|
|