Hello, Is there a reason why the stdlib socket module _fileobject.flush() method is using ._rbufsize instead of ._wbufsize at line 297 (Python 2.7.3), where it determines the buffer_size value to be used for _sock.sendall()? Does anybody know the history behind this?
Based on what I read in the code, there appear to be four code paths possible setting the _rbufsize and _wbufsize when creating an _fileobject: 1. default, or negative, bufsize argument bufsize argument is set to the default_bufsize class attribute _rbufsize = bufsize _wbufsize = bufsize 2. bufsize = 0 _rbufsize = 1 _wbufsize = 0 3. bufsize = 1 _rbufsize = default_bufsize class attribute _wbufsize = 1 4. bufsize > 1 _rbufsize = _wbufsize = bufsize With that, write() and writelines() uses _wbufsize, as expected. Additionally, could flush's buffer_size local variable be determined just the same using: buffer_size = max(self._wbufsize, self.bufsize) Thanks for considering. -peter
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com