New submission from R. David Murray <rdmur...@bitdance.com>:

The python 3.x io library appears to allow mixing calls to __next__ and
calls to readline.  As another consequence, where previously it was
necessary to use 'readline' to read single lines from a pipe without
blocking waiting for a buffer fill, now one can apparently use 'for'.

Reading the code in io.py, it seems as though this is intentional:
readline and __next__ use the same buffer, and the method on
TextIOWrapper that fills the buffer calls 'read1', which in the one
place where it has a docstring says that only as much data as is
available is read, in contrast to 'read', which reads exactly n bytes
(to EOF).

Assuming this is the intended behavior, it should be documented, and if
they do not exist (I didn't see any) tests should be added to confirm
the behavior.  If this behavior is an implementation artifact, then this
should be documented so that code is less likely to depend on it.

Once I know whether or not this behavior _should_ be part of the test
suite, I'll be happy to work on doc and test patches.

----------
components: Library (Lib)
messages: 82499
nosy: bitdancer
severity: normal
status: open
title: document expected/required behavior of 3.x io subsystem with respect to 
buffering
type: behavior
versions: Python 3.0, Python 3.1

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5323>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to