Message27523
There are two errors in the documentation of the file
object's
read() method found at
http://www.python.org/doc/current/lib/bltin-file-objects.html#l2h-242
Suggested changes (unindented) are shown below interspersed
with the current text with insertions noted by a '+' in the
first column:
Read at most size bytes from the file (less if the
read
hits EOF before obtaining size bytes). If the size
argument is negative or omitted, read all data
until EOF
is reached.
+ Under some circumstances (e.g. system call aborted by
+ a signal) read() called with a negative or absent size
+ argument may return data before EOF is reached (even in
+ blocking mode).
The bytes are returned as a string object. An
empty string
is returned when EOF is encountered immediately. (For
certain files, like ttys, it makes sense to continue
reading after an EOF is hit.)
The last sentence above (the parenthetical one) is
false for
Linux/Unix. Once you hit EOF on a tty, it will return EOF
forever until it's closed and re-opened. If the above
sentence
is true for other OSes, I suggest it be so qualified --
otherwise it should just be deleted.
Note that this method may call the underlying C
function
fread() more than once in an effort to acquire as
close to
size bytes as possible. Also note that when in
non-blocking mode, less data than what was
requested may
be returned, even if no size parameter was given.
|
|
Date |
User |
Action |
Args |
2007-08-23 14:37:54 | admin | link | issue1432343 messages |
2007-08-23 14:37:54 | admin | create | |
|