This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients martin.panter
Date 2015-01-10.01:46:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1420854382.8.0.44417983014.issue23214@psf.upfronthosting.co.za>
In-reply-to
Content
I am trying to make LZMAFile (which implements BufferedIOBase) use a BufferedReader in read mode. However this broke test_lzma.FileTestCase.test_read1_multistream(), which calls read1() with the default size argument. This is because BufferedReader.read1() does not accept size=-1:

>>> stdin = open(0, "rb", closefd=False)
>>> stdin
<_io.BufferedReader name=0>
>>> stdin.read1()  # Parameter is mandatory
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: read1() takes exactly 1 argument (0 given)
>>> stdin.read1(-1)  # Does not accept the BufferedIOBase default
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: read length must be positive
>>> stdin.read1(0)  # Technically not positive
b''

Also, the BufferedIOBase documentation does not say what the size=-1 value means, only that it reads and returns up to -1 bytes.
History
Date User Action Args
2015-01-10 01:46:22martin.pantersetrecipients: + martin.panter
2015-01-10 01:46:22martin.pantersetmessageid: <1420854382.8.0.44417983014.issue23214@psf.upfronthosting.co.za>
2015-01-10 01:46:22martin.panterlinkissue23214 messages
2015-01-10 01:46:21martin.pantercreate