[ python-Bugs-1432343 ] Descript of file-object read() method is wrong.

SourceForge.net noreply at sourceforge.net
Wed Feb 15 18:49:14 CET 2006


Bugs item #1432343, was opened at 2006-02-15 17:49
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1432343&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Grant Edwards (grante)
Assigned to: Nobody/Anonymous (nobody)
Summary: Descript of file-object read() method is wrong.

Initial Comment:
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. 


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1432343&group_id=5470


More information about the Python-bugs-list mailing list