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 ncoghlan
Recipients benjamin.peterson, ncoghlan, trott
Date 2009-06-13.02:27:12
SpamBayes Score 2.9303488e-08
Marked as misclassified No
Message-id <>
Assigned to Benjamin for assessment - this should be considered for rc2
since it's still broken in 3.1:

>>> f = open('', 'rb')
>>> len(f.peek(10))
>>> len(f.peek(1))
>>> len(f.peek(4095))
>>> len(f.peek(10095))

Brought up on python-dev in this thread:

And previously here:

The thread from April suggests the current behaviour may be intentional,
in which case it is the documentation that needs to be fixed, as it is
currently not just misleading but flat out wrong. Then again, Benjamin's
initial response to that thread was to support the idea of changing
peek() so that the argument actually was a cap.

The previous documentation that Alexandre quotes in the April was
changed to the current description in late April without any
corresponding change to the implementation:

However, the old description was also wrong for the io-c implementation
since it just returns the current buffered data from peek, no matter
what argument you pass in.
Date User Action Args
2009-06-13 02:27:16ncoghlansetrecipients: + ncoghlan, benjamin.peterson, trott
2009-06-13 02:27:16ncoghlansetmessageid: <>
2009-06-13 02:27:13ncoghlanlinkissue5811 messages
2009-06-13 02:27:12ncoghlancreate