[issue23214] BufferedReader.read1(size) signature incompatible with BufferedIOBase.read1(size=-1)

Martin Panter report at bugs.python.org
Sun Mar 13 01:02:01 EST 2016


Martin Panter added the comment:

Looking at this again, I think a less intrusive way forward would be to:

* Document that in 3.6, the required signature is now BufferedIOBase.read1(size). An implementation no longer has to provide a default size, and no longer has to accept negative sizes.

* Explicitly document the behaviour of each concrete implementation like GzipFile.read1(-1) etc, if this behaviour is intentional

* Fix the BufferedReader error so that “read length must not be negative”

Relaxing the read1() signature would allow wider or easier use of BufferedReader, e.g. to implement HTTPResponse as I suggested in Issue 26499. The advantage would be using existing code that is well tested, used, optimized, etc, rather than a custom BufferedIOBase implementation which for the HTTP case is buggy.

----------
versions: +Python 3.6 -Python 3.4

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


More information about the Python-bugs-list mailing list