[issue12175] FileIO.readall() read the file position and size at each read

Antoine Pitrou report at bugs.python.org
Wed May 25 14:19:47 CEST 2011


Antoine Pitrou <pitrou at free.fr> added the comment:

> BufferedReader.read() calls FileIO.read() until FileIO.read() returns
> an empty byte string. Why not calling FileIO.read() only once?

BufferedReader doesn't call FileIO.read, it calls <rawio>.read().
The latter can be e.g. a socket and call recv(). If you want to read
till the end of stream, you have to repeat until recv() returns the
empty string.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12175>
_______________________________________


More information about the Python-bugs-list mailing list